Prevent executing _onCopy() when text is selected on receive text dialog

This commit is contained in:
schlagmichdoch 2024-01-03 16:53:09 +01:00
parent 676c68b6e7
commit d58f380565

View file

@ -1978,12 +1978,15 @@ class ReceiveTextDialog extends Dialog {
this._receiveTextQueue = [];
}
selectionEmpty() {
return !window.getSelection().toString()
}
async _onKeyDown(e) {
if (!this.isShown()) return
if (e.code === "KeyC" && (e.ctrlKey || e.metaKey)) {
if (e.code === "KeyC" && (e.ctrlKey || e.metaKey) && this.selectionEmpty()) {
await this._onCopy()
this.hide();
}
else if (e.code === "Escape") {
this.hide();