Skip to content

Commit

Permalink
fix: Content editable in shadow dom fix zurb#685, zurb#906
Browse files Browse the repository at this point in the history
  • Loading branch information
ra00l authored and tohosaku committed Aug 12, 2024
1 parent 3be11e8 commit 4d0bfb7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Tribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Tribute {
values = null,
loadingItemTemplate = null,
iframe = null,
shadowRoot = null,
selectClass = "highlight",
containerClass = "tribute-container",
itemClass = "",
Expand Down Expand Up @@ -58,6 +59,9 @@ class Tribute {
// is it wrapped in an iframe
iframe: iframe,

// is it wrapped in a web component
shadowRoot: shadowRoot,

// class applied to selected item
selectClass: selectClass,

Expand Down
4 changes: 4 additions & 0 deletions src/TributeRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ class TributeRange {
return this.tribute.collection.iframe.contentWindow.getSelection()
}

if (this.tribute.collection[0].shadowRoot) {
return this.tribute.collection[0].shadowRoot.getSelection()
}

return window.getSelection()
}

Expand Down

0 comments on commit 4d0bfb7

Please sign in to comment.