add FullEditor component

This commit is contained in:
Philipp Kühn
2020-11-12 00:01:18 +01:00
parent ec9c561d84
commit dbefbb98fa
5 changed files with 75 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
<template>
<div>
<full-editor v-model="content" />
<div>
{{ content }}
</div>
</div>
</template>
<script>
import { FullEditor } from '@tiptap/vue'
export default {
components: {
FullEditor,
},
data() {
return {
content: '<p>full editor</p>',
}
},
}
</script>

View File

@@ -0,0 +1,3 @@
# Full Editor
<demo name="Examples/FullEditor" />

View File

@@ -15,6 +15,7 @@
"vue": "2.x"
},
"dependencies": {
"prosemirror-view": "^1.16.1"
"prosemirror-view": "^1.16.1",
"@tiptap/starter-kit": "1.x"
}
}

View File

@@ -0,0 +1,45 @@
<template>
<div>
<editor-content :editor="editor" />
</div>
</template>
<script>
import { Editor } from '@tiptap/core'
import { defaultExtensions } from '@tiptap/starter-kit'
import EditorContent from './EditorContent.ts'
export default {
components: {
EditorContent,
},
props: {
value: {
type: [String, Object],
default: '',
},
},
data() {
return {
editor: null,
}
},
mounted() {
this.editor = new Editor({
extensions: defaultExtensions(),
content: this.value,
})
this.editor.on('update', () => {
this.$emit('input', this.editor.getHTML())
})
},
beforeDestroy() {
this.editor.destroy()
},
}
</script>

View File

@@ -1,3 +1,4 @@
export * from '@tiptap/core'
export { default as VueRenderer } from './VueRenderer'
export { default as EditorContent } from './components/EditorContent'
export { default as FullEditor } from './components/FullEditor.vue'