diff --git a/packages/core/src/editor/BlockNoteEditor.ts b/packages/core/src/editor/BlockNoteEditor.ts index bb85302e7f..cd88f90713 100644 --- a/packages/core/src/editor/BlockNoteEditor.ts +++ b/packages/core/src/editor/BlockNoteEditor.ts @@ -3,6 +3,7 @@ import { createDocument, EditorOptions, Extension, + FocusPosition, getSchema, InputRule, isNodeSelection, @@ -156,6 +157,13 @@ export type BlockNoteEditorOptions< */ animations?: boolean; + /** + * Whether the editor should be focused automatically when it's created. + * + * @default false + */ + autofocus?: FocusPosition; + /** * When enabled, allows for collaboration between multiple users. * See [Real-time Collaboration](https://www.blocknotejs.org/docs/advanced/real-time-collaboration) for more info. @@ -850,6 +858,7 @@ export class BlockNoteEditor< ...blockNoteTipTapOptions, ...newOptions._tiptapOptions, element: null, + autofocus: newOptions.autofocus ?? false, extensions: tiptapExtensions, editorProps: { ...newOptions._tiptapOptions?.editorProps,