1

Only in Mozilla Firefox when i input text in muiRichTextEditor with font style for example bold text added after when i input text show error DOMException: Node.removeChild: The node to be removed is not a child of this node or when i try change font style got this error Uncaught Error: Got unexpected null or undefined. I try all solutions in Github. they doesn't work;

const defaultContent = convertToRaw(EditorState.createEmpty().getCurrentContent());


 const [content, setContent] = useState(JSON.stringify(defaultContent));

  const onChange = (state: EditorState) => {
    const currentContentState = state.getCurrentContent();
    const selectionState = state.getSelection();
    EditorState.push(state, Modifier.replaceText(currentContentState, selectionState, ''), 'remove-range');
    if (ref && ref.current && isReply) {
      ref.current.focus();
    }
    setIsEmpty(!state.getCurrentContent().hasText());
  };
  useEffect(() => {
    const comment = commentAction.comment;
    const contentState = convertFromHTML(comment ? comment.text : '');
    const state = contentState && ContentState.createFromBlockArray(contentState.contentBlocks, contentState.entityMap);
    setContent(JSON.stringify(convertToRaw(state)));
  }, [commentAction.action, commentAction.comment]);
Nikita Kagan
  • 25
  • 1
  • 7

0 Answers0