loleaflet/src/layer/tile/TileLayer.js |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 1da4769924d465f9dbe3fea6be39f74156ed7555
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Fri Jan 22 16:26:46 2016 +0100

    loleaflet: Implement rich copy / paste inside the document.

diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 27564b1..55e7004 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -951,6 +951,10 @@ L.TileLayer = L.GridLayer.extend({
                e.preventDefault();
                if (this._selectionTextContent) {
                        L.Compatibility.clipboardSet(e, 
this._selectionTextContent);
+
+                       // remember the copied text, for rich copy/paste inside 
a document
+                       this._selectionTextHash = this._selectionTextContent;
+                       this._map._socket.sendMessage('uno .uno:Copy');
                }
        },
 
@@ -959,6 +963,9 @@ L.TileLayer = L.GridLayer.extend({
                e.preventDefault();
                if (this._selectionTextContent) {
                        L.Compatibility.clipboardSet(e, 
this._selectionTextContent);
+
+                       // remember the copied text, for rich copy/paste inside 
a document
+                       this._selectionTextHash = this._selectionTextContent;
                        this._map._socket.sendMessage('uno .uno:Cut');
                }
        },
@@ -968,7 +975,14 @@ L.TileLayer = L.GridLayer.extend({
                e.preventDefault();
                var pasteString = L.Compatibility.clipboardGet(e);
                if (pasteString) {
-                       this._map._socket.sendMessage('paste 
mimetype=text/plain;charset=utf-8\n' + pasteString);
+                       if (pasteString === this._selectionTextHash) {
+                               // content of the clipboard did not change, we 
can do rich
+                               // paste
+                               this._map._socket.sendMessage('uno .uno:Paste');
+                       }
+                       else {
+                               this._map._socket.sendMessage('paste 
mimetype=text/plain;charset=utf-8\n' + pasteString);
+                       }
                }
        },
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to