diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2022-04-19 13:28:01 +0200 |
---|---|---|
committer | Szymon Kłos <eszkadev@gmail.com> | 2022-04-23 10:58:55 +0200 |
commit | acb0ed3bbdb8d40bdbf88aaafc9184e514fefd99 (patch) | |
tree | 5e828ee2e0f34c43c7ee494e0329e72c53103306 | |
parent | jsdialog: apply selection in textarea (diff) | |
download | online-acb0ed3bbdb8d40bdbf88aaafc9184e514fefd99.tar.gz online-acb0ed3bbdb8d40bdbf88aaafc9184e514fefd99.zip |
jsdialog: use only one handler for selection
this will allow us to avoid doubled messaged
and ugly bugs, setting selection in JS works as
async call and it's hard to not trigger own handler...
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ibeae30c04374116776413b19ebd8efca043e9c0e
-rw-r--r-- | browser/src/control/Control.JSDialogBuilder.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/browser/src/control/Control.JSDialogBuilder.js b/browser/src/control/Control.JSDialogBuilder.js index cd6e2a1bf0..665b15cde0 100644 --- a/browser/src/control/Control.JSDialogBuilder.js +++ b/browser/src/control/Control.JSDialogBuilder.js @@ -1474,13 +1474,11 @@ L.Control.JSDialogBuilder = L.Control.extend({ }); if (data.rawKeyEvents) { - 'select click'.split(' ').forEach(function(eventName) { - edit.addEventListener(eventName, function(event) { - if (edit.disabled) - return; - var selection = event.target.selectionStart + ';' + event.target.selectionEnd; - builder.callback('edit', 'textselection', edit, selection, builder); - }); + edit.addEventListener('mouseup', function(event) { + if (edit.disabled) + return; + var selection = event.target.selectionStart + ';' + event.target.selectionEnd; + builder.callback('edit', 'textselection', edit, selection, builder); }); } |