@blocknote/react
Version:
A "Notion-style" block-based extensible text editor built on top of Prosemirror and Tiptap.
20 lines (19 loc) • 977 B
TypeScript
import type { BlockNoteEditor, EditorFocusOptions } from "@blocknote/core";
/**
* Whether the editor is focused, as state — re-rendering the component when
* that changes.
*
* Use this when focus decides what to *render*; for running a side effect on
* focus changes, subscribe directly with `editor.onFocusChange`.
*
* By default this reports raw content-area focus, so `false` may just mean
* focus moved into the editor's own UI — a toolbar popover's input, say. Pass
* `includeEditorUI: true` to instead get "is the user still interacting with
* this editor", which counts toolbars, menus and popovers as focused and only
* changes once focus movement has settled.
*
* @param options - See `editor.onFocusChange`.
* @param editor - The BlockNote editor instance. If omitted, uses the editor
* from the nearest `BlockNoteContext`.
*/
export declare function useEditorFocus(options?: EditorFocusOptions, editor?: BlockNoteEditor<any, any, any>): boolean;