I have two editor instances. One is editable Second one is read only for preview what user is typed I'm copied editor state beetwen those editors - wtih no problems But i want to hide second editor when first one is empty. I'm trying something like this but it always return false
...
function onChange(editorState) {
console.log(editorState.isEmpty())
}
function Editor() {
...
return (
<>
<LexicalComposer initialConfig={editorConfig}>
<ToolbarPlugin />
<RichTextPlugin
contentEditable={<ContentEditable className="editor-input" />}
placeholder={<Placeholder />}
ErrorBoundary={LexicalErrorBoundary}
/>
<OnChangePlugin onChange={onChange} />
<LexicalComposer />
)
}