aboutsummaryrefslogtreecommitdiff
path: root/client/js/util
diff options
context:
space:
mode:
authorHunternif2019-04-16 09:00:19 +0700
committerHunternif2019-04-16 09:00:19 +0700
commita37ce857f7a489ce2105e476999773946c744d25 (patch)
treeaafdeddb6214419bd7865ffe245f601830c8b96d /client/js/util
parent14b85fc3064feb7c5e5996c2025c785b3a7a1551 (diff)
Ctrl+s works even when focusing tag input
Diffstat (limited to 'client/js/util')
-rw-r--r--client/js/util/keyboard.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/client/js/util/keyboard.js b/client/js/util/keyboard.js
index c3b9543..3e3158a 100644
--- a/client/js/util/keyboard.js
+++ b/client/js/util/keyboard.js
@@ -20,6 +20,13 @@ function bind(hotkey, func) {
}
return false;
}
+function bindElement(element, hotkey, func) {
+ if (settings.get().keyboardShortcuts) {
+ mousetrap(element).bind(hotkey, func);
+ return true;
+ }
+ return false;
+}
function unbind(hotkey) {
mousetrap.unbind(hotkey);
@@ -27,6 +34,7 @@ function unbind(hotkey) {
module.exports = {
bind: bind,
+ bindElement: bindElement,
unbind: unbind,
pause: () => { paused = true; },
unpause: () => { paused = false; },

© 2015 - 2026 Jakob L. Kreuze