|
@@ -65,6 +65,12 @@ function showKeyboardShortcutsPanel(show) {
|
65
|
65
|
*/
|
66
|
66
|
let _shortcuts = {};
|
67
|
67
|
|
|
68
|
+/**
|
|
69
|
+ * True if the keyboard shortcuts are enabled and false if not.
|
|
70
|
+ * @type {boolean}
|
|
71
|
+ */
|
|
72
|
+let enabled = true;
|
|
73
|
+
|
68
|
74
|
/**
|
69
|
75
|
* Maps keycode to character, id of popover for given function and function.
|
70
|
76
|
*/
|
|
@@ -74,6 +80,9 @@ var KeyboardShortcut = {
|
74
|
80
|
|
75
|
81
|
var self = this;
|
76
|
82
|
window.onkeyup = function(e) {
|
|
83
|
+ if(!enabled) {
|
|
84
|
+ return;
|
|
85
|
+ }
|
77
|
86
|
var key = self._getKeyboardKey(e).toUpperCase();
|
78
|
87
|
var num = parseInt(key, 10);
|
79
|
88
|
if(!($(":focus").is("input[type=text]") ||
|
|
@@ -93,6 +102,9 @@ var KeyboardShortcut = {
|
93
|
102
|
};
|
94
|
103
|
|
95
|
104
|
window.onkeydown = function(e) {
|
|
105
|
+ if(!enabled) {
|
|
106
|
+ return;
|
|
107
|
+ }
|
96
|
108
|
if(!($(":focus").is("input[type=text]") ||
|
97
|
109
|
$(":focus").is("input[type=password]") ||
|
98
|
110
|
$(":focus").is("textarea"))) {
|
|
@@ -105,6 +117,14 @@ var KeyboardShortcut = {
|
105
|
117
|
};
|
106
|
118
|
},
|
107
|
119
|
|
|
120
|
+ /**
|
|
121
|
+ * Enables/Disables the keyboard shortcuts.
|
|
122
|
+ * @param {boolean} value - the new value.
|
|
123
|
+ */
|
|
124
|
+ enable: function (value) {
|
|
125
|
+ enabled = value;
|
|
126
|
+ },
|
|
127
|
+
|
108
|
128
|
/**
|
109
|
129
|
* Registers a new shortcut.
|
110
|
130
|
*
|