From da59a84935107a46eb5573eb424d84062a53ff68 Mon Sep 17 00:00:00 2001 From: Marco Cecchetti Date: Thu, 12 Oct 2023 16:53:33 +0200 Subject: [PATCH] followup: no copy event is emitted by hitting CTRL+C with no selection This is still occurring also in Firefox 118. Anyway it seems to never occur on Windows. Signed-off-by: Marco Cecchetti Change-Id: I0e5c643912f2276c60bdba1b2ad1ed801785193f --- browser/src/layer/marker/TextInput.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/browser/src/layer/marker/TextInput.js b/browser/src/layer/marker/TextInput.js index a98cd67fcadf..8799feec3f54 100644 --- a/browser/src/layer/marker/TextInput.js +++ b/browser/src/layer/marker/TextInput.js @@ -954,11 +954,12 @@ L.TextInput = L.Layer.extend({ this._newlineHint = ev.keyCode === 13; this._linebreakHint = this._newlineHint && ev.shiftKey; - // In Firefox 117 no copy/cut input event is emitted when CTRL+C/X is pressed with no selection - // in a text element with contenteditable='true'. Since no copy/cut event is emitted, - // Clipboard.copy/cut is never invoked. So we need to emit it manually. + // In Firefox 117 and greater no copy/cut input event is emitted when CTRL+C/X is pressed + // with no selection in a text element with contenteditable='true'. Since no copy/cut event + // is emitted, Clipboard.copy/cut is never invoked. So we need to emit it manually. // To be honest it seems a Firefox bug. We need to check if they fix it in later version. - if (!this.hasAccessibilitySupport() && L.Browser.gecko && L.Browser.geckoVersion === '117.0' && + if (!this.hasAccessibilitySupport() && !L.Browser.win && + L.Browser.gecko && L.Browser.geckoVersion >= '117.0' && ev.ctrlKey && window.getSelection().isCollapsed) { if (ev.key === 'c') { document.execCommand('copy');