planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
/// <reference types="react" />
import { Editor } from 'slate';
declare type EditorChangeHandler = (editor: Editor) => void;
/**
* A React context for sharing the editor selector context in a way to control rerenders
*/
export declare const SlateSelectorContext: import("react").Context<{
getSlate: () => Editor;
addEventListener: (callback: EditorChangeHandler) => () => void;
}>;
/**
* use redux style selectors to prevent rerendering on every keystroke.
* Bear in mind rerendering can only prevented if the returned value is a value type or for reference types (e.g. objects and arrays) add a custom equality function.
*
* Example:
* ```
* const isSelectionActive = useSlateSelector(editor => Boolean(editor.selection));
* ```
*/
export declare function useSlateSelector<T>(selector: (editor: Editor) => T, equalityFn?: (a: T, b: T) => boolean): T;
/**
* Create selector context with editor updating on every editor change
*/
export declare function getSelectorContext(editor: Editor): {
selectorContext: {
getSlate: () => import("..").ReactEditor;
addEventListener: (callback: EditorChangeHandler) => () => void;
};
onChange: (editor: Editor) => void;
};
export {};
//# sourceMappingURL=use-slate-selector.d.ts.map