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-02-28 12:08:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-28 12:08:25 +0300
commit5eab6dcdd923ca375b86d6993f20a3e37dbd7a51 (patch)
treecefd095312ba2dbaad845b699f42ed73df728e46 /app/assets/javascripts/vue_shared/components/markdown
parentd3eb1e90a58fc97c9c1548e8ac9631c233e723ea (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/markdown')
-rw-r--r--app/assets/javascripts/vue_shared/components/markdown/markdown_editor.vue53
1 files changed, 14 insertions, 39 deletions
diff --git a/app/assets/javascripts/vue_shared/components/markdown/markdown_editor.vue b/app/assets/javascripts/vue_shared/components/markdown/markdown_editor.vue
index 2a82986e90b..a350198d692 100644
--- a/app/assets/javascripts/vue_shared/components/markdown/markdown_editor.vue
+++ b/app/assets/javascripts/vue_shared/components/markdown/markdown_editor.vue
@@ -22,15 +22,6 @@ export default {
type: String,
required: true,
},
- markdownDocsPath: {
- type: String,
- required: true,
- },
- quickActionsDocsPath: {
- type: String,
- required: false,
- default: '',
- },
uploadsPath: {
type: String,
required: false,
@@ -41,21 +32,6 @@ export default {
required: false,
default: true,
},
- enablePreview: {
- type: Boolean,
- required: false,
- default: true,
- },
- autocompleteDataSources: {
- type: Object,
- required: false,
- default: () => ({}),
- },
- enableAutocomplete: {
- type: Boolean,
- required: false,
- default: true,
- },
formFieldProps: {
type: Object,
required: true,
@@ -76,14 +52,10 @@ export default {
required: false,
default: false,
},
- drawioEnabled: {
- type: Boolean,
- required: false,
- default: false,
- },
},
data() {
return {
+ markdown: this.value || '',
editingMode: EDITING_MODE_MARKDOWN_FIELD,
autofocused: false,
};
@@ -97,14 +69,21 @@ export default {
return this.autofocus && !this.autofocused ? 'end' : false;
},
},
+ watch: {
+ value(val) {
+ this.markdown = val;
+ },
+ },
mounted() {
this.autofocusTextarea();
},
methods: {
updateMarkdownFromContentEditor({ markdown }) {
+ this.markdown = markdown;
this.$emit('input', markdown);
},
updateMarkdownFromMarkdownField({ target }) {
+ this.markdown = target.value;
this.$emit('input', target.value);
},
renderMarkdown(markdown) {
@@ -143,16 +122,12 @@ export default {
/>
<markdown-field
v-if="!isContentEditorActive"
+ v-bind="$attrs"
+ data-testid="markdown-field"
:markdown-preview-path="renderMarkdownPath"
can-attach-file
- :enable-autocomplete="enableAutocomplete"
- :textarea-value="value"
- :markdown-docs-path="markdownDocsPath"
- :quick-actions-docs-path="quickActionsDocsPath"
- :autocomplete-data-sources="autocompleteDataSources"
+ :textarea-value="markdown"
:uploads-path="uploadsPath"
- :enable-preview="enablePreview"
- :drawio-enabled="drawioEnabled"
show-content-editor-switcher
class="bordered-box"
@enableContentEditor="onEditingModeChange('contentEditor')"
@@ -161,7 +136,7 @@ export default {
<textarea
v-bind="formFieldProps"
ref="textarea"
- :value="value"
+ :value="markdown"
class="note-textarea js-gfm-input js-autosize markdown-area"
dir="auto"
:data-supports-quick-actions="supportsQuickActions"
@@ -176,7 +151,7 @@ export default {
<content-editor
:render-markdown="renderMarkdown"
:uploads-path="uploadsPath"
- :markdown="value"
+ :markdown="markdown"
:autofocus="contentEditorAutofocused"
:use-bottom-toolbar="useBottomToolbar"
@initialized="setEditorAsAutofocused"
@@ -186,7 +161,7 @@ export default {
/>
<input
v-bind="formFieldProps"
- :value="value"
+ :value="markdown"
data-qa-selector="markdown_editor_form_field"
type="hidden"
/>