add try command

This commit is contained in:
Philipp Kühn
2020-11-04 15:31:42 +01:00
parent 0ba95a7ae3
commit 7a16546d6f
4 changed files with 57 additions and 28 deletions

View File

@@ -261,15 +261,20 @@ export class Editor extends EventEmitter {
*/
private createView() {
this.view = new EditorView(this.options.element, {
dispatchTransaction: this.dispatchTransaction.bind(this),
state: EditorState.create({
doc: this.createDocument(this.options.content),
plugins: this.extensionManager.plugins,
}),
dispatchTransaction: this.dispatchTransaction.bind(this),
})
// `editor.view` is not yet available at this time.
// Therefore we will add all node views directly afterwards.
// Therefore we will add all plugins and node views directly afterwards.
const newState = this.state.reconfigure({
plugins: this.extensionManager.plugins,
})
this.view.updateState(newState)
this.view.setProps({
nodeViews: this.extensionManager.nodeViews,
})