From 5bce6db29270be6681c2a4b1e0448b32504e38c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 8 Dec 2020 21:15:17 +0100 Subject: [PATCH] improve isEmpty --- packages/core/src/Editor.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index 8d464faf..7a1fe8f7 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -380,7 +380,10 @@ export class Editor extends EventEmitter { * Check if there is no content. */ 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) } /**