mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2026-04-18 15:22:16 +00:00
Prevent executing _onCopy() when text is selected on receive text dialog
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user