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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-21 00:09:48 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-21 00:09:48 +0300
commit7fbb996fde20a9905177e253491f858870cd5882 (patch)
tree159c692eb50b7eb273fd4013217ceb5fab3296a4 /app/assets/javascripts
parent4faa270685797bd689d2035efe7c7e724950eb82 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/behaviors/shortcuts/keybindings.js10
-rw-r--r--app/assets/javascripts/repository/components/blob_content_viewer.vue2
-rw-r--r--app/assets/javascripts/super_sidebar/components/super_sidebar.vue13
3 files changed, 23 insertions, 2 deletions
diff --git a/app/assets/javascripts/behaviors/shortcuts/keybindings.js b/app/assets/javascripts/behaviors/shortcuts/keybindings.js
index 38ee02938cc..d173703f172 100644
--- a/app/assets/javascripts/behaviors/shortcuts/keybindings.js
+++ b/app/assets/javascripts/behaviors/shortcuts/keybindings.js
@@ -117,6 +117,12 @@ export const HIDE_APPEARING_CONTENT = {
defaultKeys: ['esc'],
};
+export const TOGGLE_SUPER_SIDEBAR = {
+ id: 'globalShortcuts.toggleSuperSidebar',
+ description: __('Toggle the navigation sidebar'),
+ defaultKeys: ['mod+\\'], // eslint-disable-line @gitlab/require-i18n-strings
+};
+
export const TOGGLE_CANARY = {
id: 'globalShortcuts.toggleCanary',
description: __('Toggle GitLab Next'),
@@ -536,6 +542,10 @@ export const GLOBAL_SHORTCUTS_GROUP = {
],
};
+if (gon.use_new_navigation) {
+ GLOBAL_SHORTCUTS_GROUP.keybindings.push(TOGGLE_SUPER_SIDEBAR);
+}
+
export const EDITING_SHORTCUTS_GROUP = {
id: 'editing',
name: __('Editing'),
diff --git a/app/assets/javascripts/repository/components/blob_content_viewer.vue b/app/assets/javascripts/repository/components/blob_content_viewer.vue
index 334e7964bc2..2eeff48dcf9 100644
--- a/app/assets/javascripts/repository/components/blob_content_viewer.vue
+++ b/app/assets/javascripts/repository/components/blob_content_viewer.vue
@@ -145,7 +145,7 @@ export default {
},
computed: {
shouldRenderGenie() {
- return this.explainCodeAvailable;
+ return this.explainCodeAvailable && this.viewer?.fileType === TEXT_FILE_TYPE;
},
isLoggedIn() {
return isLoggedIn();
diff --git a/app/assets/javascripts/super_sidebar/components/super_sidebar.vue b/app/assets/javascripts/super_sidebar/components/super_sidebar.vue
index 64460fdcb68..2cd37875f57 100644
--- a/app/assets/javascripts/super_sidebar/components/super_sidebar.vue
+++ b/app/assets/javascripts/super_sidebar/components/super_sidebar.vue
@@ -1,5 +1,7 @@
<script>
import { GlButton, GlCollapse } from '@gitlab/ui';
+import Mousetrap from 'mousetrap';
+import { keysFor, TOGGLE_SUPER_SIDEBAR } from '~/behaviors/shortcuts/keybindings';
import { __ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import {
@@ -7,7 +9,7 @@ import {
SUPER_SIDEBAR_PEEK_OPEN_DELAY,
SUPER_SIDEBAR_PEEK_CLOSE_DELAY,
} from '../constants';
-import { toggleSuperSidebarCollapsed } from '../super_sidebar_collapsed_state_manager';
+import { isCollapsed, toggleSuperSidebarCollapsed } from '../super_sidebar_collapsed_state_manager';
import UserBar from './user_bar.vue';
import SidebarPortalTarget from './sidebar_portal_target.vue';
import ContextSwitcherToggle from './context_switcher_toggle.vue';
@@ -44,7 +46,16 @@ export default {
return this.sidebarData.current_menu_items || [];
},
},
+ mounted() {
+ Mousetrap.bind(keysFor(TOGGLE_SUPER_SIDEBAR), this.toggleSidebar);
+ },
+ beforeDestroy() {
+ Mousetrap.unbind(keysFor(TOGGLE_SUPER_SIDEBAR));
+ },
methods: {
+ toggleSidebar() {
+ toggleSuperSidebarCollapsed(!isCollapsed(), true);
+ },
collapseSidebar() {
toggleSuperSidebarCollapsed(true, false);
},