From 088bba7985f654e780855121451940bb465822f2 Mon Sep 17 00:00:00 2001 From: Ezequiel Bergamaschi Date: Sun, 1 Feb 2015 23:44:34 -0300 Subject: [PATCH] bugfixing for keypress events when user wrinting in a topic --- mindplot/src/main/javascript/DesignerKeyboard.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mindplot/src/main/javascript/DesignerKeyboard.js b/mindplot/src/main/javascript/DesignerKeyboard.js index fa36b5ea..aaba0d04 100644 --- a/mindplot/src/main/javascript/DesignerKeyboard.js +++ b/mindplot/src/main/javascript/DesignerKeyboard.js @@ -255,23 +255,25 @@ mindplot.DesignerKeyboard = new Class({ } ); - $(document).on('keydown', function (event) { + $(document).on('keypress', function (event) { var keyCode = event.keyCode; - if (!jQuery.hotkeys.specialKeys[keyCode] && !jQuery.hotkeys.shiftNums[keyCode] && keyCode != 91 /*win key*/) { + var specialKey = jQuery.hotkeys.specialKeys[keyCode]; + if (["enter", "capslock"].indexOf(specialKey) == -1 && !jQuery.hotkeys.shiftNums[keyCode] && keyCode != 91 /*win key*/) { var nodes = designer.getModel().filterSelectedTopics(); if (nodes.length > 0) { // If a modifier is press, the key selected must be ignored. var pressKey = String.fromCharCode(keyCode); - if (event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) { + if (event.ctrlKey || event.altKey || event.metaKey) { return; } nodes[0].showTextEditor(pressKey); event.stopPropagation(); } } + }); },