mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-05 04:19:07 +08:00
add setParent method to rerender node views
This commit is contained in:
parent
e1c5bd4eda
commit
fe8a21ce7c
@ -86,5 +86,8 @@
|
|||||||
"webpack-svgstore-plugin": "^4.1.0",
|
"webpack-svgstore-plugin": "^4.1.0",
|
||||||
"zlib": "^1.0.5"
|
"zlib": "^1.0.5"
|
||||||
},
|
},
|
||||||
"dependencies": {}
|
"dependencies": {},
|
||||||
|
"resolutions": {
|
||||||
|
"prosemirror-view": "git+https://git@github.com/ProseMirror/prosemirror-view.git"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,14 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'editor.element': {
|
editor: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(element) {
|
handler(editor) {
|
||||||
if (element) {
|
if (editor.element) {
|
||||||
this.$nextTick(() => this.$el.append(element.firstChild))
|
this.$nextTick(() => {
|
||||||
|
this.$el.append(editor.element.firstChild)
|
||||||
|
editor.setParent(this)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -155,6 +155,23 @@ export default class Editor {
|
|||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setParent(component = null) {
|
||||||
|
if (!component) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.view.setProps({
|
||||||
|
nodeViews: initNodeViews({
|
||||||
|
parent: component,
|
||||||
|
extensions: [
|
||||||
|
...builtInNodes,
|
||||||
|
...this.options.extensions,
|
||||||
|
],
|
||||||
|
editable: this.options.editable,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
dispatchTransaction(transaction) {
|
dispatchTransaction(transaction) {
|
||||||
this.state = this.state.apply(transaction)
|
this.state = this.state.apply(transaction)
|
||||||
this.view.updateState(this.state)
|
this.view.updateState(this.state)
|
||||||
|
Loading…
Reference in New Issue
Block a user