diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-29 15:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-29 15:10:13 +0300 |
commit | 4ef4c552f3b1a5c25ec716f0f2c4e3c92a078e2b (patch) | |
tree | f2b8ca0c0d2e342ada86aed7f00a1647c838c45a /app/assets/javascripts/vue_shared | |
parent | 7510fe06eba02c3cee247f8ceb4ee6f6a4de54f6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vue_shared')
4 files changed, 33 insertions, 3 deletions
diff --git a/app/assets/javascripts/vue_shared/components/markdown/field.vue b/app/assets/javascripts/vue_shared/components/markdown/field.vue index 722df3cc58b..765bd146a03 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/field.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/field.vue @@ -111,6 +111,16 @@ export default { required: false, default: false, }, + showCommentToolBar: { + type: Boolean, + required: false, + default: true, + }, + restrictedToolBarItems: { + type: Array, + required: false, + default: () => [], + }, }, data() { return { @@ -331,7 +341,7 @@ export default { :enable-preview="enablePreview" :show-suggest-popover="showSuggestPopover" :suggestion-start-index="suggestionsStartIndex" - data-testid="markdownHeader" + :restricted-tool-bar-items="restrictedToolBarItems" @preview-markdown="showPreviewTab" @write-markdown="showWriteTab" @handleSuggestDismissed="() => $emit('handleSuggestDismissed')" @@ -350,6 +360,7 @@ export default { :markdown-docs-path="markdownDocsPath" :quick-actions-docs-path="quickActionsDocsPath" :can-attach-file="canAttachFile" + :show-comment-tool-bar="showCommentToolBar" /> </div> </div> diff --git a/app/assets/javascripts/vue_shared/components/markdown/header.vue b/app/assets/javascripts/vue_shared/components/markdown/header.vue index d0bd5046bf0..7993910ec12 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/header.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/header.vue @@ -54,6 +54,11 @@ export default { required: false, default: true, }, + restrictedToolBarItems: { + type: Array, + required: false, + default: () => [], + }, }, data() { return { @@ -207,6 +212,7 @@ export default { icon="italic" /> <toolbar-button + v-if="!restrictedToolBarItems.includes('strikethrough')" tag="~~" :button-title=" sprintf(s__('MarkdownEditor|Add strikethrough text (%{modifierKey}⇧X)'), { @@ -217,6 +223,7 @@ export default { icon="strikethrough" /> <toolbar-button + v-if="!restrictedToolBarItems.includes('quote')" :prepend="true" :tag="tag" :button-title="__('Insert a quote')" @@ -272,24 +279,28 @@ export default { icon="link" /> <toolbar-button + v-if="!restrictedToolBarItems.includes('bullet-list')" :prepend="true" tag="- " :button-title="__('Add a bullet list')" icon="list-bulleted" /> <toolbar-button + v-if="!restrictedToolBarItems.includes('numbered-list')" :prepend="true" tag="1. " :button-title="__('Add a numbered list')" icon="list-numbered" /> <toolbar-button + v-if="!restrictedToolBarItems.includes('task-list')" :prepend="true" tag="- [ ] " :button-title="__('Add a task list')" icon="list-task" /> <toolbar-button + v-if="!restrictedToolBarItems.includes('collapsible-section')" :tag="mdCollapsibleSection" :prepend="true" tag-select="Click to expand" @@ -297,12 +308,14 @@ export default { icon="details-block" /> <toolbar-button + v-if="!restrictedToolBarItems.includes('table')" :tag="mdTable" :prepend="true" :button-title="__('Add a table')" icon="table" /> <toolbar-button + v-if="!restrictedToolBarItems.includes('full-screen')" class="js-zen-enter" :prepend="true" :button-title="__('Go full screen')" diff --git a/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue b/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue index f1c293c87f4..1d83a61f2ae 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue @@ -24,6 +24,11 @@ export default { required: false, default: true, }, + showCommentToolBar: { + type: Boolean, + required: false, + default: true, + }, }, computed: { hasQuickActionsDocsPath() { @@ -34,7 +39,7 @@ export default { </script> <template> - <div class="comment-toolbar clearfix"> + <div v-if="showCommentToolBar" class="comment-toolbar clearfix"> <div class="toolbar-text"> <template v-if="!hasQuickActionsDocsPath && markdownDocsPath"> <gl-link :href="markdownDocsPath" target="_blank"> diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer.vue b/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer.vue index edf2229a9a1..ed87a202b15 100644 --- a/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer.vue +++ b/app/assets/javascripts/vue_shared/components/source_viewer/source_viewer.vue @@ -2,6 +2,7 @@ import { GlSafeHtmlDirective, GlLoadingIcon } from '@gitlab/ui'; import LineHighlighter from '~/blob/line_highlighter'; import eventHub from '~/notes/event_hub'; +import languageLoader from '~/content_editor/services/highlight_js_language_loader'; import { ROUGE_TO_HLJS_LANGUAGE_MAP, LINES_PER_CHUNK } from './constants'; import Chunk from './components/chunk.vue'; @@ -129,7 +130,7 @@ export default { let languageDefinition; try { - languageDefinition = await import(`highlight.js/lib/languages/${this.language}`); + languageDefinition = await languageLoader[this.language](); this.hljs.registerLanguage(this.language, languageDefinition.default); } catch (message) { this.$emit('error', message); |