Commit 6567acf7 authored by Simon Knox's avatar Simon Knox 🕴

Add disable/enable toggles to shortcuts JS

parent 88eca943
Pipeline #89656719 failed with stages
in 79 minutes and 18 seconds
import $ from 'jquery';
import Cookies from 'js-cookie';
import Mousetrap from 'mousetrap';
import 'mousetrap/plugins/pause/mousetrap-pause';
import axios from '../../lib/utils/axios_utils';
import { refreshCurrentPage, visitUrl } from '../../lib/utils/url_utility';
import findAndFollowLink from '../../lib/utils/navigation_utility';
......@@ -48,6 +49,20 @@ export default class Shortcuts {
$(this).remove();
e.preventDefault();
});
if (localStorage.getItem('shortcutsDisabled') === 'true') {
Shortcuts.disable()
}
}
static enable() {
localStorage.setItem('shortcutsDisabled', false);
Mousetrap.unpause();
}
static disable() {
localStorage.setItem('shortcutsDisabled', true);
Mousetrap.pause();
}
onToggleHelp(e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment