[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3-0' - loleaflet/dist loleaflet/src
Henry Castro
hcastro at collabora.com
Thu Feb 15 15:37:24 UTC 2018
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 91e4dce9b6f4e2f1a258e1a4e14365d1edb9c468
Author: Henry Castro <hcastro at collabora.com>
Date: Sat Feb 10 14:20:52 2018 -0400
loleaflet: copy text of the annotation element to clipboard
Change-Id: I8675b3752656afc1ba79d614d2f1fe3e7d98f600
Reviewed-on: https://gerrit.libreoffice.org/49546
Reviewed-by: pranavk <pranavk at collabora.co.uk>
Tested-by: pranavk <pranavk at collabora.co.uk>
diff --git a/loleaflet/dist/loleaflet.css b/loleaflet/dist/loleaflet.css
index 57185f0e..98bffaa7 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 8e36d7ab..5f777182 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1815,7 +1815,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
@@ -1828,7 +1832,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 c7161535..11c9d57b 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -428,6 +428,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();
@@ -515,7 +519,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;
More information about the Libreoffice-commits
mailing list