summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/content_editor/services/content_editor.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/content_editor/services/content_editor.js')
-rw-r--r--app/assets/javascripts/content_editor/services/content_editor.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/assets/javascripts/content_editor/services/content_editor.js b/app/assets/javascripts/content_editor/services/content_editor.js
index e2188f5aa69..29553f4c2ca 100644
--- a/app/assets/javascripts/content_editor/services/content_editor.js
+++ b/app/assets/javascripts/content_editor/services/content_editor.js
@@ -9,6 +9,13 @@ export class ContentEditor {
return this._tiptapEditor;
}
+ get empty() {
+ const doc = this.tiptapEditor?.state.doc;
+
+ // Makes sure the document has more than one empty paragraph
+ return doc.childCount === 0 || (doc.childCount === 1 && doc.child(0).childCount === 0);
+ }
+
async setSerializedContent(serializedContent) {
const { _tiptapEditor: editor, _serializer: serializer } = this;