don’t use __vue__

This commit is contained in:
Philipp Kühn
2021-03-05 11:01:26 +01:00
parent a073d75dff
commit e9e3418a0f
6 changed files with 63 additions and 33 deletions

View File

@@ -37,7 +37,7 @@ export const EditorContent = defineComponent({
return
}
const el = unref(rootEl.value)
const element = unref(rootEl.value)
rootEl.value.appendChild(editor.options.element.firstChild)
@@ -45,7 +45,7 @@ export const EditorContent = defineComponent({
editor.contentComponent = instance.ctx._
editor.setOptions({
element: el,
element,
})
editor.createNodeViews()
@@ -69,12 +69,12 @@ export const EditorContent = defineComponent({
return
}
const newEl = document.createElement('div')
const newElement = document.createElement('div')
newEl.appendChild(editor.options.element.firstChild)
newElement.appendChild(editor.options.element.firstChild)
editor.setOptions({
element: newEl,
element: newElement,
})
})

View File

@@ -255,6 +255,9 @@ class VueNodeView implements NodeView {
export function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer {
return (props: NodeViewRendererProps) => {
// try to get the parent component
// this is important for vue devtools to show the component hierarchy correctly
// maybe its `undefined` because <editor-content> isnt rendered yet
if (!props.editor.contentComponent) {
return {}
}