diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /app/assets/javascripts/vue_shared/components/markdown | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/markdown')
5 files changed, 26 insertions, 10 deletions
diff --git a/app/assets/javascripts/vue_shared/components/markdown/field.vue b/app/assets/javascripts/vue_shared/components/markdown/field.vue index 80b7a9b7d05..9ea48050079 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/field.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/field.vue @@ -4,7 +4,7 @@ import { GlIcon } from '@gitlab/ui'; import $ from 'jquery'; import '~/behaviors/markdown/render_gfm'; import { unescape } from 'lodash'; -import { deprecatedCreateFlash as Flash } from '~/flash'; +import createFlash from '~/flash'; import GLForm from '~/gl_form'; import axios from '~/lib/utils/axios_utils'; import { stripHtml } from '~/lib/utils/text_utility'; @@ -222,7 +222,11 @@ export default { axios .post(this.markdownPreviewPath, { text: this.textareaValue }) .then((response) => this.renderMarkdown(response.data)) - .catch(() => new Flash(__('Error loading markdown preview'))); + .catch(() => + createFlash({ + message: __('Error loading markdown preview'), + }), + ); } else { this.renderMarkdown(); } @@ -245,7 +249,11 @@ export default { this.$nextTick() .then(() => $(this.$refs['markdown-preview']).renderGFM()) - .catch(() => new Flash(__('Error rendering markdown preview'))); + .catch(() => + createFlash({ + message: __('Error rendering markdown preview'), + }), + ); }, }, }; 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 83b8a6ae562..065d9b1b5dd 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 @@ -1,5 +1,6 @@ <script> import { GlButton, GlLoadingIcon, GlTooltipDirective, GlIcon } from '@gitlab/ui'; +import { isLoggedIn } from '~/lib/utils/common_utils'; import { __ } from '~/locale'; import ApplySuggestion from './apply_suggestion.vue'; @@ -73,7 +74,7 @@ export default { return __('Applying suggestions...'); }, isLoggedIn() { - return Boolean(gon.current_user_id); + return isLoggedIn(); }, }, methods: { @@ -110,7 +111,7 @@ export default { </div> <div v-if="isApplied" class="badge badge-success">{{ __('Applied') }}</div> <div v-else-if="isApplying" class="d-flex align-items-center text-secondary"> - <gl-loading-icon class="d-flex-center mr-2" /> + <gl-loading-icon size="sm" class="d-flex-center mr-2" /> <span>{{ applyingSuggestionsMessage }}</span> </div> <div v-else-if="canApply && isBatched" class="d-flex align-items-center"> diff --git a/app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_row.vue b/app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_row.vue index 9059f0d2a8b..a04f8616acb 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_row.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_row.vue @@ -1,7 +1,11 @@ <script> -/* eslint-disable vue/no-v-html */ +import { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui'; + export default { name: 'SuggestionDiffRow', + directives: { + SafeHtml, + }, props: { line: { type: Object, @@ -32,7 +36,7 @@ export default { :class="[{ 'd-table-cell': displayAsCell }, lineType]" data-testid="suggestion-diff-content" > - <span v-if="line.rich_text" class="line" v-html="line.rich_text"></span> + <span v-if="line.rich_text" v-safe-html="line.rich_text" class="line"></span> <span v-else-if="line.text" class="line">{{ line.text }}</span> <span v-else class="line"></span> </td> diff --git a/app/assets/javascripts/vue_shared/components/markdown/suggestions.vue b/app/assets/javascripts/vue_shared/components/markdown/suggestions.vue index 53d1cca7af3..63774c6c498 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/suggestions.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/suggestions.vue @@ -1,7 +1,7 @@ <script> import { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui'; import Vue from 'vue'; -import { deprecatedCreateFlash as Flash } from '~/flash'; +import createFlash from '~/flash'; import { __ } from '~/locale'; import SuggestionDiff from './suggestion_diff.vue'; @@ -79,7 +79,10 @@ export default { const suggestionElements = container.querySelectorAll('.js-render-suggestion'); if (this.lineType === 'old') { - Flash(__('Unable to apply suggestions to a deleted line.'), 'alert', this.$el); + createFlash({ + message: __('Unable to apply suggestions to a deleted line.'), + parent: this.$el, + }); } suggestionElements.forEach((suggestionEl, i) => { diff --git a/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue b/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue index 7393a8791b7..7112295fa57 100644 --- a/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue +++ b/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue @@ -82,7 +82,7 @@ export default { <span class="attaching-file-message"></span> <!-- eslint-disable-next-line @gitlab/vue-require-i18n-strings --> <span class="uploading-progress">0%</span> - <gl-loading-icon inline /> + <gl-loading-icon size="sm" inline /> </span> <span class="uploading-error-container hide"> <span class="uploading-error-icon"> |