[question] Check if editor is empty #748
Replies: 2 comments
-
This is probably not the best solution but it is fast to implement. But you could simply check the length of the initial editor html string like const content = this.editor.getHTML()
const empty_content = '<p></p>'
if(content.length == empty_content.length) {
// editor is empty
} Or you could compare the content. This is the way I have implemented a quick way to check whether an editor is empty or not. Also looking at the placeholder plugin there is this |
Beta Was this translation helpful? Give feedback.
-
This would be useful. When you try to implement the The issue arises with how the Floating Menu detects a new line and it alwalys looks for Why should the Floating Menu only work once there are inputs? Most people who start a new document want the new-line floating menu to drop in a Header or something. |
Beta Was this translation helpful? Give feedback.
-
Is it possible to check if the editor does not contain any user input? From what I see, there is always a root node with a paragraph element so it does not look like it is every truly "empty", but I'd like to check if there is no user input so I can disable/enable a button accordingly.
Beta Was this translation helpful? Give feedback.
All reactions