loleaflet/dist/loleaflet.css | 4 ++++ loleaflet/src/layer/tile/TileLayer.js | 12 ++++++++++-- loleaflet/src/map/handler/Map.Keyboard.js | 6 +++++- 3 files changed, 19 insertions(+), 3 deletions(-)
New commits: commit 341c9dcc96dcf84cadfabcce2c3eabc09c1bf8d1 Author: Henry Castro <hcas...@collabora.com> Date: Sat Feb 10 14:20:52 2018 -0400 loleaflet: copy text of the annotation element to clipboard Change-Id: I8675b3752656afc1ba79d614d2f1fe3e7d98f600 diff --git a/loleaflet/dist/loleaflet.css b/loleaflet/dist/loleaflet.css index b4974c54..f458c371 100644 --- a/loleaflet/dist/loleaflet.css +++ b/loleaflet/dist/loleaflet.css @@ -142,6 +142,10 @@ body { .loleaflet-annotation { position: absolute; text-align: center; + user-select: text; + -moz-user-select: text; + -webkit-user-select: text; + -ms-user-select: text; } .loleaflet-annotation-content-wrapper, .loleaflet-annotation-redline-content-wrapper { diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 2ef79251..aebeaf79 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -1906,7 +1906,11 @@ L.TileLayer = L.GridLayer.extend({ _onCopy: function (e) { e = e.originalEvent; e.preventDefault(); - if (this._selectionTextContent) { + if (this._map._docLayer._textArea.value !== '') { + L.Compatibility.clipboardSet(e, this._map._docLayer._textArea.value); + this._map._docLayer._textArea.value = ''; + } + if (this._textSelectionStart && this._textSelectionEnd && this._selectionTextContent) { L.Compatibility.clipboardSet(e, this._selectionTextContent); // remember the copied text, for rich copy/paste inside a document @@ -1919,7 +1923,11 @@ L.TileLayer = L.GridLayer.extend({ _onCut: function (e) { e = e.originalEvent; e.preventDefault(); - if (this._selectionTextContent) { + if (this._map._docLayer._textArea.value !== '') { + L.Compatibility.clipboardSet(e, this._map._docLayer._textArea.value); + this._map._docLayer._textArea.value = ''; + } + if (this._textSelectionStart && this._textSelectionEnd && this._selectionTextContent) { L.Compatibility.clipboardSet(e, this._selectionTextContent); // remember the copied text, for rich copy/paste inside a document diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js index 95433c8d..6c4b1dc5 100644 --- a/loleaflet/src/map/handler/Map.Keyboard.js +++ b/loleaflet/src/map/handler/Map.Keyboard.js @@ -425,6 +425,10 @@ L.Map.Keyboard = L.Handler.extend({ }, _handleCtrlCommand: function (e) { + // Control + if (e.originalEvent.keyCode == 17) + return true; + if (e.type !== 'keydown' && e.originalEvent.key !== 'c' && e.originalEvent.key !== 'v' && e.originalEvent.key !== 'x' && /* Safari */ e.originalEvent.keyCode !== 99 && e.originalEvent.keyCode !== 118 && e.originalEvent.keyCode !== 120) { e.originalEvent.preventDefault(); @@ -512,7 +516,7 @@ L.Map.Keyboard = L.Handler.extend({ case 91: // Left Cmd (Safari) case 93: // Right Cmd (Safari) // we prepare for a copy or cut event - this._map._docLayer._textArea.value = 'dummy text'; + this._map._docLayer._textArea.value = window.getSelection().toString(); this._map._docLayer._textArea.focus(); this._map._docLayer._textArea.select(); return true; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits