Welcome to mirror list, hosted at ThFree Co, Russian Federation.

shortcuts_toggle.js « shortcuts « behaviors « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 22f2478c53053c52056610af46da51ad47b337e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { Mousetrap } from '~/lib/mousetrap';
import 'mousetrap/plugins/pause/mousetrap-pause';

const shorcutsDisabledKey = 'shortcutsDisabled';

export const shouldDisableShortcuts = () => !window.gon.keyboard_shortcuts_enabled;

export function enableShortcuts() {
  localStorage.setItem(shorcutsDisabledKey, false);
  Mousetrap.unpause();
}

export function disableShortcuts() {
  localStorage.setItem(shorcutsDisabledKey, true);
  Mousetrap.pause();
}