[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-0' - loleaflet/src
Pranav Kant
pranavk at collabora.co.uk
Mon Jan 9 20:20:35 UTC 2017
loleaflet/src/map/handler/Map.Keyboard.js | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
New commits:
commit af53438aeda514c74b17cebcc9a879a64f49d9df
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Thu Jan 5 13:13:20 2017 +0530
loleaflet: Don't forward shift+insert/delete key events
This are converted to 'cut', 'paste' events which are
automatically handled by us using uno commands, so avoid
double-handling them.
Change-Id: If97e9f4efabbb929e7a5dd87c1228ee6a0df9e61
(cherry picked from commit 5374b6c6ff440b4016f393557b8e8846481a1355)
Reviewed-on: https://gerrit.libreoffice.org/32883
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js
index 9422a9b..0da5e09 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -119,7 +119,7 @@ L.Map.Keyboard = L.Handler.extend({
222 : null // single quote : UNKOWN
},
- handleOnKeyDown: {
+ handleOnKeyDownKeys: {
// these keys need to be handled on keydown in order for them
// to work on chrome
8 : true, // backspace
@@ -180,6 +180,19 @@ L.Map.Keyboard = L.Handler.extend({
this._map.off('compositionstart compositionupdate compositionend textInput', this._onKeyDown, this);
},
+ _handleOnKeyDown: function (keyCode, modifier) {
+ if (modifier & this.keyModifier.shift) {
+ // don't handle shift+insert, shift+delete
+ // These are converted to 'cut', 'paste' events which are
+ // automatically handled by us, so avoid double-handling
+ if (keyCode === 45 || keyCode === 46) {
+ return false;
+ }
+ }
+
+ return this.handleOnKeyDownKeys[keyCode];
+ },
+
_setPanOffset: function (pan) {
var keys = this._panKeys = {},
codes = this.navigationKeyCodes,
@@ -295,12 +308,12 @@ L.Map.Keyboard = L.Handler.extend({
this._keyHandled = false;
this._bufferedTextInputEvent = null;
- if (this.handleOnKeyDown[keyCode] && charCode === 0) {
+ if (this._handleOnKeyDown(keyCode, this.modifier) && charCode === 0) {
docLayer._postKeyboardEvent('input', charCode, unoKeyCode);
}
}
else if ((e.type === 'keypress' || e.type === 'compositionend') &&
- (!this.handleOnKeyDown[keyCode] || charCode !== 0)) {
+ (!this._handleOnKeyDown(keyCode, this.modifier) || charCode !== 0)) {
if (charCode === keyCode && charCode !== 13) {
// Chrome sets keyCode = charCode for printable keys
// while LO requires it to be 0
More information about the Libreoffice-commits
mailing list