From e01a0b8484b04e539b6bcc09f157088431749a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Fri, 23 Oct 2020 14:28:25 +0200 Subject: [PATCH] add isEmpty method, fix #28 --- packages/core/src/Editor.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index 9c69418e..35feebaa 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -387,6 +387,13 @@ export class Editor extends EventEmitter { return getHtmlFromFragment(this.state.doc, this.schema) } + /** + * Check if there is no content. + */ + public isEmpty() { + return !this.state.doc.textContent.length + } + /** * Destroy the editor. */