diff options
-rw-r--r-- | kit/ChildSession.cpp | 9 | ||||
-rw-r--r-- | loleaflet/src/layer/tile/TileLayer.js | 9 |
2 files changed, 14 insertions, 4 deletions
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); } |