loleaflet/src/control/Toolbar.js              |    2 ++
 loleaflet/src/layer/tile/TileLayer.js         |    7 +++++++
 loleaflet/src/map/handler/Map.TouchGesture.js |    6 +++++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit c4f9e4bda711489548d8d7610f9dfea61d84ce47
Author:     mert <mert.tu...@collabora.com>
AuthorDate: Mon Mar 30 12:03:12 2020 +0300
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Mar 30 21:51:48 2020 +0200

    mobile: fix hyperlink on selected text
    
    Insert hyperlink dialog does not have the selected text in the Text field.
    So when you select something and want to make it a hyperlink,
    you have to type the text again.
    Also fixed tapping on hyperlink popup changes cursor position making editing
    the link unable to edit
    
    Change-Id: I0d00c4cf001de0f297cc2ed7e5b0f8576e1dab01
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91349
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index e6316188a..d1e4bdafd 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -442,6 +442,8 @@ L.Map.include({
                        link = this.hyperlinkUnderCursor.link;
                } else if (this._clip && this._clip._selectionType == 'text') {
                        text = 
this.extractContent(this._clip._selectionContent);
+               } else if (this._docLayer._selectedTextContent) {
+                       text = 
this.extractContent(this._docLayer._selectedTextContent);
                }
 
                vex.dialog.open({
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 6ce377988..5245d085f 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -194,6 +194,7 @@ L.TileLayer = L.GridLayer.extend({
                this._editorId = -1;
                this._followUser = false;
                this._followEditor = false;
+               this._selectedTextContent = '';
        },
 
        onAdd: function (map) {
@@ -619,6 +620,9 @@ L.TileLayer = L.GridLayer.extend({
                else if (textMsg.startsWith('textselectioncontent:')) {
                        if (this._map._clip)
                                
this._map._clip.setTextSelectionHTML(textMsg.substr(22));
+                       else
+                               // hack for ios and android to get selected 
text into hyperlink insertion dialog
+                               this._selectedTextContent = textMsg.substr(22);
                }
                else if (textMsg.startsWith('textselectionend:')) {
                        this._onTextSelectionEndMsg(textMsg);
@@ -1991,6 +1995,8 @@ L.TileLayer = L.GridLayer.extend({
                this._onUpdateCellCursor();
                if (this._map._clip)
                        this._map._clip.clearSelection();
+               else
+                       this._selectedTextContent = '';
        },
 
        containsSelection: function (latlng) {
@@ -3081,6 +3087,7 @@ L.TileLayer = L.GridLayer.extend({
                else {
                        this._textSelectionStart = null;
                        this._textSelectionEnd = null;
+                       this._selectedTextContent = '';
                        for (key in this._selectionHandles) {
                                
this._map.removeLayer(this._selectionHandles[key]);
                                this._selectionHandles[key].isDragged = false;
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js 
b/loleaflet/src/map/handler/Map.TouchGesture.js
index cf0041d53..95c2eb25e 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -302,8 +302,12 @@ L.Map.TouchGesture = L.Handler.extend({
 
                // clicked a hyperlink popup - not really designed for this.
                if (this._map.hyperlinkPopup && e.target &&
-                       this._map.hyperlinkPopup._contentNode == 
e.target.parentNode)
+                       this._map.hyperlinkPopup._contentNode == 
e.target.parentNode) {
                        this._map.fire('hyperlinkclicked', {url: 
e.target.href});
+                       // not forward mouse events to core if the user tap on 
a hyperlink popup box
+                       // for instance on Writer that causes the text cursor 
to be moved
+                       return;
+               }
 
                this._map.fire('closepopups');
                this._map.fire('closemobilewizard');
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to