diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /app/assets/javascripts/vue_shared/components/markdown | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/markdown')
3 files changed, 19 insertions, 8 deletions
diff --git a/app/assets/javascripts/vue_shared/components/markdown/field.vue b/app/assets/javascripts/vue_shared/components/markdown/field.vue index 9ea48050079..77730ada9bb 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/field.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/field.vue @@ -1,5 +1,4 @@ <script> -/* eslint-disable vue/no-v-html */ import { GlIcon } from '@gitlab/ui'; import $ from 'jquery'; import '~/behaviors/markdown/render_gfm'; @@ -15,6 +14,10 @@ import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import MarkdownHeader from './header.vue'; import MarkdownToolbar from './toolbar.vue'; +function cleanUpLine(content) { + return unescape(stripHtml(content).replace(/\\n/g, '%br').replace(/\n/g, '')); +} + export default { components: { GfmAutocomplete, @@ -129,7 +132,7 @@ export default { return text; } - return unescape(stripHtml(richText).replace(/\n/g, '')); + return cleanUpLine(richText); }) .join('\\n'); } @@ -141,7 +144,7 @@ export default { return text; } - return unescape(stripHtml(richText).replace(/\n/g, '')); + return cleanUpLine(richText); } return ''; @@ -272,6 +275,7 @@ export default { :can-suggest="canSuggest" :show-suggest-popover="showSuggestPopover" :suggestion-start-index="suggestionsStartIndex" + data-testid="markdownHeader" @preview-markdown="showPreviewTab" @write-markdown="showWriteTab" @handleSuggestDismissed="() => $emit('handleSuggestDismissed')" @@ -319,14 +323,20 @@ export default { v-show="previewMarkdown" ref="markdown-preview" class="js-vue-md-preview md md-preview-holder" - v-html="markdownPreview" + v-html="markdownPreview /* eslint-disable-line vue/no-v-html */" ></div> </template> <template v-if="previewMarkdown && !markdownPreviewLoading"> - <div v-if="referencedCommands" class="referenced-commands" v-html="referencedCommands"></div> + <div + v-if="referencedCommands" + class="referenced-commands" + v-html="referencedCommands /* eslint-disable-line vue/no-v-html */" + ></div> <div v-if="shouldShowReferencedUsers" class="referenced-users"> <gl-icon name="warning-solid" /> - <span v-html="addMultipleToDiscussionWarning"></span> + <span + v-html="addMultipleToDiscussionWarning /* eslint-disable-line vue/no-v-html */" + ></span> </div> </template> </div> diff --git a/app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_header.vue b/app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_header.vue index 065d9b1b5dd..5fdef0b1a23 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_header.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_header.vue @@ -39,7 +39,8 @@ export default { }, defaultCommitMessage: { type: String, - required: true, + required: false, + default: null, }, inapplicableReason: { type: String, diff --git a/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue b/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue index 7112295fa57..912aa8ce294 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue @@ -75,7 +75,7 @@ export default { variant="link" :track-experiment="$options.inviteMembersInComment" :trigger-source="$options.inviteMembersInComment" - data-track-event="comment_invite_click" + data-track-action="comment_invite_click" /> <span class="uploading-progress-container hide"> <gl-icon name="media" /> |