tiptap/packages/vue-2/src/EditorContent.ts
2021-02-28 23:24:26 +01:00

37 lines
626 B
TypeScript

import Vue from 'vue'
export const EditorContent = Vue.extend({
name: 'EditorContent',
props: {
editor: {
default: null,
type: Object,
},
},
watch: {
editor: {
immediate: true,
handler(editor) {
if (editor && editor.options.element) {
this.$nextTick(() => {
this.$el.appendChild(editor.options.element.firstChild)
editor.createNodeViews()
})
}
},
},
},
render(createElement) {
return createElement('div')
},
beforeDestroy() {
this.editor.setOptions({
element: this.$el,
})
},
})