mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-20 15:06:15 -04:00
Prevent executing _onCopy() when text is selected on receive text dialog
This commit is contained in:
parent
676c68b6e7
commit
d58f380565
1 changed files with 5 additions and 2 deletions
|
@ -1978,12 +1978,15 @@ class ReceiveTextDialog extends Dialog {
|
||||||
this._receiveTextQueue = [];
|
this._receiveTextQueue = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectionEmpty() {
|
||||||
|
return !window.getSelection().toString()
|
||||||
|
}
|
||||||
|
|
||||||
async _onKeyDown(e) {
|
async _onKeyDown(e) {
|
||||||
if (!this.isShown()) return
|
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()
|
await this._onCopy()
|
||||||
this.hide();
|
|
||||||
}
|
}
|
||||||
else if (e.code === "Escape") {
|
else if (e.code === "Escape") {
|
||||||
this.hide();
|
this.hide();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue