diff --git a/public/scripts/ui.js b/public/scripts/ui.js index ffef7ee..1917eb8 100644 --- a/public/scripts/ui.js +++ b/public/scripts/ui.js @@ -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();