[Libreoffice-commits] online.git: 2 commits - loleaflet/src
Pranav Kant
pranavk at collabora.co.uk
Thu Mar 30 12:43:13 UTC 2017
loleaflet/src/control/Control.ContextMenu.js | 18 ++++++++++++++++++
loleaflet/src/layer/tile/TileLayer.js | 24 +++++++++++++-----------
2 files changed, 31 insertions(+), 11 deletions(-)
New commits:
commit 87c9b30f48b3e8efa9a82f37194fc5216800f3ef
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Thu Mar 30 18:10:42 2017 +0530
tdf#106842: Prefix 'Internal ' to cut/copy/paste strings
... in DisableCopy mode.
Change-Id: Id758d4654fbe129dd16a466050bf51686440909d
diff --git a/loleaflet/src/control/Control.ContextMenu.js b/loleaflet/src/control/Control.ContextMenu.js
index 54bd078d..73f0d51f 100644
--- a/loleaflet/src/control/Control.ContextMenu.js
+++ b/loleaflet/src/control/Control.ContextMenu.js
@@ -129,6 +129,21 @@ L.Control.ContextMenu = L.Control.extend({
// Lets use the later for simplicity and to leverage the core translations in online
itemName = itemName.replace(itemName.substring('Delete All Comments by '.length), 'This Author');
}
+
+ if (map['wopi'].DisableCopy) {
+ switch (commandName) {
+ case 'Cut':
+ itemName = _('Internal Cut');
+ break;
+ case 'Copy':
+ itemName = _('Internal Copy');
+ break;
+ case 'Paste':
+ itemName = _('Internal Paste');
+ break;
+ }
+ }
+
contextMenu[item.command] = {
name: _(itemName)
};
@@ -146,6 +161,9 @@ L.Control.ContextMenu = L.Control.extend({
isLastItemText = true;
} else if (item.type === 'menu') {
itemName = item.text.replace('~', '');
+ if (map['wopi'].DisableCopy && itemName === 'Paste Special') {
+ itemName = _('Internal Paste Special');
+ }
var submenu = this._createContextMenuStructure(item);
// ignore submenus with all items disabled
if (Object.keys(submenu).length === 0) {
commit 017fe90af1ee125ead251f19fcb1c99120b8e2bc
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Thu Mar 30 17:50:27 2017 +0530
loleaflet: Refine copy/pasting in DisableCopy mode
We always want internal document copy/paste to work and always want to
do a richtext copy/paste whenever possible.
Change-Id: I54705293bd34bc284ceff815ebdf556c7ca1587c
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 0d5a9451..05a6e504 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1719,8 +1719,9 @@ L.TileLayer = L.GridLayer.extend({
// remember the copied text, for rich copy/paste inside a document
this._selectionTextHash = this._selectionTextContent;
- this._map._socket.sendMessage('uno .uno:Copy');
}
+
+ this._map._socket.sendMessage('uno .uno:Copy');
},
_onCut: function (e) {
@@ -1731,23 +1732,24 @@ L.TileLayer = L.GridLayer.extend({
// remember the copied text, for rich copy/paste inside a document
this._selectionTextHash = this._selectionTextContent;
- this._map._socket.sendMessage('uno .uno:Cut');
}
+
+ this._map._socket.sendMessage('uno .uno:Cut');
},
_onPaste: function (e) {
e = e.originalEvent;
e.preventDefault();
var pasteString = L.Compatibility.clipboardGet(e);
- if (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);
- }
+ if (pasteString === 'false' || !!pasteString || pasteString === this._selectionTextHash) {
+ // If there is nothing to paste in clipboard, no harm in
+ // issuing a .uno:Paste in case there is something internally copied in the document
+ // or if the content of the clipboard did not change, we surely must do a rich paste
+ // instead of a normal 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