[Libreoffice-commits] online.git: Branch 'libreoffice-5-3' - loleaflet/src
Pranav Kant
pranavk at collabora.co.uk
Thu Mar 23 12:35:52 UTC 2017
loleaflet/src/map/handler/Map.Keyboard.js | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
New commits:
commit a949561d1689725c961e015859c71d48e2bbc1d9
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
Reviewed-on: https://gerrit.libreoffice.org/35482
Reviewed-by: pranavk <pranavk at collabora.co.uk>
Tested-by: pranavk <pranavk at collabora.co.uk>
diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js
index 6b3edde7..8aff7550 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