add clearContent function

This commit is contained in:
Philipp Kühn
2018-09-10 23:13:16 +02:00
parent bad0b1debb
commit 3bdb2a0fce

View File

@@ -233,6 +233,21 @@ export default {
return this.state.doc.toJSON() return this.state.doc.toJSON()
}, },
clearContent() {
this.state = EditorState.create({
schema: this.state.schema,
doc: this.state.schema.nodeFromJSON({
type: 'doc',
content: [{
type: 'paragraph',
}],
}),
plugins: this.state.plugins,
})
this.view.updateState(this.state)
},
}, },
mounted() { mounted() {