@blocknote/react
Version:
A "Notion-style" block-based extensible text editor built on top of Prosemirror and Tiptap.
15 lines (14 loc) • 770 B
TypeScript
import type { BlockNoteEditor } from "@blocknote/core";
/**
* Returns the bounding box (`DOMRect`) of the current editor selection.
* Re-renders automatically when the selection changes. Useful for positioning
* floating UI elements (e.g., toolbars, tooltips) relative to the selection.
*
* @param enabled - Whether to compute the bounding box. When `false`, returns
* `undefined` without measuring.
* @param editor - The BlockNote editor instance. If omitted, uses the editor
* from the nearest `BlockNoteContext`.
* @returns The `DOMRect` of the current selection, or `undefined` if disabled
* or no selection exists.
*/
export declare function useEditorSelectionBoundingBox(enabled?: boolean, editor?: BlockNoteEditor<any, any, any>): DOMRect | undefined;