import type { Editor } from '@tiptap/core'; export type EditorStateSnapshot = { editor: TEditor; transactionNumber: number; }; export type UseEditorStateOptions = { /** * The editor instance. */ editor: TEditor; /** * A selector function to determine the value to compare for re-rendering. */ selector: (context: EditorStateSnapshot) => TSelectorResult; /** * A custom equality function to determine if the editor should re-render. * @default `deepEqual` from `fast-deep-equal` */ equalityFn?: (a: TSelectorResult, b: TSelectorResult | null) => boolean; }; /** * This hook allows you to watch for changes on the editor instance. * It will allow you to select a part of the editor state and re-render the component when it changes. * @example * ```tsx * const editor = useEditor({...options}) * const { currentSelection } = useEditorState({ * editor, * selector: snapshot => ({ currentSelection: snapshot.editor.state.selection }), * }) */ export declare function useEditorState(options: UseEditorStateOptions): TSelectorResult; /** * This hook allows you to watch for changes on the editor instance. * It will allow you to select a part of the editor state and re-render the component when it changes. * @example * ```tsx * const editor = useEditor({...options}) * const { currentSelection } = useEditorState({ * editor, * selector: snapshot => ({ currentSelection: snapshot.editor.state.selection }), * }) */ export declare function useEditorState(options: UseEditorStateOptions): TSelectorResult | null; //# sourceMappingURL=useEditorState.d.ts.map