mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 14:13:21 +08:00
refactoring
This commit is contained in:
parent
21d9bf6c51
commit
328d5a459d
@ -17,7 +17,7 @@ export const NodeViewWrapper = defineComponent({
|
||||
whiteSpace: 'normal',
|
||||
},
|
||||
'data-node-view-wrapper': '',
|
||||
// @ts-ignore
|
||||
// @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)
|
||||
onDragStart: this.onDragStart,
|
||||
},
|
||||
this.$slots.default?.(),
|
||||
|
@ -1,8 +1,4 @@
|
||||
import {
|
||||
Node,
|
||||
NodeViewRenderer,
|
||||
NodeViewRendererProps,
|
||||
} from '@tiptap/core'
|
||||
import { Node, NodeViewRenderer, NodeViewRendererProps } from '@tiptap/core'
|
||||
import {
|
||||
ref,
|
||||
provide,
|
||||
@ -103,6 +99,10 @@ class VueNodeView implements NodeView {
|
||||
}
|
||||
|
||||
get dom() {
|
||||
if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {
|
||||
throw Error('Please use the NodeViewWrapper component for your node view.')
|
||||
}
|
||||
|
||||
return this.renderer.element
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,11 @@ export class VueRenderer {
|
||||
|
||||
if (this.editor.contentComponent) {
|
||||
this.editor.contentComponent.update()
|
||||
|
||||
if (this.teleportElement.children.length !== 1) {
|
||||
throw Error('VueRenderer doesn’t support multiple child elements.')
|
||||
}
|
||||
|
||||
this.element = this.teleportElement.firstElementChild as Element
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user