diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-08 21:10:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-08 21:10:23 +0300 |
commit | 8a03b5424b73679d852fbf43781d9422c83869f7 (patch) | |
tree | a24a9c56fce9530492d60a640572922dd65d1072 /app/assets/javascripts/content_editor/services/content_editor.js | |
parent | 0ebbf19f2d2b87e1f2aca1c59efde1aa6a766cf6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/content_editor/services/content_editor.js')
-rw-r--r-- | app/assets/javascripts/content_editor/services/content_editor.js | 7 |
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; |