blob: 9a51def7075a3a193274136dd4c34b241b037c5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<script>
import { GlAlert } from '@gitlab/ui';
import { EditorContent as TiptapEditorContent } from '@tiptap/vue-2';
import { ContentEditor } from '../services/content_editor';
import TopToolbar from './top_toolbar.vue';
export default {
components: {
GlAlert,
TiptapEditorContent,
TopToolbar,
},
props: {
contentEditor: {
type: ContentEditor,
required: true,
},
},
data() {
return {
error: '',
};
},
mounted() {
this.contentEditor.tiptapEditor.on('error', (error) => {
this.error = error;
});
},
};
</script>
<template>
<div>
<gl-alert v-if="error" class="gl-mb-6" variant="danger" @dismiss="error = ''">
{{ error }}
</gl-alert>
<div
data-testid="content-editor"
class="md-area"
:class="{ 'is-focused': contentEditor.tiptapEditor.isFocused }"
>
<top-toolbar ref="toolbar" class="gl-mb-4" :content-editor="contentEditor" />
<tiptap-editor-content class="md" :editor="contentEditor.tiptapEditor" />
</div>
</div>
</template>
|