[Libreoffice-commits] online.git: loleaflet/src

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 14 14:03:31 UTC 2019


 loleaflet/src/control/Control.Toolbar.js  |   12 ++++--------
 loleaflet/src/map/handler/Map.Keyboard.js |    6 ++++++
 2 files changed, 10 insertions(+), 8 deletions(-)

New commits:
commit 865c10cfd531c9e4c290a2b9e89235afb8da0fa1
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Thu Jun 27 13:06:32 2019 +0200
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 14 15:03:11 2019 +0100

    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 at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

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


More information about the Libreoffice-commits mailing list