diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-15 00:10:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-15 00:10:22 +0300 |
commit | 5b829393a732143e31e2f9a62b6ca2cfb7ebb147 (patch) | |
tree | 85260ce9fd49ea62df0cea5b750f8c0db1b5a082 /app/assets/javascripts | |
parent | f69bc1dab50e86440bb4ffdc507ca5efd94bf459 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts')
3 files changed, 25 insertions, 4 deletions
diff --git a/app/assets/javascripts/behaviors/shortcuts/keybindings.js b/app/assets/javascripts/behaviors/shortcuts/keybindings.js index c63dba05f10..005ef103ded 100644 --- a/app/assets/javascripts/behaviors/shortcuts/keybindings.js +++ b/app/assets/javascripts/behaviors/shortcuts/keybindings.js @@ -105,6 +105,12 @@ export const TOGGLE_PERFORMANCE_BAR = { defaultKeys: ['p b'], // eslint-disable-line @gitlab/require-i18n-strings }; +export const HIDE_APPEARING_CONTENT = { + id: 'globalShortcuts.hideAppearingContent', + description: __('Hide tooltips or popovers'), + defaultKeys: ['esc'], +}; + export const TOGGLE_CANARY = { id: 'globalShortcuts.toggleCanary', description: __('Toggle GitLab Next'), @@ -492,6 +498,7 @@ export const GLOBAL_SHORTCUTS_GROUP = { GO_TO_YOUR_MERGE_REQUESTS, GO_TO_YOUR_TODO_LIST, TOGGLE_PERFORMANCE_BAR, + HIDE_APPEARING_CONTENT, ], }; diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts.js index 03cba78cf31..ac2a4184176 100644 --- a/app/assets/javascripts/behaviors/shortcuts/shortcuts.js +++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts.js @@ -12,6 +12,7 @@ import { START_SEARCH, FOCUS_FILTER_BAR, TOGGLE_PERFORMANCE_BAR, + HIDE_APPEARING_CONTENT, TOGGLE_CANARY, TOGGLE_MARKDOWN_PREVIEW, GO_TO_YOUR_TODO_LIST, @@ -78,6 +79,7 @@ export default class Shortcuts { Mousetrap.bind(keysFor(START_SEARCH), Shortcuts.focusSearch); Mousetrap.bind(keysFor(FOCUS_FILTER_BAR), this.focusFilter.bind(this)); Mousetrap.bind(keysFor(TOGGLE_PERFORMANCE_BAR), Shortcuts.onTogglePerfBar); + Mousetrap.bind(keysFor(HIDE_APPEARING_CONTENT), Shortcuts.hideAppearingContent); Mousetrap.bind(keysFor(TOGGLE_CANARY), Shortcuts.onToggleCanary); const findFileURL = document.body.dataset.findFile; @@ -202,6 +204,18 @@ export default class Shortcuts { } } + static hideAppearingContent(e) { + const elements = document.querySelectorAll('.tooltip, .popover'); + + elements.forEach((element) => { + element.style.display = 'none'; + }); + + if (e.preventDefault) { + e.preventDefault(); + } + } + /** * Initializes markdown editor shortcuts on the provided `<textarea>` element * diff --git a/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue b/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue index d900cfcdf2b..c16c29f3222 100644 --- a/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue +++ b/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue @@ -152,6 +152,9 @@ export default { update(data) { return data.project?.ciTemplate?.content || ''; }, + result({ data }) { + this.updateCiConfig(data.project?.ciTemplate?.content || ''); + }, error() { this.reportFailure(LOAD_FAILURE_UNKNOWN); }, @@ -170,9 +173,6 @@ export default { isEmpty() { return this.currentCiFileContent === ''; }, - templateOrCurrentContent() { - return this.isNewCiConfigFile ? this.starterTemplate : this.currentCiFileContent; - }, }, i18n: { tabEdit: s__('Pipelines|Edit'), @@ -280,7 +280,7 @@ export default { /> <pipeline-editor-home :ci-config-data="ciConfigData" - :ci-file-content="templateOrCurrentContent" + :ci-file-content="currentCiFileContent" :is-new-ci-config-file="isNewCiConfigFile" @commit="updateOnCommit" @resetContent="resetContent" |