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)
This commit is contained in:
Lev Lazinskiy
2017-01-23 22:50:39 -08:00
parent 2908b5d5d7
commit 64468909c1

View File

@@ -19,9 +19,11 @@ angular.module('app.frontend')
/** /**
* Insert 4 spaces when a tab key is pressed, * Insert 4 spaces when a tab key is pressed,
* only used when inside of the text editor. * only used when inside of the text editor.
* If the shift key is pressed first, this event is
* not fired.
*/ */
var handleTab = function (event) { var handleTab = function (event) {
if (event.which == 9) { if (!event.shiftKey && event.which == 9) {
event.preventDefault(); event.preventDefault();
var start = this.selectionStart; var start = this.selectionStart;
var end = this.selectionEnd; var end = this.selectionEnd;