[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-7' - 2 commits - loleaflet/src
Andras Timar
andras.timar at collabora.com
Sun Jan 24 09:24:19 PST 2016
loleaflet/src/map/handler/Map.Keyboard.js | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
New commits:
commit 951a3a263cdcade3443080644c99a6ca64b0d540
Author: Andras Timar <andras.timar at collabora.com>
Date: Sun Jan 24 18:20:30 2016 +0100
loleaflet: fix Cmd+C / Cmd+X / Cmd+V on OS X Safari
(cherry picked from commit bc98b0194ed5993b1c19dda7287cf2a4319f83ce)
diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js
index a4fef65..e765bcf 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -317,13 +317,15 @@ L.Map.Keyboard = L.Handler.extend({
},
_handleCtrlCommand: function (e) {
- if (e.type !== 'keydown' && e.originalEvent.key !== 'c' && e.originalEvent.key !== 'v' && e.originalEvent.key !== 'x') {
+ 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();
return true;
}
if (e.originalEvent.keyCode !== 67 && e.originalEvent.keyCode !== 86 && e.originalEvent.keyCode !== 88 &&
- 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.key !== 'c' && e.originalEvent.key !== 'v' && e.originalEvent.key !== 'x') {
// not copy or paste
e.originalEvent.preventDefault();
}
@@ -374,6 +376,8 @@ L.Map.Keyboard = L.Handler.extend({
return false;
case 67: // c
case 88: // x
+ case 99: // c (Safari)
+ case 120: // x (Safari)
// we prepare for a copy or cut event
this._map._docLayer._textArea.value = 'dummy text';
this._map._docLayer._textArea.focus();
@@ -383,6 +387,7 @@ L.Map.Keyboard = L.Handler.extend({
this._map.print();
return true;
case 86: // v
+ case 118: // v (Safari)
return true;
case 112: // f1
this._map._socket.sendMessage('uno .uno:NoteVisible');
commit 2b2d5b8791468a819a77d47dda3cffc66821c511
Author: Andras Timar <andras.timar at collabora.com>
Date: Sun Jan 24 17:42:19 2016 +0100
loleaflet: fix Cmd+C / Cmd+X / Cmd+V on OS X Firefox and Chrome
(cherry picked from commit 7e50b73f5089acabaa473ebd3bd25cd094a17565)
diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js
index 956b118..a4fef65 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -233,11 +233,7 @@ L.Map.Keyboard = L.Handler.extend({
var cmd = e.originalEvent.metaKey ? this.keyModifier.ctrlMac : 0;
this.modifier = shift | ctrl | alt | cmd;
- if (cmd) {
- return;
- }
-
- if (ctrl) {
+ if (ctrl || cmd) {
if (this._handleCtrlCommand(e)) {
return;
}
@@ -398,7 +394,8 @@ L.Map.Keyboard = L.Handler.extend({
this._map._socket.sendMessage('uno .uno:SuperScript');
return true;
}
- if (e.type === 'keypress' && e.originalEvent.ctrlKey && (e.originalEvent.key === 'c' || e.originalEvent.key === 'v' || e.originalEvent.key === 'x')) {
+ if (e.type === 'keypress' && (e.originalEvent.ctrlKey || e.originalEvent.metaKey) &&
+ (e.originalEvent.key === 'c' || e.originalEvent.key === 'v' || e.originalEvent.key === 'x')) {
// need to handle this separately for Firefox
return true;
}
More information about the Libreoffice-commits
mailing list