* chore: add precommit hook for eslint fixes, fix linting issues * chore: add eslint import sort plugin
45 lines
984 B
Vue
45 lines
984 B
Vue
<template>
|
||
<div v-if="editor">
|
||
<editor-content :editor="editor" />
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import Document from '@tiptap/extension-document'
|
||
import Paragraph from '@tiptap/extension-paragraph'
|
||
import Text from '@tiptap/extension-text'
|
||
import TextStyle from '@tiptap/extension-text-style'
|
||
import { Editor, EditorContent } from '@tiptap/vue-3'
|
||
|
||
export default {
|
||
components: {
|
||
EditorContent,
|
||
},
|
||
|
||
data() {
|
||
return {
|
||
editor: null,
|
||
}
|
||
},
|
||
|
||
mounted() {
|
||
this.editor = new Editor({
|
||
extensions: [
|
||
Document,
|
||
Paragraph,
|
||
Text,
|
||
TextStyle,
|
||
],
|
||
content: `
|
||
<p><span>This has a <span> tag without a style attribute, so it’s thrown away.</span></p>
|
||
<p><span style="">But this one is wrapped in a <span> tag with an inline style attribute, so it’s kept - even if it’s empty for now.</span></p>
|
||
`,
|
||
})
|
||
},
|
||
|
||
beforeUnmount() {
|
||
this.editor.destroy()
|
||
},
|
||
}
|
||
</script>
|