From efbf661c4224d481c57d0346e26983a805e5ec93 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 24 Apr 2023 15:15:38 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../javascripts/behaviors/shortcuts/keybindings.js | 4 +- .../javascripts/behaviors/shortcuts/shortcuts.js | 105 +++++++++++---------- .../behaviors/shortcuts/shortcuts_blob.js | 8 +- .../behaviors/shortcuts/shortcuts_find_file.js | 20 ++-- .../behaviors/shortcuts/shortcuts_issuable.js | 22 ++--- .../behaviors/shortcuts/shortcuts_navigation.js | 56 ++++------- .../behaviors/shortcuts/shortcuts_network.js | 16 ++-- .../behaviors/shortcuts/shortcuts_toggle.js | 2 +- .../behaviors/shortcuts/shortcuts_wiki.js | 6 +- 9 files changed, 108 insertions(+), 131 deletions(-) (limited to 'app/assets/javascripts/behaviors') diff --git a/app/assets/javascripts/behaviors/shortcuts/keybindings.js b/app/assets/javascripts/behaviors/shortcuts/keybindings.js index d173703f172..cc8a9baf69e 100644 --- a/app/assets/javascripts/behaviors/shortcuts/keybindings.js +++ b/app/assets/javascripts/behaviors/shortcuts/keybindings.js @@ -698,8 +698,8 @@ export const keybindingGroups = [ /** * Gets keyboard shortcuts associated with a command * - * @param {string} command The command object. All command - * objects are available as imports from this file. + * @param {Object} command The command object. All command objects are + * available as imports from this file. * * @returns {string[]} An array of keyboard shortcut strings bound to the command * diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts.js index 301dd1c5669..5c6e4665a5c 100644 --- a/app/assets/javascripts/behaviors/shortcuts/shortcuts.js +++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts.js @@ -1,7 +1,7 @@ import $ from 'jquery'; import { flatten } from 'lodash'; -import Mousetrap from 'mousetrap'; import Vue from 'vue'; +import { Mousetrap, addStopCallback } from '~/lib/mousetrap'; import { getCookie, setCookie, parseBoolean } from '~/lib/utils/common_utils'; import findAndFollowLink from '~/lib/utils/navigation_utility'; @@ -28,20 +28,11 @@ import { } from './keybindings'; import { disableShortcuts, shouldDisableShortcuts } from './shortcuts_toggle'; -const defaultStopCallback = Mousetrap.prototype.stopCallback; -Mousetrap.prototype.stopCallback = function customStopCallback(e, element, combo) { - if (keysFor(TOGGLE_MARKDOWN_PREVIEW).indexOf(combo) !== -1) { - return false; - } - - return defaultStopCallback.call(this, e, element, combo); -}; - /** * The key used to save and fetch the local Mousetrap instance * attached to a `