[Libreoffice-commits] online.git: loleaflet/src
Jan Holesovsky
kendy at collabora.com
Fri Jan 22 07:31:12 PST 2016
loleaflet/src/layer/tile/TileLayer.js | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
New commits:
commit 1da4769924d465f9dbe3fea6be39f74156ed7555
Author: Jan Holesovsky <kendy at 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);
+ }
}
},
More information about the Libreoffice-commits
mailing list