UNPKG

@udecode/plate-core

Version:

The core of Plate – a plugin system for slate

901 lines (874 loc) 91.4 kB
export { DefaultPlaceholder, Editable, RenderPlaceholderProps, Slate, useComposing, useFocused, useReadOnly, useSelected, withReact } from 'slate-react'; import React$1, { HTMLAttributes } from 'react'; import { HotkeysOptions, Keys, HotkeysEvent } from '@udecode/react-hotkeys'; import * as _udecode_slate from '@udecode/slate'; import { Value, Editor, EditorApi, EditorTransforms, NodeEntry, DecoratedRange, TText, TElement, Descendant, Path, ElementEntry, TRange, ValueOf, TSelection, TNode } from '@udecode/slate'; import { Modify, UnionToIntersection, Nullable, Deep2Partial, AnyObject, UnknownObject } from '@udecode/utils'; import * as zustand_x from 'zustand-x'; import { TCreatedStoreType, TEqualityChecker } from 'zustand-x'; export { useStoreSelect, useStoreState, useStoreValue, useTracked, useTrackedStore } from 'zustand-x'; import { f as AnyPluginConfig, P as PluginConfig, a4 as HandlerReturnType, aR as InitOptions, aT as InsertExitBreakOptions, aI as ScrollMode, aG as AutoScrollOperationsMap, aK as WithAutoScrollOptions, W as WithRequiredKey, S as SlatePlugin, _ as InferOptions, Z as InferApi, a0 as InferTransforms, $ as InferSelectors, i as ExtendEditor$1, aH as DomConfig, as as CorePlugin, n as BaseWithSlateOptions, l as InferPlugins, B as BaseEditor, Y as InferKey, t as BasePlugin, u as BasePluginContext, a3 as WithAnyKey, j as AnySlatePlugin, an as SlatePluginConfig, g as SlatePluginContext, aw as CorePluginApi, av as CorePluginTransforms, a1 as NodeComponent, s as BaseInjectProps, V as GetInjectNodePropsOptions, y as BaseTransformOptions, X as GetInjectNodePropsReturnType, a2 as NodeComponents, k as ParserOptions, q as BaseDeserializer, x as BaseSerializer, r as BaseHtmlDeserializer, E as EditableProps, J as MatchRules, bb as RenderElementFn, bc as RenderLeafFn, bd as RenderTextFn, b as RenderLeafProps, R as RenderElementProps, c as RenderTextProps } from '../withSlate-2StnFyHy.js'; import * as jotai from 'jotai'; import { Atom } from 'jotai'; export { atom } from 'jotai'; import * as jotai_x from 'jotai-x'; import { JotaiStore } from 'jotai-x'; export { createAtomStore, useStoreAtomState, useStoreAtomValue, useStoreSetAtom } from 'jotai-x'; import 'mutative'; import 'is-hotkey'; declare function EditorHotkeysEffect({ id, editableRef, }: { editableRef: React$1.RefObject<HTMLDivElement | null>; id?: string; }): React$1.JSX.Element; declare const EditorMethodsEffect: ({ id }: { id?: string; }) => null; type DOMHandler<C extends AnyPluginConfig = PluginConfig, EV = {}> = (ctx: PlatePluginContext<C> & { event: EV; }) => HandlerReturnType; interface DOMHandlers<C extends AnyPluginConfig = PluginConfig> { onAbort?: DOMHandler<C, React$1.SyntheticEvent>; onAbortCapture?: DOMHandler<C, React$1.SyntheticEvent>; onAnimationEnd?: DOMHandler<C, React$1.AnimationEvent>; onAnimationEndCapture?: DOMHandler<C, React$1.AnimationEvent>; onAnimationIteration?: DOMHandler<C, React$1.AnimationEvent>; onAnimationIterationCapture?: DOMHandler<C, React$1.AnimationEvent>; onAnimationStart?: DOMHandler<C, React$1.AnimationEvent>; onAnimationStartCapture?: DOMHandler<C, React$1.AnimationEvent>; onAuxClick?: DOMHandler<C, React$1.MouseEvent>; onAuxClickCapture?: DOMHandler<C, React$1.MouseEvent>; onBeforeInput?: DOMHandler<C, React$1.FormEvent>; onBeforeInputCapture?: DOMHandler<C, React$1.FormEvent>; onBlur?: DOMHandler<C, React$1.FocusEvent>; onBlurCapture?: DOMHandler<C, React$1.FocusEvent>; onCanPlay?: DOMHandler<C, React$1.SyntheticEvent>; onCanPlayCapture?: DOMHandler<C, React$1.SyntheticEvent>; onCanPlayThrough?: DOMHandler<C, React$1.SyntheticEvent>; onCanPlayThroughCapture?: DOMHandler<C, React$1.SyntheticEvent>; onClick?: DOMHandler<C, React$1.MouseEvent>; onClickCapture?: DOMHandler<C, React$1.MouseEvent>; onCompositionEnd?: DOMHandler<C, React$1.CompositionEvent>; onCompositionEndCapture?: DOMHandler<C, React$1.CompositionEvent>; onCompositionStart?: DOMHandler<C, React$1.CompositionEvent>; onCompositionStartCapture?: DOMHandler<C, React$1.CompositionEvent>; onCompositionUpdate?: DOMHandler<C, React$1.CompositionEvent>; onCompositionUpdateCapture?: DOMHandler<C, React$1.CompositionEvent>; onContextMenu?: DOMHandler<C, React$1.MouseEvent>; onContextMenuCapture?: DOMHandler<C, React$1.MouseEvent>; onCopy?: DOMHandler<C, React$1.ClipboardEvent>; onCopyCapture?: DOMHandler<C, React$1.ClipboardEvent>; onCut?: DOMHandler<C, React$1.ClipboardEvent>; onCutCapture?: DOMHandler<C, React$1.ClipboardEvent>; onDOMBeforeInput?: DOMHandler<C, Event>; onDoubleClick?: DOMHandler<C, React$1.MouseEvent>; onDoubleClickCapture?: DOMHandler<C, React$1.MouseEvent>; onDrag?: DOMHandler<C, React$1.DragEvent>; onDragCapture?: DOMHandler<C, React$1.DragEvent>; onDragEnd?: DOMHandler<C, React$1.DragEvent>; onDragEndCapture?: DOMHandler<C, React$1.DragEvent>; onDragEnter?: DOMHandler<C, React$1.DragEvent>; onDragEnterCapture?: DOMHandler<C, React$1.DragEvent>; onDragExit?: DOMHandler<C, React$1.DragEvent>; onDragExitCapture?: DOMHandler<C, React$1.DragEvent>; onDragLeave?: DOMHandler<C, React$1.DragEvent>; onDragLeaveCapture?: DOMHandler<C, React$1.DragEvent>; onDragOver?: DOMHandler<C, React$1.DragEvent>; onDragOverCapture?: DOMHandler<C, React$1.DragEvent>; onDragStart?: DOMHandler<C, React$1.DragEvent>; onDragStartCapture?: DOMHandler<C, React$1.DragEvent>; onDrop?: DOMHandler<C, React$1.DragEvent>; onDropCapture?: DOMHandler<C, React$1.DragEvent>; onDurationChange?: DOMHandler<C, React$1.SyntheticEvent>; onDurationChangeCapture?: DOMHandler<C, React$1.SyntheticEvent>; onEmptied?: DOMHandler<C, React$1.SyntheticEvent>; onEmptiedCapture?: DOMHandler<C, React$1.SyntheticEvent>; onEncrypted?: DOMHandler<C, React$1.SyntheticEvent>; onEncryptedCapture?: DOMHandler<C, React$1.SyntheticEvent>; onEnded?: DOMHandler<C, React$1.SyntheticEvent>; onEndedCapture?: DOMHandler<C, React$1.SyntheticEvent>; onFocus?: DOMHandler<C, React$1.FocusEvent>; onFocusCapture?: DOMHandler<C, React$1.FocusEvent>; onGotPointerCapture?: DOMHandler<C, React$1.PointerEvent>; onGotPointerCaptureCapture?: DOMHandler<C, React$1.PointerEvent>; onInput?: DOMHandler<C, React$1.FormEvent>; onInputCapture?: DOMHandler<C, React$1.FormEvent>; onInvalid?: DOMHandler<C, React$1.FormEvent>; onInvalidCapture?: DOMHandler<C, React$1.FormEvent>; onKeyDown?: DOMHandler<C, React$1.KeyboardEvent>; onKeyDownCapture?: DOMHandler<C, React$1.KeyboardEvent>; onKeyPress?: DOMHandler<C, React$1.KeyboardEvent>; onKeyPressCapture?: DOMHandler<C, React$1.KeyboardEvent>; onKeyUp?: DOMHandler<C, React$1.KeyboardEvent>; onKeyUpCapture?: DOMHandler<C, React$1.KeyboardEvent>; onLoad?: DOMHandler<C, React$1.SyntheticEvent>; onLoadCapture?: DOMHandler<C, React$1.SyntheticEvent>; onLoadedData?: DOMHandler<C, React$1.SyntheticEvent>; onLoadedDataCapture?: DOMHandler<C, React$1.SyntheticEvent>; onLoadedMetadata?: DOMHandler<C, React$1.SyntheticEvent>; onLoadedMetadataCapture?: DOMHandler<C, React$1.SyntheticEvent>; onLoadStart?: DOMHandler<C, React$1.SyntheticEvent>; onLoadStartCapture?: DOMHandler<C, React$1.SyntheticEvent>; onLostPointerCapture?: DOMHandler<C, React$1.PointerEvent>; onLostPointerCaptureCapture?: DOMHandler<C, React$1.PointerEvent>; onMouseDown?: DOMHandler<C, React$1.MouseEvent>; onMouseDownCapture?: DOMHandler<C, React$1.MouseEvent>; onMouseEnter?: DOMHandler<C, React$1.MouseEvent>; onMouseLeave?: DOMHandler<C, React$1.MouseEvent>; onMouseMove?: DOMHandler<C, React$1.MouseEvent>; onMouseMoveCapture?: DOMHandler<C, React$1.MouseEvent>; onMouseOut?: DOMHandler<C, React$1.MouseEvent>; onMouseOutCapture?: DOMHandler<C, React$1.MouseEvent>; onMouseOver?: DOMHandler<C, React$1.MouseEvent>; onMouseOverCapture?: DOMHandler<C, React$1.MouseEvent>; onMouseUp?: DOMHandler<C, React$1.MouseEvent>; onMouseUpCapture?: DOMHandler<C, React$1.MouseEvent>; onPaste?: DOMHandler<C, React$1.ClipboardEvent>; onPasteCapture?: DOMHandler<C, React$1.ClipboardEvent>; onPause?: DOMHandler<C, React$1.SyntheticEvent>; onPauseCapture?: DOMHandler<C, React$1.SyntheticEvent>; onPlay?: DOMHandler<C, React$1.SyntheticEvent>; onPlayCapture?: DOMHandler<C, React$1.SyntheticEvent>; onPlaying?: DOMHandler<C, React$1.SyntheticEvent>; onPlayingCapture?: DOMHandler<C, React$1.SyntheticEvent>; onPointerCancel?: DOMHandler<C, React$1.PointerEvent>; onPointerCancelCapture?: DOMHandler<C, React$1.PointerEvent>; onPointerDown?: DOMHandler<C, React$1.PointerEvent>; onPointerDownCapture?: DOMHandler<C, React$1.PointerEvent>; onPointerEnter?: DOMHandler<C, React$1.PointerEvent>; onPointerLeave?: DOMHandler<C, React$1.PointerEvent>; onPointerMove?: DOMHandler<C, React$1.PointerEvent>; onPointerMoveCapture?: DOMHandler<C, React$1.PointerEvent>; onPointerOut?: DOMHandler<C, React$1.PointerEvent>; onPointerOutCapture?: DOMHandler<C, React$1.PointerEvent>; onPointerOver?: DOMHandler<C, React$1.PointerEvent>; onPointerOverCapture?: DOMHandler<C, React$1.PointerEvent>; onPointerUp?: DOMHandler<C, React$1.PointerEvent>; onPointerUpCapture?: DOMHandler<C, React$1.PointerEvent>; onProgress?: DOMHandler<C, React$1.SyntheticEvent>; onProgressCapture?: DOMHandler<C, React$1.SyntheticEvent>; onRateChange?: DOMHandler<C, React$1.SyntheticEvent>; onRateChangeCapture?: DOMHandler<C, React$1.SyntheticEvent>; onReset?: DOMHandler<C, React$1.FormEvent>; onResetCapture?: DOMHandler<C, React$1.FormEvent>; onScroll?: DOMHandler<C, React$1.UIEvent>; onScrollCapture?: DOMHandler<C, React$1.UIEvent>; onSeeked?: DOMHandler<C, React$1.SyntheticEvent>; onSeekedCapture?: DOMHandler<C, React$1.SyntheticEvent>; onSeeking?: DOMHandler<C, React$1.SyntheticEvent>; onSeekingCapture?: DOMHandler<C, React$1.SyntheticEvent>; onSelect?: DOMHandler<C, React$1.SyntheticEvent>; onSelectCapture?: DOMHandler<C, React$1.SyntheticEvent>; onStalled?: DOMHandler<C, React$1.SyntheticEvent>; onStalledCapture?: DOMHandler<C, React$1.SyntheticEvent>; onSubmit?: DOMHandler<C, React$1.FormEvent>; onSubmitCapture?: DOMHandler<C, React$1.FormEvent>; onSuspend?: DOMHandler<C, React$1.SyntheticEvent>; onSuspendCapture?: DOMHandler<C, React$1.SyntheticEvent>; onTimeUpdate?: DOMHandler<C, React$1.SyntheticEvent>; onTimeUpdateCapture?: DOMHandler<C, React$1.SyntheticEvent>; onTouchCancel?: DOMHandler<C, React$1.TouchEvent>; onTouchCancelCapture?: DOMHandler<C, React$1.TouchEvent>; onTouchEnd?: DOMHandler<C, React$1.TouchEvent>; onTouchEndCapture?: DOMHandler<C, React$1.TouchEvent>; onTouchMove?: DOMHandler<C, React$1.TouchEvent>; onTouchMoveCapture?: DOMHandler<C, React$1.TouchEvent>; onTouchStart?: DOMHandler<C, React$1.TouchEvent>; onTouchStartCapture?: DOMHandler<C, React$1.TouchEvent>; onTransitionEnd?: DOMHandler<C, React$1.TransitionEvent>; onTransitionEndCapture?: DOMHandler<C, React$1.TransitionEvent>; onVolumeChange?: DOMHandler<C, React$1.SyntheticEvent>; onVolumeChangeCapture?: DOMHandler<C, React$1.SyntheticEvent>; onWaiting?: DOMHandler<C, React$1.SyntheticEvent>; onWaitingCapture?: DOMHandler<C, React$1.SyntheticEvent>; onWheel?: DOMHandler<C, React$1.WheelEvent>; onWheelCapture?: DOMHandler<C, React$1.WheelEvent>; } type KeyboardHandler<C extends AnyPluginConfig = PluginConfig> = DOMHandler<C, React$1.KeyboardEvent>; type PlatePluginConfig$2<K extends string = any, O = {}, A = {}, T = {}, S = {}> = Omit<Partial<Modify<PlatePlugin<PluginConfig<K, O, A, T, S>>, { node: Partial<PlatePlugin<PluginConfig<K, O, A, T, S>>['node']>; }>>, keyof PlatePluginMethods | 'optionsStore' | 'useOptionsStore'>; type TPlatePluginConfig<C extends AnyPluginConfig = PluginConfig> = Omit<Partial<Modify<PlatePlugin<C>, { node: Partial<PlatePlugin<C>['node']>; }>>, keyof PlatePluginMethods | 'optionsStore' | 'useOptionsStore'>; declare const createPlatePlugin: <K extends string = any, O = {}, A = {}, T = {}, S = {}>(config?: ((editor: PlateEditor) => PlatePluginConfig$2<K, O, A, T, S>) | PlatePluginConfig$2<K, O, A, T, S>) => PlatePlugin<PluginConfig<K, O, A, T, S>>; /** * Explicitly typed version of `createPlatePlugin`. * * @remarks * While `createPlatePlugin` uses type inference, this function requires an * explicit type parameter. Use this when you need precise control over the * plugin's type structure or when type inference doesn't provide the desired * result. */ declare function createTPlatePlugin<C extends AnyPluginConfig = PluginConfig>(config?: ((editor: PlateEditor) => TPlatePluginConfig<C>) | TPlatePluginConfig<C>): PlatePlugin<C>; declare const getPlateCorePlugins: () => (PlatePlugin<PluginConfig<"slateExtension", {}, { redecorate: () => void; }, { reset: (options: _udecode_slate.ResetOptions | undefined) => void; init: (args_0: InitOptions) => Promise<void>; insertExitBreak: (args_0?: InsertExitBreakOptions | undefined) => true | undefined; resetBlock: (args_0?: { at?: _udecode_slate.Path; } | undefined) => true | undefined; setValue: (value?: string | _udecode_slate.Value | undefined) => void; }, {}>> | PlatePlugin<PluginConfig<"eventEditor", {}, {}, {}, {}>> | PlatePlugin<PluginConfig<"p", {}, {}, {}, {}>> | PlatePlugin<PluginConfig<"dom", { scrollMode?: ScrollMode; scrollOperations?: AutoScrollOperationsMap; scrollOptions?: _udecode_slate.ScrollIntoViewOptions; }, { isScrolling: () => boolean; }, { withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void; }, {}>>)[]; /** * Creates a memoized Plate editor for React components. * * This hook creates a fully configured Plate editor instance that is memoized * based on the provided dependencies. It's optimized for React components to * prevent unnecessary re-creation of the editor on every render. * * Examples: * * ```ts * const editor = usePlateEditor({ * plugins: [ParagraphPlugin, HeadingPlugin], * value: [{ type: 'p', children: [{ text: 'Hello world!' }] }], * }); * * // Editor with custom dependencies * const editor = usePlateEditor( * { * plugins: [ParagraphPlugin], * enabled, * }, * [enabled] * ); // Re-create when enabled changes * ``` * * @param options - Configuration options for creating the Plate editor * @param deps - Additional dependencies for the useMemo hook (default: []) * @see {@link createPlateEditor} for detailed information on React editor creation and configuration. * @see {@link createSlateEditor} for a non-React version of editor creation. * @see {@link withPlate} for the underlying React-specific enhancement function. */ declare function usePlateEditor<V extends Value = Value, P extends AnyPluginConfig = PlateCorePlugin, TEnabled extends boolean | undefined = undefined>(options?: CreatePlateEditorOptions<V, P> & { enabled?: TEnabled; }, deps?: React$1.DependencyList): TEnabled extends false ? null : TEnabled extends true | undefined ? TPlateEditor<V, P> : TPlateEditor<V, P> | null; declare function getEditorPlugin<P extends AnyPluginConfig | PlatePlugin<AnyPluginConfig>>(editor: PlateEditor, plugin: WithRequiredKey<P>): PlatePluginContext<InferConfig<P> extends never ? P : InferConfig<P>>; /** Get editor plugin by key or plugin object. */ declare function getPlugin<C extends AnyPluginConfig = PluginConfig>(editor: PlateEditor, plugin: WithRequiredKey<C>): C extends { node: any; } ? C : PlatePlugin<C>; declare const omitPluginContext: <T extends PlatePluginContext<AnyPlatePlugin>>(ctx: T) => Omit<T, "api" | "setOptions" | "tf" | "type" | "getOption" | "getOptions" | "setOption" | "editor" | "plugin">; type PlatePluginConfig$1<C extends AnyPluginConfig, EO = {}, EA = {}, ET = {}, ES = {}> = Omit<Partial<PlatePlugin<PluginConfig<C['key'], EO & InferOptions<C>, EA & InferApi<C>, ET & InferTransforms<C>, ES & InferSelectors<C>>>>, keyof PlatePluginMethods | 'api' | 'node' | 'options' | 'transforms'> & { api?: EA & Partial<InferApi<C>>; node?: Partial<PlatePlugin<C>['node']>; options?: EO & Partial<InferOptions<C>>; selectors?: ES & Partial<InferSelectors<C>>; transforms?: ET & Partial<InferTransforms<C>>; }; /** * Extends a SlatePlugin to create a React PlatePlugin. * * @remarks * This function transforms a SlatePlugin into a React PlatePlugin, allowing for * React-specific functionality to be added. * @param basePlugin - The base SlatePlugin to be extended. * @param extendConfig - A function or object that provides the extension * configuration. If a function, it receives the plugin context and should * return a partial PlatePlugin. If an object, it should be a partial * PlatePlugin configuration. * @returns A new PlatePlugin that combines the base SlatePlugin functionality * with React-specific features defined in the extension configuration. */ declare function toPlatePlugin<C extends AnyPluginConfig, EO = {}, EA = {}, ET = {}, ES = {}>(basePlugin: SlatePlugin<C>, extendConfig?: ((ctx: PlatePluginContext<C>) => PlatePluginConfig$1<C, EO, EA, ET>) | PlatePluginConfig$1<C, EO, EA, ET>): PlatePlugin<PluginConfig<C['key'], EO & InferOptions<C>, EA & InferApi<C>, ET & InferTransforms<C>, ES & InferSelectors<C>>>; type ExtendPluginConfig<C extends AnyPluginConfig = PluginConfig> = Omit<Partial<PlatePlugin<PluginConfig<C['key'], Partial<InferOptions<C>>, Partial<InferApi<C>>, Partial<InferTransforms<C>>>>>, keyof PlatePluginMethods>; /** * Explicitly typed version of {@link toPlatePlugin}. * * @remarks * This function requires explicit type parameters for both the base plugin * configuration and the extension configuration. Use this when you need * precise control over the plugin's type structure or when type inference * doesn't provide the desired result. * @typeParam C - The type of the extension configuration for the PlatePlugin * (required). * @typeParam TContext - The type of the base SlatePlugin configuration * (optional). */ declare function toTPlatePlugin<C extends AnyPluginConfig = PluginConfig, TContext extends AnyPluginConfig = AnyPluginConfig>(basePlugin: SlatePlugin<TContext>, extendConfig?: ((ctx: PlatePluginContext<TContext>) => ExtendPluginConfig<C>) | ExtendPluginConfig<C>): PlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>>>; declare const SlateReactExtensionPlugin: PlatePlugin<PluginConfig<"slateExtension", {}, { redecorate: () => void; }, { reset: (options: _udecode_slate.ResetOptions | undefined) => void; init: (args_0: InitOptions) => Promise<void>; insertExitBreak: (args_0?: InsertExitBreakOptions | undefined) => true | undefined; resetBlock: (args_0?: { at?: _udecode_slate.Path; } | undefined) => true | undefined; setValue: (value?: string | _udecode_slate.Value | undefined) => void; }, {}>>; declare const EventEditorPlugin: PlatePlugin<PluginConfig<"eventEditor", {}, {}, {}, {}>>; type EventEditorState = { /** Last editor id that has been blurred. */ blur: string | null; /** Editor id that is currently being focused. */ focus: string | null; /** Last editor id. */ last: string | null; }; /** Store where the keys are event names and the values are editor ids. */ declare const EventEditorStore: zustand_x.TStateApi<EventEditorState, [["zustand/mutative-x", never]], {}, {}>; declare const useEventEditorValue: { <K extends keyof EventEditorState>(key: K): EventEditorState[K]; <K extends never>(key: K, ...args: Parameters<{}[K]>): ReturnType<{}[K]>; (key: "state"): EventEditorState; <K extends keyof EventEditorState>(key: K, equalityFn?: zustand_x.TEqualityChecker<EventEditorState[K]> | undefined): EventEditorState[K]; <K extends never>(key: K, ...args: [...Parameters<{}[K]>, (zustand_x.TEqualityChecker<ReturnType<{}[K]>> | undefined)?]): ReturnType<{}[K]>; }; declare const getEventPlateId: (id?: string) => string; declare const FOCUS_EDITOR_EVENT = "focus-editor-event"; declare const BLUR_EDITOR_EVENT = "blur-editor-event"; declare const useFocusEditorEvents: ({ editorRef, onEditorBlur, onEditorFocus, }: { editorRef: PlateEditor | null; onEditorBlur?: () => void; onEditorFocus?: () => void; }) => void; declare const ParagraphPlugin: PlatePlugin<PluginConfig<"p", {}, {}, {}, {}>>; /** @see {@link withReact} */ declare const ReactPlugin: PlatePlugin<PluginConfig<"dom", { scrollMode?: ScrollMode; scrollOperations?: AutoScrollOperationsMap; scrollOptions?: _udecode_slate.ScrollIntoViewOptions; }, { isScrolling: () => boolean; }, { withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void; }, {}>>; declare const withPlateReact: ExtendEditor$1<DomConfig>; type PlateCorePlugin = CorePlugin | typeof EventEditorPlugin | typeof SlateReactExtensionPlugin; type WithPlateOptions<V extends Value = Value, P extends AnyPluginConfig = PlateCorePlugin> = BaseWithSlateOptions<P> & Pick<Partial<AnyPlatePlugin>, 'api' | 'decorate' | 'extendEditor' | 'handlers' | 'inject' | 'normalizeInitialValue' | 'options' | 'override' | 'priority' | 'render' | 'shortcuts' | 'transforms' | 'useHooks'> & { value?: ((editor: PlateEditor) => V) | V | string; rootPlugin?: (plugin: AnyPlatePlugin) => AnyPlatePlugin; }; /** * Applies Plate enhancements to an editor instance (React version). * * @remarks * This function supports React-specific features including component rendering, * event handlers, and React hooks integration. * @see {@link createPlateEditor} for a higher-level React editor creation function. * @see {@link usePlateEditor} for a memoized version in React components. * @see {@link withSlate} for the non-React version of editor enhancement. */ declare const withPlate: <V extends Value = Value, P extends AnyPluginConfig = PlateCorePlugin>(e: Editor, { plugins, ...options }?: WithPlateOptions<V, P>) => TPlateEditor<V, InferPlugins<P[]>>; type CreatePlateEditorOptions<V extends Value = Value, P extends AnyPluginConfig = PlateCorePlugin> = WithPlateOptions<V, P> & { /** * Initial editor to be extended with `withPlate`. * * @default createEditor() */ editor?: Editor; }; /** * Creates a Plate editor (React version). * * This function creates a fully configured Plate editor instance with * React-specific enhancements including component rendering, event handlers, * and hooks integration. It applies all specified plugins and configurations to * create a functional editor. * * Examples: * * ```ts * const editor = createPlateEditor({ * plugins: [ParagraphPlugin, HeadingPlugin], * value: [{ type: 'p', children: [{ text: 'Hello world!' }] }], * }); * * // Editor with custom components * const editor = createPlateEditor({ * plugins: [ParagraphPlugin.withComponent(ParagraphElement)], * components: { [CodePlugin.key]: CodeLeaf }, * }); * * // Editor with React-specific options * const editor = createPlateEditor({ * plugins: [ParagraphPlugin], * handlers: { onKeyDown: customKeyHandler }, * }); * ``` * * @see {@link createSlateEditor} for a non-React version of editor creation. * @see {@link usePlateEditor} for a memoized version in React components. * @see {@link withPlate} for the underlying function that applies Plate enhancements to an editor. */ declare const createPlateEditor: <V extends Value = Value, P extends AnyPluginConfig = PlateCorePlugin>({ editor, ...options }?: CreatePlateEditorOptions<V, P>) => TPlateEditor<V, InferPlugins<P[]>>; type PlateEditor = BaseEditor & { api: EditorApi & UnionToIntersection<InferApi<PlateCorePlugin>>; meta: BaseEditor['meta'] & { pluginList: AnyEditorPlatePlugin[]; shortcuts: Shortcuts; }; plugins: Record<string, AnyEditorPlatePlugin>; tf: EditorTransforms & UnionToIntersection<InferTransforms<PlateCorePlugin>>; transforms: EditorTransforms & UnionToIntersection<InferTransforms<PlateCorePlugin>>; getApi: <C extends AnyPluginConfig = PluginConfig>(plugin?: WithRequiredKey<C>) => PlateEditor['api'] & InferApi<C>; getPlugin: <C extends AnyPluginConfig = PluginConfig>(plugin: WithRequiredKey<C>) => C extends { node: any; } ? C : EditorPlatePlugin<C>; getTransforms: <C extends AnyPluginConfig = PluginConfig>(plugin?: WithRequiredKey<C>) => PlateEditor['tf'] & InferTransforms<C>; uid?: string; }; type TPlateEditor<V extends Value = Value, P extends AnyPluginConfig = PlateCorePlugin> = PlateEditor & { api: EditorApi<V> & UnionToIntersection<InferApi<P | PlateCorePlugin>>; children: V; meta: BaseEditor['meta'] & { pluginList: P[]; shortcuts: Shortcuts; }; plugins: { [K in P['key']]: Extract<P, { key: K; }>; }; tf: EditorTransforms<V> & UnionToIntersection<InferTransforms<P | PlateCorePlugin>>; transforms: EditorTransforms<V> & UnionToIntersection<InferTransforms<P | PlateCorePlugin>>; getApi: <C extends AnyPluginConfig = PluginConfig>(plugin?: WithRequiredKey<C>) => TPlateEditor<V>['api'] & InferApi<C>; getTransforms: <C extends AnyPluginConfig = PluginConfig>(plugin?: WithRequiredKey<C>) => TPlateEditor<V>['tf'] & InferTransforms<C>; }; type KeyofPlugins<T extends AnyPluginConfig> = (string & {}) | InferKey<PlateCorePlugin | T>; type AnyEditorPlatePlugin = EditorPlatePlugin<AnyPluginConfig>; type AnyPlatePlugin = PlatePlugin<AnyPluginConfig>; /** * Property used by Plate to decorate editor ranges. If the function returns * undefined then no ranges are modified. If the function returns an array the * returned ranges are merged with the ranges called by other plugins. */ type Decorate<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C> & { entry: NodeEntry; }) => DecoratedRange[] | undefined; type Deserializer<C extends AnyPluginConfig = PluginConfig> = BaseDeserializer & { parse?: (options: PlatePluginContext<C> & { element: any; }) => Partial<Descendant> | undefined | void; query?: (options: PlatePluginContext<C> & { element: any; }) => boolean; }; type EditableSiblingComponent = (editableProps: EditableProps) => React$1.ReactElement<any> | null; type EditorPlatePlugin<C extends AnyPluginConfig = PluginConfig> = Omit<PlatePlugin<C>, keyof PlatePluginMethods | 'override' | 'plugins'>; /** Plate plugin overriding the `editor` methods. Naming convention is `with*`. */ type ExtendEditor<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C>) => PlateEditor; type ExtendEditorApi<C extends AnyPluginConfig = PluginConfig, EA = {}> = (ctx: PlatePluginContext<C>) => EA & Deep2Partial<EditorApi & CorePluginApi> & { [K in keyof InferApi<C>]?: InferApi<C>[K] extends (...args: any[]) => any ? (...args: Parameters<InferApi<C>[K]>) => ReturnType<InferApi<C>[K]> : InferApi<C>[K] extends Record<string, (...args: any[]) => any> ? { [N in keyof InferApi<C>[K]]?: (...args: Parameters<InferApi<C>[K][N]>) => ReturnType<InferApi<C>[K][N]>; } : never; }; type ExtendEditorTransforms<C extends AnyPluginConfig = PluginConfig, ET = {}> = (ctx: PlatePluginContext<C>) => ET & Deep2Partial<EditorTransforms & CorePluginTransforms> & { [K in keyof InferTransforms<C>]?: InferTransforms<C>[K] extends (...args: any[]) => any ? (...args: Parameters<InferTransforms<C>[K]>) => ReturnType<InferTransforms<C>[K]> : InferTransforms<C>[K] extends Record<string, (...args: any[]) => any> ? { [N in keyof InferTransforms<C>[K]]?: (...args: Parameters<InferTransforms<C>[K][N]>) => ReturnType<InferTransforms<C>[K][N]>; } : never; }; type HtmlDeserializer<C extends AnyPluginConfig = PluginConfig> = BaseHtmlDeserializer & { parse?: (options: PlatePluginContext<C> & { element: HTMLElement; node: AnyObject; }) => Partial<Descendant> | undefined | void; query?: (options: PlatePluginContext<C> & { element: HTMLElement; }) => boolean; }; type HtmlReactSerializer<C extends AnyPluginConfig = PluginConfig> = { parse?: React$1.FC<PlateElementProps<TElement, C> & PlateLeafProps<TText, C>>; query?: (options: PlateElementProps) => boolean; }; type HtmlSerializer<C extends AnyPluginConfig = PluginConfig> = { parse?: (options: PlatePluginContext<C> & { node: Descendant; }) => string; query?: (options: PlatePluginContext<C> & { node: Descendant; }) => boolean; }; type InferConfig<P> = P extends PlatePlugin<infer C> | SlatePlugin<infer C> ? C : never; /** Properties used by Plate to inject props into any {@link NodeComponent}. */ type InjectNodeProps<C extends AnyPluginConfig = PluginConfig> = BaseInjectProps & { /** Whether to inject the props. If true, overrides all other checks. */ query?: (options: NonNullable<NonNullable<InjectNodeProps>> & PlatePluginContext<C> & { nodeProps: GetInjectNodePropsOptions; }) => boolean; /** * Transform the className. * * @default clsx(className, classNames[value]) */ transformClassName?: (options: TransformOptions<C>) => any; /** * Transform the node value for the style or className. * * @default nodeValue */ transformNodeValue?: (options: TransformOptions<C>) => any; /** Transform the injected props. */ transformProps?: (options: TransformOptions<C> & { props: GetInjectNodePropsReturnType; }) => AnyObject | undefined; /** * Transform the style. * * @default { ...style, [styleKey]: value } */ transformStyle?: (options: TransformOptions<C>) => CSSStyleDeclaration; }; type LeafNodeProps<C extends AnyPluginConfig = PluginConfig> = ((props: PlateLeafProps<TText, C>) => AnyObject | undefined) | AnyObject; /** * Property used by Plate to override node `component` props. If function, its * returning value will be shallow merged to the old props, with the old props * as parameter. If object, its value will be shallow merged to the old props. */ type NodeProps<C extends AnyPluginConfig = PluginConfig> = ((props: PlateElementProps<TElement, C> & PlateLeafProps<TText, C>) => AnyObject | undefined) | AnyObject; /** @deprecated Use {@link RenderNodeWrapper} instead. */ type NodeWrapperComponent<C extends AnyPluginConfig = PluginConfig> = (props: NodeWrapperComponentProps<C>) => NodeWrapperComponentReturnType<C>; /** @deprecated Use {@link RenderNodeWrapperProps} instead. */ interface NodeWrapperComponentProps<C extends AnyPluginConfig = PluginConfig> extends PlateElementProps<TElement, C> { key: string; } /** @deprecated Use {@link RenderNodeWrapperFunction} instead. */ type NodeWrapperComponentReturnType<C extends AnyPluginConfig = PluginConfig> = React$1.FC<PlateElementProps<TElement, C>> | undefined; type NormalizeInitialValue<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C> & { value: Value; }) => void; /** * Function called whenever a change occurs in the editor. Return `false` to * prevent calling the next plugin handler. * * @see {@link SlatePropsOnChange} */ type OnChange<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C> & { value: Value; }) => HandlerReturnType; type OverrideEditor<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C>) => { api?: Deep2Partial<EditorApi & CorePluginApi> & { [K in keyof InferApi<C>]?: InferApi<C>[K] extends (...args: any[]) => any ? (...args: Parameters<InferApi<C>[K]>) => ReturnType<InferApi<C>[K]> : InferApi<C>[K] extends Record<string, (...args: any[]) => any> ? { [N in keyof InferApi<C>[K]]?: (...args: Parameters<InferApi<C>[K][N]>) => ReturnType<InferApi<C>[K][N]>; } : never; }; transforms?: Deep2Partial<EditorTransforms & CorePluginTransforms> & { [K in keyof InferTransforms<C>]?: InferTransforms<C>[K] extends (...args: any[]) => any ? (...args: Parameters<InferTransforms<C>[K]>) => ReturnType<InferTransforms<C>[K]> : InferTransforms<C>[K] extends Record<string, (...args: any[]) => any> ? { [N in keyof InferTransforms<C>[K]]?: (...args: Parameters<InferTransforms<C>[K][N]>) => ReturnType<InferTransforms<C>[K][N]>; } : never; }; }; /** * Used by parser plugins like html to deserialize inserted data to a slate * fragment. The fragment will be inserted to the editor if not empty. */ type Parser<C extends AnyPluginConfig = PluginConfig> = { /** Format to get data. Example data types are text/plain and text/uri-list. */ format?: string[] | string; mimeTypes?: string[]; /** Deserialize data to fragment */ deserialize?: (options: ParserOptions & PlatePluginContext<C>) => Descendant[] | undefined; /** * Function called on `editor.tf.insertData` just before * `editor.tf.insertFragment`. Default: if the block above the selection is * empty and the first fragment node type is not inline, set the selected node * type to the first fragment node type. * * @returns If true, the next handlers will be skipped. */ preInsert?: (options: ParserOptions & PlatePluginContext<C> & { fragment: Descendant[]; }) => HandlerReturnType; /** Query to skip this plugin. */ query?: (options: ParserOptions & PlatePluginContext<C>) => boolean; /** Transform the inserted data. */ transformData?: (options: ParserOptions & PlatePluginContext<C>) => string; /** Transform the fragment to insert. */ transformFragment?: (options: ParserOptions & PlatePluginContext<C> & { fragment: Descendant[]; }) => Descendant[]; }; /** The `PlatePlugin` interface is a React interface for all plugins. */ type PlatePlugin<C extends AnyPluginConfig = PluginConfig> = BasePlugin<C> & Nullable<{ /** @see {@link Decorate} */ decorate?: Decorate<WithAnyKey<C>>; /** @see {@link ExtendEditor} */ extendEditor?: ExtendEditor<WithAnyKey<C>>; /** Normalize initial value before passing it into the editor. */ normalizeInitialValue?: NormalizeInitialValue<WithAnyKey<C>>; /** @see {@link UseHooks} */ useHooks?: UseHooks<WithAnyKey<C>>; }> & PlatePluginMethods<C> & { /** * Handlers called whenever the corresponding event occurs in the editor. * Event handlers can return a boolean flag to specify whether the event * can be treated as being handled. If it returns `true`, the next * handlers will not be called. */ handlers: Nullable<DOMHandlers<WithAnyKey<C>> & { /** @see {@link OnChange} */ onChange?: OnChange<WithAnyKey<C>>; }>; /** Plugin injection. */ inject: Nullable<{ nodeProps?: InjectNodeProps<WithAnyKey<C>>; /** * Property that can be used by a plugin to allow other plugins to * inject code. For example, if multiple plugins have defined * `inject.editor.tf.insertData.transformData` for `key=HtmlPlugin.key`, * `insertData` plugin will call all of these `transformData` for * `HtmlPlugin.key` plugin. Differs from `override.plugins` as this is * not overriding any plugin. */ plugins?: Record<string, Partial<EditorPlatePlugin<AnyPluginConfig>>>; /** * A function that returns a plugin config to be injected into other * plugins `inject.plugins` specified by targetPlugins. */ targetPluginToInject?: (ctx: PlatePluginContext<C> & { targetPlugin: string; }) => Partial<PlatePlugin<AnyPluginConfig>>; }>; node: { /** Override `data-slate-leaf` element attributes */ leafProps?: LeafNodeProps<WithAnyKey<C>>; /** Override node attributes */ props?: NodeProps<WithAnyKey<C>>; /** Override `data-slate-node="text"` element attributes */ textProps?: TextNodeProps<WithAnyKey<C>>; }; override: { /** Replace plugin {@link NodeComponent} by key. */ components?: NodeComponents; /** Extend {@link PlatePlugin} by key. */ plugins?: Record<string, Partial<EditorPlatePlugin<AnyPluginConfig>>>; }; /** @see {@link Parser} */ parser: Nullable<Parser<WithAnyKey<C>>>; parsers: (Record<string, { /** @see {@link Deserializer} */ deserializer?: Deserializer<WithAnyKey<C>>; /** @see {@link Serializer} */ serializer?: Serializer<WithAnyKey<C>>; }> & { html?: never; htmlReact?: never; }) | { html?: Nullable<{ /** @see {@link HtmlDeserializer} */ deserializer?: HtmlDeserializer<WithAnyKey<C>>; /** @see {@link HtmlSerializer} */ serializer?: HtmlSerializer<WithAnyKey<C>>; }>; htmlReact?: Nullable<{ /** Function to deserialize HTML to Slate nodes using React. */ serializer?: HtmlReactSerializer<WithAnyKey<C>>; }>; }; /** * Recursive plugin support to allow having multiple plugins in a single * plugin. Plate eventually flattens all the plugins into the editor. */ plugins: any[]; render: Nullable<{ /** * When other plugins' node components are rendered, this function can * return an optional wrapper function that turns a node's props to a * wrapper React node as its parent. Useful for wrapping or decorating * nodes with additional UI elements. * * NOTE: The function can run React hooks. NOTE: Do not run React hooks * in the wrapper function. It is not equivalent to a React component. */ aboveNodes?: RenderNodeWrapper<WithAnyKey<C>>; /** Renders a component after the `Container` component. */ afterContainer?: EditableSiblingComponent; /** * Renders a component after the `Editable` component. This is the last * render position within the editor structure. */ afterEditable?: EditableSiblingComponent; /** Renders a component before the `Container` component. */ beforeContainer?: EditableSiblingComponent; /** Renders a component before the `Editable` component. */ beforeEditable?: EditableSiblingComponent; /** * When other plugins' node components are rendered, this function can * return an optional wrapper function that turns a node's props to a * wrapper React node. The wrapper node is the node's child and its * original children's parent. Useful for wrapping or decorating nodes * with additional UI elements. * * NOTE: The function can run React hooks. NOTE: Do not run React hooks * in the wrapper function. It is not equivalent to a React component. */ belowNodes?: RenderNodeWrapper<WithAnyKey<C>>; /** * Function to render content below the root element but above its * children. Similar to belowNodes but renders directly in the element * rather than wrapping. Multiple plugins can provide this, and all * their content will be rendered in sequence. */ belowRootNodes?: (props: PlateElementProps<TElement, C>) => React$1.ReactNode; }>; rules: { /** * Function to determine if this plugin's rules should apply to a node. * Used to override behavior based on node properties beyond just type * matching. * * Example: List plugin sets `match: ({ node }) => !!node.listStyleType` * to override paragraph behavior when the paragraph is a list item. * * @default type === node.type */ match?: (options: { node: TElement; path: Path; rule: MatchRules; } & PlatePluginContext<C>) => boolean; }; /** * Keyboard shortcuts configuration mapping shortcut names to their key * combinations and handlers. Each shortcut can link to a transform * method, an API method, or use a custom handler function. */ shortcuts: Partial<Record<(string & {}) | Exclude<keyof InferApi<C>[C['key']], keyof InferTransforms<C>[C['key']]> | keyof InferTransforms<C>[C['key']], Shortcut | null>>; useOptionsStore: TCreatedStoreType<C['options'], [ ['zustand/mutative-x', never] ]>; }; type PlatePluginConfig<K extends string = any, O = {}, A = {}, T = {}, S = {}, EO = {}, EA = {}, ET = {}, ES = {}> = Partial<Omit<PlatePlugin<PluginConfig<K, Partial<O>, A, T, S>>, keyof PlatePluginMethods | 'api' | 'node' | 'optionsStore' | 'transforms' | 'useOptionsStore'> & { api: EA; node: Partial<PlatePlugin<PluginConfig<K, O, A, T, S>>['node']>; options: EO; selectors: ES; transforms: ET; }>; type PlatePluginContext<C extends AnyPluginConfig = PluginConfig, E extends PlateEditor = PlateEditor> = BasePluginContext<C> & { editor: E; plugin: EditorPlatePlugin<C>; }; type PlatePluginMethods<C extends AnyPluginConfig = PluginConfig> = { __apiExtensions: ((ctx: PlatePluginContext<AnyPluginConfig>) => any)[]; __configuration: ((ctx: PlatePluginContext<AnyPluginConfig>) => any) | null; __extensions: ((ctx: PlatePluginContext<AnyPluginConfig>) => any)[]; __selectorExtensions: ((ctx: PlatePluginContext<AnyPluginConfig>) => any)[]; clone: () => PlatePlugin<C>; configure: (config: ((ctx: PlatePluginContext<C>) => PlatePluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>>) | PlatePluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>>) => PlatePlugin<C>; configurePlugin: <P extends AnyPlatePlugin | AnySlatePlugin>(plugin: Partial<P>, config: (P extends AnyPlatePlugin ? PlatePluginConfig<any, InferOptions<P>, InferApi<P>, InferTransforms<P>, InferSelectors<P>> : SlatePluginConfig<any, InferOptions<P>, InferApi<P>, InferTransforms<P>, InferSelectors<P>>) | ((ctx: P extends AnyPlatePlugin ? PlatePluginContext<P> : SlatePluginContext<P>) => P extends AnyPlatePlugin ? PlatePluginConfig<any, InferOptions<P>, InferApi<P>, InferTransforms<P>, InferSelectors<P>> : SlatePluginConfig<any, InferOptions<P>, InferApi<P>, InferTransforms<P>, InferSelectors<P>>)) => PlatePlugin<C>; extend: <EO = {}, EA = {}, ET = {}, ES = {}>(extendConfig: ((ctx: PlatePluginContext<C>) => PlatePluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>, EO, EA, ET, ES>) | PlatePluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>, EO, EA, ET, ES>) => PlatePlugin<PluginConfig<C['key'], EO & InferOptions<C>, EA & InferApi<C>, ET & InferTransforms<C>, InferSelectors<C>>>; extendApi: <EA extends Record<string, (...args: any[]) => any> = Record<string, never>>(extension: (ctx: PlatePluginContext<C>) => EA) => PlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C> & Record<C['key'], EA>, InferTransforms<C>, InferSelectors<C>>>; /** * Extends the plugin's API with new methods or nested objects. * * This method allows you to add new functionality to the plugin's API or * extend existing ones. You can add top-level methods, nested objects with * methods, or extend existing nested objects. The types of existing methods * and nested objects are preserved, while new ones are inferred. * * @remarks * - New methods can be added at the top level or within nested objects. * - Existing methods can be overridden, but their parameter and return types * must match the original. * - When extending nested objects, you don't need to specify all existing * properties; they will be preserved. * - Only one level of nesting is supported for API objects. * * @example * ```typescript * const extendedPlugin = basePlugin.extendEditorApi(({ plugin }) => ({ * newMethod: (param: string) => param.length, * existingMethod: (n) => n * 2, // Must match original signature * nested: { * newNestedMethod: () => 'new nested method', * }, * })); * ```; * * @template EA - The type of the extended API, inferred from the returned * object. * @param extendedApi - A function that returns an object with the new or * extended API methods. * @returns A new instance of the plugin with the extended API. */ extendEditorApi: <EA extends Record<string, ((...args: any[]) => any) | Record<string, (...args: any[]) => any>> = Record<string, never>>(extension: ExtendEditorApi<C, EA>) => PlatePlugin<PluginConfig<C['key'], InferOptions<C>, { [K in keyof (EA & InferApi<C>)]: (EA & InferApi<C>)[K] extends (...args: any[]) => any ? (EA & InferApi<C>)[K] : { [N in keyof (EA & InferApi<C>)[K]]: (EA & InferApi<C>)[K][N]; }; }, InferTransforms<C>, InferSelectors<C>>>; extendEditorTransforms: <ET extends Record<string, ((...args: any[]) => any) | Record<string, (...args: any[]) => any>> = Record<string, never>>(extension: ExtendEditorTransforms<C, ET>) => PlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C>, { [K in keyof (ET & InferTransforms<C>)]: (ET & InferTransforms<C>)[K] extends (...args: any[]) => any ? (ET & InferTransforms<C>)[K] : { [N in keyof (ET & InferTransforms<C>)[K]]: (ET & InferTransforms<C>)[K][N]; }; }, InferSelectors<C>>>; extendPlugin: <P extends AnyPlatePlugin | AnySlatePlugin, EO = {}, EA = {}, ET = {}>(plugin: Partial<P>, extendConfig: (P extends AnyPlatePlugin ? PlatePluginConfig<any, InferOptions<P>, InferApi<P>, InferTransforms<P>, InferSelectors<P>, EO, EA, ET> : SlatePluginConfig<any, InferOptions<P>, InferApi<P>, InferTransforms<P>, InferSelectors<P>, EO, EA, ET>) | ((ctx: P extends AnyPlatePlugin ? PlatePluginContext<P> : SlatePluginContext<P>) => P extends AnyPlatePlugin ? PlatePluginConfig<any, InferOptions<P>, InferApi<P>, InferTransforms<P>, InferSelectors<P>, EO, EA, ET> : SlatePluginConfig<any, InferOptions<P>, InferApi<P>, InferTransforms<P>, InferSelectors<P>, EO, EA, ET>)) => PlatePlugin<C>; extendSelectors: <ES extends Record<string, (...args: any[]) => any> = Record<string, never>>(extension: (ctx: PlatePluginContext<C>) => ES) => PlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, ES & InferSelectors<C>>>; extendTransforms: <ET extends Record<string, (...args: any[]) => any> = Record<string, never>>(extension: (ctx: PlatePluginContext<C>) => ET) => PlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C> & Record<C['key'], ET>, InferSelectors<C>>>; overrideEditor: (override: OverrideEditor<C>) => PlatePlugin<C>; /** Returns a new instance of the plugin with the component. */ withComponent: (component: NodeComponent) => PlatePlugin<C>; __resolved?: boolean; }; type PlatePlugins = AnyPlatePlugin[]; type RenderNodeWrapper<C extends AnyPluginConfig = PluginConfig> = (props: RenderNodeWrapperProps<C>) => RenderNodeWrapperFunction; type RenderNodeWrapperFunction = ((elementProps: PlateElementProps) => React$1.ReactNode) | undefined; interface RenderNodeWrapperProps<C extends AnyPluginConfig = PluginConfig> extends PlateElementProps<TElement, C> { key: string; } type Serializer<C extends AnyPluginConfig = PluginConfig> = BaseSerializer & { parser?: (options: PlatePluginContext<C> & { node: Descendant; }) => any; query?: (options: PlatePluginContext<C> & { node: Descendant; }) => boolean; }; type Shortcut = HotkeysOptions & { keys?: Keys | null; priority?: number; handler?: (ctx: { editor: PlateEditor; event: KeyboardEvent; eventDetails: HotkeysEvent; }) => boolean | void; }; type Shortcuts = Record<string, Shortcut | null>; type TextNodeProps<C extends AnyPluginConfig = PluginConfig> = ((props: PlateLeafProps<TText, C>) => AnyObject | undefined) | AnyObject; type TransformOptions<C extends AnyPluginConfig = PluginConfig> = BaseTransformOptions & PlatePluginContext<C>; /** Hook called when the editor is initialized. */ type UseHooks<C extends AnyPluginConfig = PluginConfig> = (ctx: PlatePluginContext<C>) => void; declare function EditorRefPluginEffect({ id, plugin, }: { plugin: AnyEditorPlatePlugin; id?: string; }): null; declare function EditorRefEffect({ id }: { id?: string; }): React$1.JSX.Element; /** * Get the element by plugin key. If no element is found in the context, it will * return an empty object. */ declare const useElement: <T extends TElement = TElement>(pluginKey?: string) => T; interface UseElementSelectorOptions<T> { key?: string; equalityFn?: (a: T, b: T) => boolean; } declare const useElementSelector: <T>(selector: <N extends TElement>(state: NodeEntry<N>, prev?: T) => T, deps: React$1.DependencyList, { key, equalityFn, }?: UseElementSelectorOptions<T>) => T; declare const SCOPE_ELEMENT = "element"; type ElementStoreState = { element: TElement; entry: ElementEntry; path: Path; }; declare const ElementProvider: React$1.FC<jotai_x.ProviderProps<{ element: TElement; entry: ElementEntry; path: Path; }>>; declare const elementStore: jotai_x.StoreApi<ElementStoreState, object, "element">; declare const useElementStore: jotai_x.UseStoreApi<ElementStoreState, object>; /** Get the memoized path of the closest element. */ declare const usePath: