diff options
author | Jan Holesovsky <kendy@collabora.com> | 2019-06-27 13:06:32 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2019-11-14 15:03:11 +0100 |
commit | 865c10cfd531c9e4c290a2b9e89235afb8da0fa1 (patch) | |
tree | f7c3e6206ee53262451d4362108ce450d2fa6591 | |
parent | 92f5d7407341b4eeda4ccf5c9c2c83661313e3b3 (diff) |
Make Ctrl+f jumping to the search again.
I think better to just fire a new 'focussearch' event and handle all the
Ctrl+<something> at one place.
When at this, fix also a regression that Ctrl+f in the search bar
triggered the browser's search.
Change-Id: I759be9ed3934e14b1e05a37a65ca1ce54d99eb0b
Reviewed-on: https://gerrit.libreoffice.org/82700
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r-- | loleaflet/src/control/Control.Toolbar.js | 12 | ||||
-rw-r--r-- | loleaflet/src/map/handler/Map.Keyboard.js | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js index faa3e0f6f..b27fa584e 100644 --- a/loleaflet/src/control/Control.Toolbar.js +++ b/loleaflet/src/control/Control.Toolbar.js @@ -2418,14 +2418,10 @@ function setupToolbar(e) { $('#current-editor').text(e.username); }); - map.on('keydown', function (e) { - if (e.originalEvent.ctrlKey && !e.originalEvent.altKey && - (e.originalEvent.key === 'f' || e.originalEvent.key === 'F')) { - var entry = L.DomUtil.get('search-input'); - entry.focus(); - entry.select(); - e.originalEvent.preventDefault(); - } + map.on('focussearch', function () { + var entry = L.DomUtil.get('search-input'); + entry.focus(); + entry.select(); }); map.on('hyperlinkclicked', function (e) { diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js index 346c2147b..13f605e28 100644 --- a/loleaflet/src/map/handler/Map.Keyboard.js +++ b/loleaflet/src/map/handler/Map.Keyboard.js @@ -437,6 +437,12 @@ L.Map.Keyboard = L.Handler.extend({ return true; } + if (e.ctrlKey && (e.key === 'f' || e.key === 'F')) { + this._map.fire('focussearch'); + e.preventDefault(); + return true; + } + if (e.altKey || e.shiftKey) { // need to handle Ctrl + Alt + C separately for Firefox |