reactjsdraftjs

Draft.js editor is empty


How to test if the content of draftjs editor is empty?

The only idea that I have now is an object comparison against the object returned from this function : EditorState.createEmpty().getCurrentContent()


Solution

  • Just use the hasText function on ContentState :

    editorState.getCurrentContent().hasText()