From 64468909c1edcf15518eb772cc0484096c1eb530 Mon Sep 17 00:00:00 2001 From: Lev Lazinskiy Date: Mon, 23 Jan 2017 22:50:39 -0800 Subject: [PATCH] Handle Shift Key If Shift + Tab is pressed, this event is not fired and instead the cursor moves to the previous field (i.e default browser behavior) --- app/assets/javascripts/app/frontend/controllers/editor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/frontend/controllers/editor.js b/app/assets/javascripts/app/frontend/controllers/editor.js index 6c506be8d..a7686d0d2 100644 --- a/app/assets/javascripts/app/frontend/controllers/editor.js +++ b/app/assets/javascripts/app/frontend/controllers/editor.js @@ -19,9 +19,11 @@ angular.module('app.frontend') /** * Insert 4 spaces when a tab key is pressed, * only used when inside of the text editor. + * If the shift key is pressed first, this event is + * not fired. */ var handleTab = function (event) { - if (event.which == 9) { + if (!event.shiftKey && event.which == 9) { event.preventDefault(); var start = this.selectionStart; var end = this.selectionEnd;