Fix autocomplete on Chrome, because contenteditable and shadowRoots are tricksy, and this module for @mentions is aging. #65

This commit is contained in:
Cory McWilliams 2024-06-06 19:52:37 -04:00
parent f66cf0f802
commit c7a6d426f0
3 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🐌", "emoji": "🐌",
"previous": "&zRv7YNZBT/NoliiTS7Jn/Q+3przdFZljUl8yPBIpSSE=.sha256" "previous": "&RGDjjNsX3jYJFpOcDyI+LH2qmscuY0q8gP4dyJjOtww=.sha256"
} }

View File

@ -291,6 +291,7 @@ class TfComposeElement extends LitElement {
); );
} }
let tribute = new Tribute({ let tribute = new Tribute({
iframe: this.shadowRoot,
collection: [ collection: [
{ {
values: values, values: values,
@ -325,6 +326,7 @@ class TfComposeElement extends LitElement {
let encrypt = this.renderRoot.getElementById('encrypt_to'); let encrypt = this.renderRoot.getElementById('encrypt_to');
if (encrypt) { if (encrypt) {
let tribute = new Tribute({ let tribute = new Tribute({
iframe: this.shadowRoot,
values: Object.entries(this.users).map((x) => ({ values: Object.entries(this.users).map((x) => ({
key: x[1].name, key: x[1].name,
value: x[0], value: x[0],

View File

@ -483,8 +483,8 @@ class TributeRange {
getDocument() { getDocument() {
let iframe; let iframe;
if (this.tribute.current.collection) { if (this.tribute.current.collection[0].iframe) {
iframe = this.tribute.current.collection.iframe; iframe = this.tribute.current.collection[0].iframe;
} }
if (!iframe) { if (!iframe) {
@ -653,8 +653,8 @@ class TributeRange {
} }
getWindowSelection() { getWindowSelection() {
if (this.tribute.collection.iframe) { if (this.tribute.collection[0].iframe) {
return this.tribute.collection.iframe.contentWindow.getSelection() return this.tribute.collection[0].iframe.getSelection()
} }
return window.getSelection() return window.getSelection()