improve isEmpty

This commit is contained in:
Philipp Kühn
2020-12-08 21:15:17 +01:00
parent d6e1838f99
commit 5bce6db292

View File

@@ -380,7 +380,10 @@ export class Editor extends EventEmitter {
* Check if there is no content. * Check if there is no content.
*/ */
public isEmpty() { public isEmpty() {
return !this.state.doc.textContent.length const defaultContent = this.state.doc.type.createAndFill()?.toJSON()
const content = this.getJSON()
return JSON.stringify(defaultContent) === JSON.stringify(content)
} }
/** /**