mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-17 12:37:49 +08:00
44 lines
849 B
Vue
44 lines
849 B
Vue
<template>
|
|
<div v-if="editor">
|
|
<editor-content :editor="editor" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { Editor } from '@tiptap/core'
|
|
import { EditorContent } from '@tiptap/vue'
|
|
import Document from '@tiptap/extension-document'
|
|
import Paragraph from '@tiptap/extension-paragraph'
|
|
import Text from '@tiptap/extension-text'
|
|
|
|
export default {
|
|
components: {
|
|
EditorContent,
|
|
},
|
|
|
|
data() {
|
|
return {
|
|
editor: null,
|
|
}
|
|
},
|
|
|
|
mounted() {
|
|
this.editor = new Editor({
|
|
extensions: [
|
|
new Document(),
|
|
new Paragraph(),
|
|
new Text(),
|
|
],
|
|
content: `
|
|
<p>The Document extension is required. Though, you can write your own implementation, e. g. to give it custom name.</p>
|
|
`,
|
|
})
|
|
|
|
window.editor = this.editor
|
|
},
|
|
|
|
beforeDestroy() {
|
|
this.editor.destroy()
|
|
}
|
|
}
|
|
</script> |