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()
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()
 
    
    Just use the hasText function on ContentState : 
editorState.getCurrentContent().hasText()
 
    
     contentState.hasText() && contentState.getPlainText().length > 0 
 
    
    export const isEmptyDraftJs = (rawState) => {
  if (!rawState || _.isEmpty(rawState)) { // filter undefined and {}
    return true;
  }
  const contentState = convertFromRaw(rawState);
  return !(contentState.hasText() && (contentState.getPlainText() !== ''));
};
I am not sure it is perfect but I use above code.
When you add just image, there is an space character so getPlainText() can filter only image draftJS.
 
    
    const text=editorState.getCurrentState().getPlainText()
return text===''
