UNPKG

@blocknote/react

Version:

A "Notion-style" block-based extensible text editor built on top of Prosemirror and Tiptap.

15 lines (14 loc) 893 B
import type { BlockNoteEditor } from "@blocknote/core"; /** * Subscribes to editor selection changes. The callback is invoked whenever the * user's cursor position or text selection changes, and the subscription is * automatically cleaned up when the component unmounts. The latest `callback` is always the one * invoked — passing a new callback identity does not resubscribe. * * @param callback - Function called when the selection changes. * @param editor - The BlockNote editor instance. If omitted, uses the editor * from the nearest `BlockNoteContext`. * @param includeSelectionChangedByRemote - Whether to also fire the callback * when the selection is changed by a remote collaborator. Defaults to `false`. */ export declare function useEditorSelectionChange(callback: () => void, editor?: BlockNoteEditor<any, any, any>, includeSelectionChangedByRemote?: boolean): void;