Open softmarshmallow opened 2 days ago
The editor is typed NonNullable by useCreateBlockNote, but It cannot be accessed (or at least not mounted) on initial hook call.
useCreateBlockNote
const editor = useCreateBlockNote({ schema: schema, initialContent: safevalue(defaultValue), }); useEffect(() => { if (!editor) return; if (!editor.focus) return; editor.focus(); }, [editor]);
Am I missing something here?
Below will work when called via click event
<div className="prose dark:prose-invert mx-auto w-full" onClick={() => editor.focus()} > <ThemedRichTextEditorContent onKeyDown={(e) => { // this is required for preventing exit on enter pressed e.stopPropagation(); }} editor={editor} /> </div>
This seems unexpected. Are you using the latest version of BlockNote? Could you perhaps share a Stackblitz reproducing this issue?
The editor is typed NonNullable by
useCreateBlockNote
, but It cannot be accessed (or at least not mounted) on initial hook call.Am I missing something here?
Below will work when called via click event