Fixes chatting functions for new approach (contenteditable div)
This commit is contained in:
parent
5467087600
commit
c14c121ba5
1 changed files with 21 additions and 14 deletions
|
@ -315,12 +315,19 @@ class SendTextDialog extends Dialog {
|
|||
this._recipient = recipient;
|
||||
this._handleShareTargetText();
|
||||
this.show();
|
||||
this.$text.setSelectionRange(0, this.$text.value.length)
|
||||
|
||||
const range = document.createRange();
|
||||
const sel = window.getSelection();
|
||||
|
||||
range.selectNodeContents(this.$text);
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
|
||||
}
|
||||
|
||||
_handleShareTargetText() {
|
||||
if (!window.shareTargetText) return;
|
||||
this.$text.value = window.shareTargetText;
|
||||
this.$text.textContent = window.shareTargetText;
|
||||
window.shareTargetText = '';
|
||||
}
|
||||
|
||||
|
@ -328,7 +335,7 @@ class SendTextDialog extends Dialog {
|
|||
e.preventDefault();
|
||||
Events.fire('send-text', {
|
||||
to: this._recipient,
|
||||
text: this.$text.value
|
||||
text: this.$text.textContent
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue