From 6f5f89bc6bea456cf8af9d034780b5b259ca74a5 Mon Sep 17 00:00:00 2001 From: Prateek Saxena Date: Tue, 14 Oct 2014 18:36:26 +0530 Subject: [PATCH] Use 'evt.shiftKey' instead of matching 'charCodes' The shortcut wasn't running consistently and was blocking 'Cmd+L' on Chrome 38. Instead of going to the location bar it would tooggle the list. Strangely, it did not override 'Cmd+N'. Using `evt.shiftKey` instead of matching the `charCode` to the uppercase letter solves the problem. --- src/static/js/ace2_inner.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 5244cbcae..fb6dd0804 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -3749,7 +3749,7 @@ function Ace2Inner(){ toggleAttributeOnSelection('strikethrough'); specialHandled = true; } - if ((!specialHandled) && isTypeForCmdKey && String.fromCharCode(which) == "L" && (evt.metaKey || evt.ctrlKey)) + if ((!specialHandled) && isTypeForCmdKey && String.fromCharCode(which).toLowerCase() == "l" && (evt.metaKey || evt.ctrlKey) && evt.shiftKey) { // cmd-shift-L (unorderedlist) fastIncorp(9); @@ -3757,7 +3757,7 @@ function Ace2Inner(){ doInsertUnorderedList() specialHandled = true; } - if ((!specialHandled) && isTypeForCmdKey && String.fromCharCode(which) == "N" && (evt.metaKey || evt.ctrlKey)) + if ((!specialHandled) && isTypeForCmdKey && String.fromCharCode(which).toLowerCase() == "n" && (evt.metaKey || evt.ctrlKey) && evt.shiftKey) { // cmd-shift-N (orderedlist) fastIncorp(9);