add init event

This commit is contained in:
Philipp Kühn
2018-11-12 22:58:39 +01:00
parent 1f9c9324f9
commit 8c060d71a5

View File

@@ -28,6 +28,7 @@ export default class Editor {
editable: true, editable: true,
extensions: [], extensions: [],
content: '', content: '',
onInit: () => {},
onUpdate: () => {}, onUpdate: () => {},
} }
@@ -51,7 +52,10 @@ export default class Editor {
this.view = this.createView() this.view = this.createView()
this.commands = this.createCommands() this.commands = this.createCommands()
this.getActiveNodesAndMarks() this.getActiveNodesAndMarks()
this.emit('init') this.options.onInit({
view: this.view,
state: this.state,
})
} }
createExtensions() { createExtensions() {