loleaflet/src/control/Control.Toolbar.js |    5 +++--
 loleaflet/src/layer/tile/TileLayer.js    |    1 +
 loleaflet/src/map/Map.js                 |   13 +++++++++++++
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 8ad7c4790c4a34d3e6a5ebfe5810b6cb00354acc
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Tue Feb 11 08:34:04 2020 -0500
Commit:     Ashod Nakashian <ashnak...@gmail.com>
CommitDate: Wed Feb 26 01:33:30 2020 +0100

    leaflet: fix searching in document functionality
    
    This makes searching work again, but typing 'r'
    still triggers F3, which simply matches the next
    hit (on desktop, on mobile it works fine).
    
    So (on desktop) typing 'your' will match the first 'you'
    and the 'r' will move the search results to the
    second 'you' (assuming there are at least two 'you'
    entries in the document and one 'your').
    
    Change-Id: Iab425afdfb3848ecff97f5599ceb7cae160b097d
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89357
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/loleaflet/src/control/Control.Toolbar.js 
b/loleaflet/src/control/Control.Toolbar.js
index 6c47153f2..95c36dedd 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -1372,8 +1372,9 @@ function onSearchKeyPress(e) {
 }
 
 function onSearchFocus() {
-       // hide the caret in the main document
-       map._onLostFocus();
+       // Start searching.
+       map.fire('searchstart');
+
        updateSearchButtons();
 }
 
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 3ff3e8a58..6f7c924eb 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -2159,6 +2159,7 @@ L.TileLayer = L.GridLayer.extend({
                if (this._map._permission === 'edit'
                && this._map._isCursorVisible   // only when LOK has told us it 
is ok
                && this._map.editorHasFocus()   // not when document is not 
focused
+               && !this._map.isSearching()     // not when searching within 
the doc
                && !this._isZooming             // not when zooming
 //             && !this.isGraphicVisible()     // not when sizing / 
positioning graphics
                && !this._isEmptyRectangle(this._visibleCursor)) {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index cd2c8aad1..4aa7fd7c7 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -120,6 +120,8 @@ L.Map = L.Evented.extend({
                this._winId = 0;
                // The object of the dialog, if any (must have .focus callable).
                this._activeDialog = null;
+               // True only when searching within the doc, as we need to use 
winId==0.
+               this._isSearching = false;
 
 
                vex.dialogID = -1;
@@ -248,6 +250,8 @@ L.Map = L.Evented.extend({
                // Fired to signal that the input focus is being changed.
                this.on('changefocuswidget', this._onChangeFocusWidget, this);
 
+               this.on('searchstart', this._onSearchStart, this);
+
                // View info (user names and view ids)
                this._viewInfo = {};
                this._viewInfoByUserName = {};
@@ -947,6 +951,10 @@ L.Map = L.Evented.extend({
                this.fire('hyperlinkclicked', {url: helpURL});
        },
 
+       isSearching: function() {
+               return this._isSearching;
+       },
+
        _fireInitComplete: function (condition) {
                if (this.initComplete) {
                        return;
@@ -1358,6 +1366,7 @@ L.Map = L.Evented.extend({
 
                this._winId = winId;
                this._activeDialog = dialog;
+               this._isSearching = false;
 
                var doclayer = this._docLayer;
                if (doclayer)
@@ -1402,6 +1411,10 @@ L.Map = L.Evented.extend({
                }
        },
 
+       _onSearchStart: function () {
+               this._isSearching = true;
+       },
+
        _onUpdateProgress: function (e) {
                if (e.statusType === 'start') {
                        if (this._socket.socket.readyState === 1) {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to