kit/ChildSession.cpp                  |    9 +++++----
 loleaflet/src/layer/tile/TileLayer.js |    9 +++++++++
 2 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 805ff2f2a8c1672b9ca0fef2b7364f9e9f38761b
Author:     gokaysatir <gokaysa...@collabora.com>
AuthorDate: Tue Sep 22 14:39:09 2020 +0300
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Wed Sep 30 15:10:19 2020 +0200

    Online: Copy hyperlink location. / Online side.
    
    Unused selection variable has been removed. "clipboardchanged" event is 
activated.
    LOK_CALLBACK_CLIPBOARD_CHANGED is handled according to existence of payload.
    
    Change-Id: I6e37cb2ca4d4c59e55555ba3397cb00dbb7eafa2
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103165
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 54d900da6..314ff12da 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1529,7 +1529,7 @@ bool ChildSession::unoCommand(const char* /*buffer*/, int 
/*length*/, const Stri
         }
         else
         {
-            if (tokens[1] == ".uno:Copy")
+            if (tokens[1] == ".uno:Copy" || tokens[1] == 
".uno:CopyHyperlinkLocation")
                 _copyToClipboard = true;
 
             getLOKitDocument()->postUnoCommand(tokens[1].c_str(), nullptr, 
bNotify);
@@ -2599,14 +2599,15 @@ void ChildSession::loKitCallback(const int type, const 
std::string& payload)
         break;
     case LOK_CALLBACK_CLIPBOARD_CHANGED:
     {
-        std::string selection;
         if (_copyToClipboard)
         {
             _copyToClipboard = false;
-            selection = getTextSelectionInternal("");
+            if (payload.empty())
+                getTextSelectionInternal("");
+            else
+                sendTextFrame("clipboardchanged: " + payload);
         }
 
-        sendTextFrame("clipboardchanged: " + selection);
         break;
     }
     case LOK_CALLBACK_CONTEXT_CHANGED:
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 6f4445084..41ff45a07 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -643,6 +643,15 @@ L.TileLayer = L.GridLayer.extend({
                                // hack for ios and android to get selected 
text into hyperlink insertion dialog
                                this._selectedTextContent = textMsg.substr(22);
                }
+               else if (textMsg.startsWith('clipboardchanged')) {
+                       var jMessage = textMsg.substr(17);
+                       jMessage = JSON.parse(jMessage);
+
+                       if (jMessage.mimeType === 'text/plain') {
+                               
this._map._clip.setTextSelectionHTML(jMessage.content);
+                               this._map._clip._execCopyCutPaste('copy');
+                       }
+               }
                else if (textMsg.startsWith('textselectionend:')) {
                        this._onTextSelectionEndMsg(textMsg);
                }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to