import * as _platejs_slate1 from "@platejs/slate"; import { Ancestor, DOMRange, DecoratedRange, Descendant, Editor, EditorAboveOptions, EditorApi, EditorBase, EditorTransforms, InsertTextOptions, LeafPosition, NodeEntry, NodeOf, NodeOperation, Operation, Path, PathRef, Point, QueryNodeOptions, ScrollIntoViewOptions, TElement, TNode, TRange, TSelection, TText, TextOperation, Value } from "@platejs/slate"; import { nanoid as nanoid$1 } from "nanoid"; import { AnyObject, Deep2Partial, Modify, Nullable, OmitFirst, UnionToIntersection, UnknownObject } from "@udecode/utils"; import { createVanillaStore, createVanillaStore as createZustandStore$1 } from "zustand-x/vanilla"; import { KeyboardEventLike, isHotkey } from "is-hotkey"; import { NodeEntry as NodeEntry$1 } from "slate"; import React$1, { JSX } from "react"; import { TStateApi, TStateApi as ZustandStoreApi } from "zustand-x"; import { Draft } from "mutative"; //#region src/lib/plugins/AstPlugin.d.ts /** * Enables support for deserializing inserted content from Slate Ast format to * Slate format while apply a small bug fix. */ declare const AstPlugin: SlatePlugin>; //#endregion //#region src/lib/plugin/HandlerReturnType.d.ts /** If true, the next handlers will be skipped. */ type HandlerReturnType = boolean | void; //#endregion //#region src/static/pluginRenderElementStatic.d.ts type SlateRenderElement = (props: RenderElementProps) => React$1.ReactElement | undefined; declare const pluginRenderElementStatic: (editor: SlateEditor, plugin: AnyEditorPlugin) => SlateRenderElement; //#endregion //#region src/static/pipeRenderElementStatic.d.ts declare const pipeRenderElementStatic: (editor: SlateEditor, { renderElement: renderElementProp }?: { renderElement?: SlateRenderElement; }) => SlateRenderElement; //#endregion //#region src/static/pluginRenderLeafStatic.d.ts type SlateRenderLeaf = (props: RenderLeafProps) => React$1.ReactElement | undefined; declare const pluginRenderLeafStatic: (editor: SlateEditor, plugin: SlatePlugin) => SlateRenderLeaf; /** @see {@link RenderLeaf} */ declare const pipeRenderLeafStatic: (editor: SlateEditor, { renderLeaf: renderLeafProp }?: { renderLeaf?: SlateRenderLeaf; }) => SlateRenderLeaf; //#endregion //#region src/static/pluginRenderTextStatic.d.ts type SlateRenderText = (props: RenderTextProps) => React$1.ReactElement | undefined; declare const pluginRenderTextStatic: (editor: SlateEditor, plugin: SlatePlugin) => SlateRenderText; /** @see {@link RenderText} */ declare const pipeRenderTextStatic: (editor: SlateEditor, { renderText: renderTextProp }?: { renderText?: SlateRenderText; }) => SlateRenderText; //#endregion //#region src/static/components/PlateStatic.d.ts declare function BaseElementStatic({ decorate, decorations, editor, element, path }: { decorate: EditableProps['decorate']; decorations: DecoratedRange[]; editor: SlateEditor; element: TElement; path: Path; style?: React$1.CSSProperties; }): React$1.JSX.Element; declare const ElementStatic: React$1.MemoExoticComponent; declare function BaseLeafStatic({ decorations, editor, path, text }: { decorations: DecoratedRange[]; editor: SlateEditor; path: Path; text: TText; }): React$1.ReactElement> | undefined; declare const LeafStatic: React$1.MemoExoticComponent; type PlateStaticProps = { /** Editor instance. */ editor: SlateEditor; style?: React$1.CSSProperties; /** Controlled value. Alias to `editor.children`. */ value?: Value; } & React$1.HTMLAttributes; declare function PlateStatic(props: PlateStaticProps): React$1.ReactElement>; //#endregion //#region src/static/serializeHtml.d.ts type SerializeHtmlOptions = { /** The component used to render the editor content */ editorComponent?: React$1.ComponentType; /** List of className prefixes to preserve from being stripped out */ preserveClassNames?: string[]; /** Props to pass to the editor component */ props?: Partial; /** Enable stripping class names */ stripClassNames?: boolean; /** Enable stripping data attributes */ stripDataAttributes?: boolean; }; /** * Serialize the editor content to HTML. By default, uses `PlateStatic` as the * editor component, but you can provide a custom component (e.g. * `EditorStatic`). */ declare const serializeHtml: (editor: SlateEditor, { editorComponent: EditorComponent, preserveClassNames, props, stripClassNames, stripDataAttributes }?: SerializeHtmlOptions) => Promise; //#endregion //#region src/static/types.d.ts type BoxStaticProps = React.ComponentProps<'div'> & { as?: React.ElementType; }; type SlateRenderElementProps = SlateRenderNodeProps & RenderElementProps; type SlateRenderLeafProps = SlateRenderNodeProps & RenderLeafProps; type SlateRenderNodeProps = SlatePluginContext & { attributes?: AnyObject; className?: string; /** @see {@link NodeProps} */ nodeProps?: AnyObject; }; type SlateRenderTextProps = SlateRenderNodeProps & RenderTextProps; //#endregion //#region src/static/components/slate-nodes.d.ts declare const useNodeAttributes: (props: any, ref?: any) => any; type SlateElementProps = SlateNodeProps & RenderElementProps & { attributes: UnknownObject; path: Path; } & DeprecatedNodeProps; type DeprecatedNodeProps = { /** * @deprecated Optional class to be merged with `attributes.className`. * @default undefined */ className?: string; /** * @deprecated Optional style to be merged with `attributes.style` * @default undefined */ style?: React$1.CSSProperties; }; type SlateNodeProps = SlatePluginContext & { /** * Optional ref to be merged with `attributes.ref` * * @default undefined */ ref?: any; }; type SlateHTMLProps = SlateNodeProps & { /** HTML attributes to pass to the underlying HTML element */ attributes: React$1.PropsWithoutRef & UnknownObject; as?: T; /** Class to be merged with `attributes.className` */ className?: string; /** Style to be merged with `attributes.style` */ style?: React$1.CSSProperties; }; type StyledSlateElementProps = Omit, keyof DeprecatedNodeProps> & SlateHTMLProps; declare const SlateElement: (props: StyledSlateElementProps) => React$1.ReactElement; type SlateTextProps = SlateNodeProps & RenderTextProps & DeprecatedNodeProps & { attributes: UnknownObject; }; type StyledSlateTextProps = Omit, keyof DeprecatedNodeProps> & SlateHTMLProps; declare const SlateText: (props: StyledSlateTextProps) => React$1.ReactElement; type SlateLeafProps = SlateNodeProps & RenderLeafProps & DeprecatedNodeProps & { attributes: UnknownObject; inset?: boolean; }; type StyledSlateLeafProps = Omit, keyof DeprecatedNodeProps> & SlateHTMLProps; declare const SlateLeaf: ({ className, ...props }: StyledSlateLeafProps) => React$1.ReactElement; //#endregion //#region src/static/deserialize/htmlStringToEditorDOM.d.ts /** * Convert HTML string exported from Plate into HTML element. * * @param html - The HTML string to convert exported from Plate. * @returns The Editor element without head and body. */ declare const getEditorDOMFromHtmlString: (html: string) => HTMLElement; //#endregion //#region src/static/editor/withStatic.d.ts type CreateStaticEditorOptions = CreateSlateEditorOptions & {}; declare const createStaticEditor: ({ editor, ...options }?: CreateStaticEditorOptions) => TSlateEditor; //#endregion //#region src/static/plugins/ViewPlugin.d.ts declare const ViewPlugin: SlatePlugin _platejs_slate1.Descendant[]; isScrolling: () => boolean; }, { withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void; }, {}>>; //#endregion //#region src/static/plugins/getStaticPlugins.d.ts declare const getStaticPlugins: () => SlatePlugin _platejs_slate1.Descendant[]; isScrolling: () => boolean; }, { withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void; }, {}>>[]; //#endregion //#region src/static/utils/createStaticString.d.ts declare function createStaticString({ text }: { text: string; }): React$1.ReactElement<{ 'data-slate-string': boolean; }, string | React$1.JSXElementConstructor>; //#endregion //#region src/static/utils/getNodeDataAttributes.d.ts declare const getNodeDataAttributes: (editor: SlateEditor, node: TElement | TText, { isElement, isLeaf, isText }: { isElement?: boolean; isLeaf?: boolean; isText?: boolean; }) => Record; declare const getPluginDataAttributes: (editor: SlateEditor, plugin: AnyEditorPlugin, node: TElement | TText) => { [x: string]: any; }; //#endregion //#region src/static/utils/getRenderNodeStaticProps.d.ts declare const getRenderNodeStaticProps: ({ attributes: nodeAttributes, editor, node, path, plugin, props }: { editor: SlateEditor; props: SlateRenderNodeProps; attributes?: AnyObject; node?: TElement | TText; /** Pre-computed path to avoid expensive findPath traversal */ path?: Path; plugin?: AnyEditorPlugin; }) => SlateRenderNodeProps; //#endregion //#region src/static/utils/getSelectedDomBlocks.d.ts /** Get the slate nodes from the DOM selection */ /** @deprecated Use getSelectedDomFragment instead */ declare const getSelectedDomBlocks: () => Element[] | undefined; //#endregion //#region src/static/utils/getSelectedDomFragment.d.ts declare const getSelectedDomFragment: (editor: SlateEditor) => Descendant[]; //#endregion //#region src/static/utils/getSelectedDomNode.d.ts /** Get the DOM node from the DOM selection */ declare const getSelectedDomNode: () => HTMLDivElement | undefined; //#endregion //#region src/static/utils/isSelectOutside.d.ts /** Check if the DOM selection is outside the editor */ declare const isSelectOutside: (html?: HTMLElement) => boolean; //#endregion //#region src/static/utils/pipeDecorate.d.ts /** * @see {@link Decorate} . * Optimization: return undefined if empty list so Editable uses a memo. */ declare const pipeDecorate: (editor: SlateEditor, decorateProp?: ((ctx: { editor: SlateEditor; entry: NodeEntry; }) => TRange[] | undefined) | null) => EditableProps["decorate"]; //#endregion //#region src/static/utils/stripHtmlClassNames.d.ts /** * Remove all class names that do not start with one of preserveClassNames * (`slate-` by default) */ declare const stripHtmlClassNames: (html: string, { preserveClassNames }: { preserveClassNames?: string[]; }) => string; //#endregion //#region src/static/utils/stripSlateDataAttributes.d.ts declare const stripSlateDataAttributes: (rawHtml: string) => string; //#endregion //#region src/lib/plugins/input-rules/types.d.ts type InputRuleTarget = 'insertBreak' | 'insertData' | 'insertText'; type BivariantCallback$1 = { bivarianceHack: (...args: TArgs) => TResult; }['bivarianceHack']; type SelectionInputRuleContext = { editor: TEditor; getBlockEntry: () => NodeEntry | undefined; getBlockStartRange: () => TRange | undefined; getBlockStartText: () => string | undefined; getBlockTextBeforeSelection: () => string; getCharAfter: () => string | undefined; getCharBefore: () => string | undefined; isCollapsed: boolean; pluginKey: string; }; type InsertBreakInputRuleContext = SelectionInputRuleContext & { cause: 'insertBreak'; insertBreak: () => void; }; type InsertDataInputRuleContext = SelectionInputRuleContext & { cause: 'insertData'; data: DataTransfer; insertData: (data: DataTransfer) => void; text: string | null; }; type InsertTextInputRuleContext = SelectionInputRuleContext & { cause: 'insertText'; insertText: (text: string, options?: InsertTextOptions) => void; options?: InsertTextOptions; text: string; }; type BaseInputRule = { enabled?: BivariantCallback$1<[context: TContext], boolean>; priority?: number; }; type MarkInputRuleConfig = BaseInputRule & { end?: string; mark?: string; marks?: string[]; start: string; trim?: 'allow' | 'reject'; trigger: string; }; type BlockStartInputRuleMatch = { range: TRange; text: string; }; type MatchBlockStartOptions = { match: RegExp | string | ((context: TContext) => RegExp | string | undefined); resolveMatch?: (args: { match: RegExpMatchArray | string; range: TRange; text: string; }) => TMatch | undefined; }; type BlockStartInputRuleConfig = BaseInputRule & { apply?: (context: InsertTextInputRuleContext, match: BlockStartInputRuleMatch & TMatch) => boolean | void; mode?: 'set' | 'toggle' | 'wrap'; node?: string; removeMatchedText?: boolean; trigger: string; } & MatchBlockStartOptions; type BlockFenceInputRuleMatch = BlockStartInputRuleMatch & { path: Path; }; type MatchBlockFenceOptions = { block?: string; fence: string; resolveMatch?: (args: { fence: string; path: Path; range: TRange; text: string; }) => TMatch | undefined; }; type BlockFenceInputRuleConfig = BaseInputRule & MatchBlockFenceOptions & { apply: (context: SelectionInputRuleContext, match: TMatch) => boolean | void; on: 'break' | 'match'; }; type DelimitedInlineInputRuleMatch = { content: string; deleteRange: TRange; }; type MatchDelimitedInlineOptions = { boundaryRe?: RegExp; close?: string; followRe?: RegExp; open: string; rejectRepeatedOpen?: boolean; requireClosingDelimiter?: boolean; trim?: 'allow' | 'reject'; }; type TextSubstitutionPattern = { format: readonly [string, string] | string; match: readonly string[] | string; trigger?: readonly string[] | string; }; type TextSubstitutionMatch = { end: string; pattern: TextSubstitutionPattern; points: { afterStartMatchPoint: Point | undefined; beforeEndMatchPoint: Point; beforeStartMatchPoint: Point | undefined; }; }; type TextSubstitutionInputRuleConfig = BaseInputRule & { patterns: TextSubstitutionPattern[]; }; type InputRuleBuilder = { blockFence: (config: BlockFenceInputRuleConfig) => AnyInputRule; blockStart: (config: BlockStartInputRuleConfig) => InsertTextInputRule; insertBreak: (rule: InsertBreakInputRule) => InsertBreakInputRule; insertData: (rule: InsertDataInputRule) => InsertDataInputRule; insertText: (rule: InsertTextInputRule) => InsertTextInputRule; mark: (config: MarkInputRuleConfig) => InsertTextInputRule<{ afterStartMatchPoint: Point; beforeEndMatchPoint: Point; beforeStartMatchPoint: Point; end: string | undefined; }>; }; type InputRulesFactoryContext = { rule: InputRuleBuilder; }; type InsertBreakInputRule = BaseInputRule> & { apply: BivariantCallback$1<[context: InsertBreakInputRuleContext, match: TMatch], boolean | void>; resolve?: BivariantCallback$1<[context: InsertBreakInputRuleContext], TMatch | undefined>; target: 'insertBreak'; }; type InsertDataInputRule = BaseInputRule> & { apply: BivariantCallback$1<[context: InsertDataInputRuleContext, match: TMatch], boolean | void>; mimeTypes?: string[]; resolve?: BivariantCallback$1<[context: InsertDataInputRuleContext], TMatch | undefined>; target: 'insertData'; }; type InsertTextInputRule = BaseInputRule> & { apply: BivariantCallback$1<[context: InsertTextInputRuleContext, match: TMatch], boolean | void>; resolve?: BivariantCallback$1<[context: InsertTextInputRuleContext], TMatch | undefined>; target: 'insertText'; trigger: readonly string[] | string; }; type AnyInputRule = InsertBreakInputRule | InsertDataInputRule | InsertTextInputRule; type StoredInsertBreakInputRule = BaseInputRule & { apply: BivariantCallback$1<[context: InsertBreakInputRuleContext, match: unknown], boolean | void>; resolve?: BivariantCallback$1<[context: InsertBreakInputRuleContext], unknown>; target: 'insertBreak'; }; type StoredInsertDataInputRule = BaseInputRule & { apply: BivariantCallback$1<[context: InsertDataInputRuleContext, match: unknown], boolean | void>; mimeTypes?: string[]; resolve?: BivariantCallback$1<[context: InsertDataInputRuleContext], unknown>; target: 'insertData'; }; type StoredInsertTextInputRule = BaseInputRule & { apply: BivariantCallback$1<[context: InsertTextInputRuleContext, match: unknown], boolean | void>; resolve?: BivariantCallback$1<[context: InsertTextInputRuleContext], unknown>; target: 'insertText'; trigger: readonly string[] | string; }; type StoredInputRule = StoredInsertBreakInputRule | StoredInsertDataInputRule | StoredInsertTextInputRule; type InputRulesDefinition = InputRulesConfig | ((ctx: InputRulesFactoryContext) => InputRulesConfig); type InputRulesConfig = AnyInputRule[]; type ResolvedInputRule = StoredInputRule & { id: string; pluginKey: string; priority: number; ruleIndex: number; pluginIndex: number; }; type ResolvedInputRulesMeta = { insertBreak: Extract[]; insertData: Extract[]; insertText: { all: Extract[]; byTrigger: Record[]>; }; plugins: Record; }; //#endregion //#region src/lib/plugin/SlatePlugin.d.ts type AnyEditorPlugin = EditorPlugin; type AnySlatePlugin = SlatePlugin; /** * 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 = (ctx: SlatePluginContext & { entry: NodeEntry; }) => DecoratedRange[] | undefined; type Deserializer = BaseDeserializer & { parse?: (options: AnyObject & SlatePluginContext & { element: any; }) => Partial | undefined | void; query?: (options: AnyObject & SlatePluginContext & { element: any; }) => boolean; }; type EditorPlugin = Omit, keyof SlatePluginMethods | 'override' | 'plugins'>; /** Plate plugin overriding the `editor` methods. Naming convention is `with*`. */ type ExtendEditor = (ctx: SlatePluginContext) => SlateEditor; type ExtendEditorApi = (ctx: SlatePluginContext) => EA & Deep2Partial & { [K in keyof InferApi]?: InferApi[K] extends ((...args: any[]) => any) ? (...args: Parameters[K]>) => ReturnType[K]> : InferApi[K] extends Record any> ? { [N in keyof InferApi[K]]?: (...args: Parameters[K][N]>) => ReturnType[K][N]> } : never }; type ExtendEditorTransforms = (ctx: SlatePluginContext) => EA & Deep2Partial & { [K in keyof InferTransforms]?: InferTransforms[K] extends ((...args: any[]) => any) ? (...args: Parameters[K]>) => ReturnType[K]> : InferTransforms[K] extends Record any> ? { [N in keyof InferTransforms[K]]?: (...args: Parameters[K][N]>) => ReturnType[K][N]> } : never }; type HtmlDeserializer = BaseHtmlDeserializer & { /** * Whether to disable the default node props parsing logic. By default, all * data-slate-* attributes will be parsed into node props. * * @default false */ disableDefaultNodeProps?: boolean; parse?: (options: SlatePluginContext & { element: HTMLElement; node: AnyObject; }) => Partial | undefined | void; query?: (options: SlatePluginContext & { element: HTMLElement; }) => boolean; toNodeProps?: (options: SlatePluginContext & { element: HTMLElement; }) => Partial | undefined | void; }; type HtmlSerializer = BaseSerializer & { parse?: (options: SlatePluginContext & { node: Descendant; }) => string; query?: (options: SlatePluginContext & { node: Descendant; }) => boolean; }; type InferConfig

= P extends SlatePlugin ? C : never; type InjectNodeProps = BaseInjectProps & { query?: (options: NonNullable> & SlatePluginContext & { nodeProps: GetInjectNodePropsOptions; }) => boolean; transformClassName?: (options: TransformOptions) => any; transformNodeValue?: (options: TransformOptions) => any; transformProps?: (options: TransformOptions & { props: GetInjectNodePropsReturnType; }) => AnyObject | undefined; transformStyle?: (options: TransformOptions) => CSSStyleDeclaration; }; type LeafStaticProps = ((props: SlateRenderLeafProps) => AnyObject | undefined) | AnyObject; type NodeStaticProps = ((props: SlateRenderElementProps & SlateRenderLeafProps) => AnyObject | undefined) | AnyObject; /** @deprecated Use {@link RenderStaticNodeWrapper} instead. */ type NodeStaticWrapperComponent = (props: NodeStaticWrapperComponentProps) => NodeStaticWrapperComponentReturnType; /** @deprecated Use {@link RenderStaticNodeWrapperProps} instead. */ interface NodeStaticWrapperComponentProps extends SlateRenderElementProps { key: string; } /** @deprecated Use {@link RenderStaticNodeWrapperFunction} instead. */ type NodeStaticWrapperComponentReturnType = React.FC> | undefined; type TransformInitialValue = (ctx: SlatePluginContext & { value: Value; }) => Value; /** @deprecated Use {@link TransformInitialValue} instead. */ type NormalizeInitialValue = (ctx: SlatePluginContext & { value: Value; }) => Value | void; type OverrideEditor = (ctx: SlatePluginContext) => { api?: Deep2Partial & { [K in keyof InferApi]?: InferApi[K] extends ((...args: any[]) => any) ? (...args: Parameters[K]>) => ReturnType[K]> : InferApi[K] extends Record any> ? { [N in keyof InferApi[K]]?: (...args: Parameters[K][N]>) => ReturnType[K][N]> } : never }; transforms?: Deep2Partial & { [K in keyof InferTransforms]?: InferTransforms[K] extends ((...args: any[]) => any) ? (...args: Parameters[K]>) => ReturnType[K]> : InferTransforms[K] extends Record any> ? { [N in keyof InferTransforms[K]]?: (...args: Parameters[K][N]>) => ReturnType[K][N]> } : never }; }; type Parser = { format?: string[] | string; mimeTypes?: string[]; deserialize?: (options: ParserOptions & SlatePluginContext) => Descendant[] | undefined; preInsert?: (options: ParserOptions & SlatePluginContext & { fragment: Descendant[]; }) => HandlerReturnType; query?: (options: ParserOptions & SlatePluginContext) => boolean; transformData?: (options: ParserOptions & SlatePluginContext) => string; transformFragment?: (options: ParserOptions & SlatePluginContext & { fragment: Descendant[]; }) => Descendant[]; }; type PartialEditorPlugin = Omit>, 'node'> & { node?: Partial['node']>; }; type RenderStaticNodeWrapper = (props: RenderStaticNodeWrapperProps) => RenderStaticNodeWrapperFunction; type RenderStaticNodeWrapperFunction = ((hocProps: SlateRenderElementProps) => React.ReactNode) | undefined; interface RenderStaticNodeWrapperProps extends SlateRenderElementProps { key: string; } type Serializer = BaseSerializer & { parse?: (options: AnyObject & SlatePluginContext & { node: Descendant; }) => any; query?: (options: AnyObject & SlatePluginContext & { node: Descendant; }) => boolean; }; /** The `PlatePlugin` interface is a base interface for all plugins. */ type SlatePlugin = BasePlugin & Nullable<{ decorate?: Decorate>; extendEditor?: ExtendEditor>; transformInitialValue?: TransformInitialValue>; /** @deprecated Use `transformInitialValue` instead. */ normalizeInitialValue?: NormalizeInitialValue>; }> & SlatePluginMethods & { handlers: Nullable<{ onNodeChange?: (ctx: SlatePluginContext & { node: Descendant; operation: NodeOperation; prevNode: Descendant; }) => HandlerReturnType; onTextChange?: (ctx: SlatePluginContext & { node: Descendant; operation: TextOperation; prevText: string; text: string; }) => HandlerReturnType; }>; inject: Nullable<{ nodeProps?: InjectNodeProps>; plugins?: Record>; targetPluginToInject?: (ctx: SlatePluginContext & { targetPlugin: string; }) => Partial>; }>; node: { /** Override `data-slate-leaf` element attributes */ leafProps?: LeafStaticProps>; /** Override node attributes */ props?: NodeStaticProps>; /** Override `data-slate-node="text"` element attributes */ textProps?: TextStaticProps>; }; override: { components?: NodeComponents; plugins?: Record>; }; parser: Nullable>>; parsers: (Record>; serializer?: Serializer>; }> & { html?: never; }) | { html?: Nullable<{ deserializer?: HtmlDeserializer>; serializer?: HtmlSerializer>; }>; }; /** * 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?: RenderStaticNodeWrapper>; /** * 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?: RenderStaticNodeWrapper>; /** Renders a component above the main Slate component, as its sibling. */ aboveSlate?: () => React.ReactElement | null; /** Renders a component after the main editor container. */ afterContainer?: () => React.ReactElement | null; /** * Renders a component after the `Editable` component. This is the last * render position within the editor structure. */ afterEditable?: () => React.ReactElement | null; /** Renders a component before the main editor container. */ beforeContainer?: () => React.ReactElement | null; /** Renders a component before the `Editable` component. */ beforeEditable?: () => React.ReactElement | null; /** * 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: SlateElementProps) => React.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; } & SlatePluginContext) => 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[C['key']], keyof InferTransforms[C['key']]> | keyof InferTransforms[C['key']], SlateShortcut | null>>; inputRules: InputRulesDefinition | InputRulesConfig; }; type SlatePluginConfig$1 = Partial, A, T, S>>, keyof SlatePluginMethods | 'api' | 'node' | 'optionsStore' | 'transforms'> & { api: EA; node: Partial; options: EO; selectors: ES; transforms: ET; }>; type SlatePluginContext = BasePluginContext & { editor: SlateEditor; plugin: EditorPlugin; }; type SlatePluginMethods = { __apiExtensions: ((ctx: SlatePluginContext) => any)[]; __configuration: ((ctx: SlatePluginContext) => any) | null; __extensions: ((ctx: SlatePluginContext) => any)[]; __selectorExtensions: ((ctx: SlatePluginContext) => any)[]; clone: () => SlatePlugin; configure: (config: ((ctx: SlatePluginContext) => SlatePluginConfig$1, InferApi, InferTransforms, InferSelectors>) | SlatePluginConfig$1, InferApi, InferTransforms, InferSelectors>) => SlatePlugin; configurePlugin:

(plugin: Partial

, config: ((ctx: SlatePluginContext

) => SlatePluginConfig$1, InferApi

, InferTransforms

, InferSelectors

>) | SlatePluginConfig$1, InferApi

, InferTransforms

, InferSelectors

>) => SlatePlugin; extend: (extendConfig: ((ctx: SlatePluginContext) => SlatePluginConfig$1, InferApi, InferTransforms, InferSelectors, EO, EA, ET, ES>) | SlatePluginConfig$1, InferApi, InferTransforms, InferSelectors, EO, EA, ET, ES>) => SlatePlugin, EA & InferApi, ET & InferTransforms, ES & InferSelectors>>; extendApi: any> = Record>(extension: (ctx: SlatePluginContext) => EA) => SlatePlugin, InferApi & Record, InferTransforms, InferSelectors>>; extendEditorApi: any) | Record any>> = Record>(extension: ExtendEditorApi) => SlatePlugin, { [K in keyof (EA & InferApi)]: (EA & InferApi)[K] extends ((...args: any[]) => any) ? (EA & InferApi)[K] : { [N in keyof (EA & InferApi)[K]]: (EA & InferApi)[K][N] } }, InferTransforms, InferSelectors>>; extendEditorTransforms: any) | Record any>> = Record>(extension: ExtendEditorTransforms) => SlatePlugin, InferApi, { [K in keyof (ET & InferTransforms)]: (ET & InferTransforms)[K] extends ((...args: any[]) => any) ? (ET & InferTransforms)[K] : { [N in keyof (ET & InferTransforms)[K]]: (ET & InferTransforms)[K][N] } }, InferSelectors>>; extendPlugin:

(plugin: Partial

, extendConfig: ((ctx: SlatePluginContext

) => SlatePluginConfig$1, InferApi

, InferTransforms

, InferSelectors

, EO, EA, ET, ES>) | SlatePluginConfig$1, InferApi

, InferTransforms

, InferSelectors

, EO, EA, ET, ES>) => SlatePlugin; extendSelectors: any> = Record>(extension: (ctx: SlatePluginContext) => ES) => SlatePlugin, InferApi, InferTransforms, ES & InferSelectors>>; extendTransforms: any> = Record>(extension: (ctx: SlatePluginContext) => ET) => SlatePlugin, InferApi, InferTransforms & Record, InferSelectors>>; overrideEditor: (override: OverrideEditor) => SlatePlugin; /** Returns a new instance of the plugin with the component. */ withComponent: (component: NodeComponent) => SlatePlugin; __resolved?: boolean; }; type SlatePlugins = AnySlatePlugin[]; type TextStaticProps = ((props: SlateRenderTextProps) => AnyObject | undefined) | AnyObject; type TransformOptions = BaseTransformOptions & SlatePluginContext; type SlateShortcut = { keys?: (({} & string)[][] | readonly string[] | string) | null; delimiter?: string; description?: string; document?: Document; enabled?: Trigger; enableOnContentEditable?: boolean; enableOnFormTags?: boolean; ignoreEventWhenPrevented?: boolean; ignoreModifiers?: boolean; keydown?: boolean; keyup?: boolean; preventDefault?: Trigger; priority?: number; scopes?: readonly string[] | string; splitKey?: string; useKey?: boolean; handler?: (ctx: { editor: SlateEditor; event: KeyboardEvent; eventDetails: any; }) => boolean | void; ignoreEventWhen?: (e: KeyboardEvent) => boolean; }; type Trigger = ((keyboardEvent: KeyboardEvent, hotkeysEvent: any) => boolean) | boolean; //#endregion //#region src/lib/plugin/createSlatePlugin.d.ts type SlatePluginConfig = Omit>, { node?: Partial>['node']>; }>>, keyof SlatePluginMethods | 'optionsStore'>; type TSlatePluginConfig = Omit, { node?: Partial['node']>; }>>, keyof SlatePluginMethods | 'optionsStore'>; /** * Creates a new Plate plugin with the given configuration. * * @remarks * - The plugin's key is required and specified by the K generic. * - The `__extensions` array stores functions to be applied when `resolvePlugin` * is called with an editor. * - The `extend` method adds new extensions to be applied later. * - The `extendPlugin` method extends an existing plugin (including nested * plugins) or adds a new one if not found. * * @example * const myPlugin = createSlatePlugin< * 'myPlugin', * MyOptions, * MyApi, * MyTransforms * >({ * key: 'myPlugin', * options: { someOption: true }, * transforms: { someTransform: () => {} }, * }); * * const extendedPlugin = myPlugin.extend({ * options: { anotherOption: false }, * }); * * const pluginWithNestedExtension = extendedPlugin.extendPlugin( * nestedPlugin, * { options: { nestedOption: true } } * ); * * @template K - The literal type of the plugin key. * @template O - The type of the plugin options. * @template A - The type of the plugin utilities. * @template T - The type of the plugin transforms. * @template S - The type of the plugin storage. * @param {Partial>} config - The configuration * object for the plugin. * @returns {SlatePlugin} A new Plate plugin instance with the * following properties and methods: * * - All properties from the input config, merged with default values. * - `configure`: A method to create a new plugin instance with updated options. * - `extend`: A method to create a new plugin instance with additional * configuration. * - `extendPlugin`: A method to extend an existing plugin (including nested * plugins) or add a new one if not found. */ declare function createSlatePlugin(config?: ((editor: SlateEditor) => SlatePluginConfig) | SlatePluginConfig): SlatePlugin>; /** * Explicitly typed version of `createSlatePlugin`. * * @remarks * While `createSlatePlugin` 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 createTSlatePlugin(config?: ((editor: SlateEditor) => TSlatePluginConfig) | TSlatePluginConfig): SlatePlugin; //#endregion //#region src/lib/plugin/getEditorPlugin.d.ts declare function getEditorPlugin

>(editor: SlateEditor, p: WithRequiredKey

): SlatePluginContext extends never ? P : InferConfig

>; //#endregion //#region src/lib/plugin/getSlatePlugin.d.ts /** Get editor plugin by key or plugin object. */ declare function getSlatePlugin(editor: SlateEditor, p: WithRequiredKey): C extends { node: any; } ? C : SlatePlugin; /** Get editor plugin type by key or plugin object. */ declare function getPluginType(editor: SlateEditor, key: string): string; /** Get editor plugin types by key. */ declare const getPluginTypes: (editor: SlateEditor, keys: string[]) => string[]; declare const getPluginKey: (editor: SlateEditor, type: string) => string | undefined; declare const getPluginKeys: (editor: SlateEditor, types: string[]) => string[]; declare const getPluginByType: (editor: SlateEditor, type: string) => EditorPlugin | null; declare const getContainerTypes: (editor: SlateEditor) => string[]; //#endregion //#region src/lib/plugins/HistoryPlugin.d.ts declare const withPlateHistory: ExtendEditor; /** @see {@link withHistory} */ declare const HistoryPlugin: SlatePlugin>; //#endregion //#region src/lib/plugins/ParserPlugin.d.ts declare const ParserPlugin: SlatePlugin>; //#endregion //#region src/lib/plugins/slate-extension/transforms/init.d.ts type InitOptions = { autoSelect?: boolean | 'end' | 'start'; selection?: TSelection; shouldNormalizeEditor?: boolean; value?: any; onReady?: (ctx: { editor: SlateEditor; isAsync: boolean; value: Value; }) => void; }; declare const init: (editor: SlateEditor, { autoSelect, selection, shouldNormalizeEditor, value, onReady }: InitOptions) => void; //#endregion //#region src/lib/plugins/slate-extension/transforms/insertExitBreak.d.ts type InsertExitBreakOptions = { match?: EditorAboveOptions['match']; reverse?: boolean; }; /** * Exits the current block structure by creating a new block next to the * appropriate ancestor. * * This function automatically determines the exit point by finding the first * ancestor that doesn't have strict sibling constraints (`isStrictSiblings: * false`), allowing standard text blocks to be inserted as siblings. * * For example: * * - In `column_group > column > codeblock > codeline`, exits after `codeblock`, * then after `column_group` * - In `table > tr > td > p`, exits after `table` */ declare const insertExitBreak: (editor: SlateEditor, { match, reverse }?: InsertExitBreakOptions) => true | undefined; //#endregion //#region src/lib/plugins/slate-extension/transforms/liftBlock.d.ts type LiftBlockOptions = { at?: EditorAboveOptions['at']; match?: EditorAboveOptions['match']; }; /** * Lift the current block out of the nearest matching ancestor container. * * This unwraps only the current block and splits the ancestor around it when * needed, so one keypress changes one structural level instead of exploding the * whole container. */ declare const liftBlock: (editor: SlateEditor, { at, match }?: LiftBlockOptions) => true | undefined; //#endregion //#region src/lib/plugins/slate-extension/transforms/resetBlock.d.ts /** * Reset the current block to a paragraph, removing all properties except the * configured node id key and type. */ declare const resetBlock: (editor: SlateEditor, { at }?: { at?: Path; }) => true | undefined; //#endregion //#region src/lib/plugins/slate-extension/transforms/setValue.d.ts declare const setValue: (editor: SlateEditor, value?: V | string) => void; //#endregion //#region src/lib/plugins/slate-extension/SlateExtensionPlugin.d.ts declare const isElementStateEmpty: (editor: SlateEditor, element: TElement) => boolean; type SlateExtensionConfig = PluginConfig<'slateExtension', { onNodeChange: (options: { editor: SlateEditor; node: Descendant; operation: NodeOperation; prevNode: Descendant; }) => void; onTextChange: (options: { editor: SlateEditor; node: Descendant; operation: TextOperation; prevText: string; text: string; }) => void; }, { redecorate: () => void; }, { init: OmitFirst; insertExitBreak: OmitFirst; liftBlock: OmitFirst; resetBlock: OmitFirst; setValue: OmitFirst; }>; /** Opinionated extension of slate default behavior. */ declare const SlateExtensionPlugin: SlatePlugin void; onTextChange: (options: { editor: SlateEditor; node: Descendant; operation: TextOperation; prevText: string; text: string; }) => void; }, { isElementStateEmpty: (element: TElement) => boolean; redecorate: () => void; }, { init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void); insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined); liftBlock: ((args_0?: LiftBlockOptions | undefined) => true | undefined) & ((args_0?: LiftBlockOptions | undefined) => true | undefined); resetBlock: ((args_0?: { at?: _platejs_slate1.Path; } | undefined) => true | undefined) & ((args_0?: { at?: _platejs_slate1.Path; } | undefined) => true | undefined); setValue: ((value?: string | _platejs_slate1.Value | undefined) => void) & ((value?: string | _platejs_slate1.Value | undefined) => void); apply: (operation: _platejs_slate1.Operation) => void; }, {}>>; //#endregion //#region src/lib/plugins/dom/withScrolling.d.ts type WithAutoScrollOptions = { mode?: ScrollMode; operations?: AutoScrollOperationsMap; scrollOptions?: ScrollIntoViewOptions; }; declare const withScrolling: (editor: SlateEditor, fn: () => void, options?: WithAutoScrollOptions) => void; //#endregion //#region src/lib/plugins/dom/DOMPlugin.d.ts declare const AUTO_SCROLL: WeakMap; type AutoScrollOperationsMap = Partial>; type DomConfig = PluginConfig<'dom', { /** Choose the first or last matching operation as the scroll target */ scrollMode?: ScrollMode; /** * Operations map; false to disable an operation, true or undefined to * enable */ scrollOperations?: AutoScrollOperationsMap; /** Options passed to scrollIntoView */ scrollOptions?: ScrollIntoViewOptions; }>; /** Mode for picking target op when multiple enabled */ type ScrollMode = 'first' | 'last'; /** * Placeholder plugin for DOM interaction, that could be replaced with * ReactPlugin. */ declare const DOMPlugin: SlatePlugin boolean; }, { withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void; }, {}>>; //#endregion //#region src/lib/plugins/navigation-feedback/types.d.ts declare const NAVIGATION_FEEDBACK_KEY = "navigationFeedback"; declare const NavigationFeedbackPluginKey: { readonly key: "navigationFeedback"; }; type NavigationFeedbackTarget = { path: Path; type: 'node'; }; type NavigationFeedbackActiveTarget = NavigationFeedbackTarget & { cycle: 0 | 1; duration: number; pulse: number; variant: string; }; type NavigationFeedbackStoredTarget = Omit & { pathRef: PathRef; }; type NavigationFlashTargetOptions = { duration?: number; target: NavigationFeedbackTarget; variant?: string; }; type NavigationNavigateOptions = { flash?: false | { duration?: number; variant?: string; }; focus?: boolean; scroll?: boolean; scrollTarget?: Point; select?: Point | TRange; target: NavigationFeedbackTarget; }; type NavigationFeedbackConfig = PluginConfig NavigationFeedbackActiveTarget | null; clear: () => void; isTarget: (path: Path) => boolean; }; }, { navigation: { clear: () => void; flashTarget: (options: NavigationFlashTargetOptions) => boolean; navigate: (options: NavigationNavigateOptions) => boolean; }; }>; //#endregion //#region src/lib/plugins/navigation-feedback/NavigationFeedbackPlugin.d.ts declare const NavigationFeedbackPlugin: SlatePlugin NavigationFeedbackActiveTarget | null; clear: () => void; isTarget: (path: _platejs_slate1.Path) => boolean; }; }, { navigation: { clear: () => void; flashTarget: (options: NavigationFlashTargetOptions) => boolean; navigate: (options: NavigationNavigateOptions) => boolean; }; }, {}>>; //#endregion //#region src/lib/plugins/navigation-feedback/transforms/flashTarget.d.ts declare const resolveNavigationFeedbackTarget: (target?: NavigationFeedbackStoredTarget | null) => NavigationFeedbackActiveTarget | null; declare const clearNavigationFeedbackTarget: (editor: SlateEditor, pulse?: number) => boolean; declare const flashTarget: (editor: SlateEditor, { duration, target, variant }: NavigationFlashTargetOptions) => boolean; //#endregion //#region src/lib/plugins/navigation-feedback/transforms/navigate.d.ts declare const navigate: (editor: SlateEditor, { flash, focus, scroll, scrollTarget, select, target }: NavigationNavigateOptions) => boolean; //#endregion //#region src/lib/plugins/affinity/AffinityPlugin.d.ts type ElementAffinity = { affinity: 'backward' | 'forward'; at: Path; type: string; }; type AffinityConfig = PluginConfig<'affinity'>; declare const AffinityPlugin: SlatePlugin; //#endregion //#region src/lib/plugins/affinity/types.d.ts type EdgeNodes = [NodeEntry$1, NodeEntry$1] | [NodeEntry$1, null] | [null, NodeEntry$1]; //#endregion //#region src/lib/plugins/affinity/queries/getEdgeNodes.d.ts /** * When the cursor is at a mark edge, this function returns the inward node and * the outward node (if any). If the cursor is at the start of the text, then * the node before the text is returned. If the cursor is at the end of the * text, then the node after the text is returned. Otherwise, null is returned. */ declare const getEdgeNodes: (editor: SlateEditor) => EdgeNodes | null; //#endregion //#region src/lib/plugins/affinity/queries/getMarkBoundaryAffinity.d.ts declare const getMarkBoundaryAffinity: (editor: SlateEditor, markBoundary: EdgeNodes) => "backward" | "forward" | undefined; //#endregion //#region src/lib/plugins/affinity/queries/isNodeAffinity.d.ts declare const isNodeAffinity: (editor: SlateEditor, node: TElement | TText, affinity: "directional" | "hard" | "outward") => boolean; declare const isNodesAffinity: (editor: SlateEditor, edgeNodes: EdgeNodes, affinity: "directional" | "hard" | "outward") => boolean | null; //#endregion //#region src/lib/plugins/affinity/transforms/setAffinitySelection.d.ts declare const setAffinitySelection: (editor: SlateEditor, edgeNodes: EdgeNodes, affinity: "backward" | "forward") => void; //#endregion //#region src/lib/plugins/debug/DebugPlugin.d.ts type DebugErrorType = (string & {}) | 'DEFAULT' | 'OPTION_UNDEFINED' | 'OVERRIDE_MISSING' | 'PLUGIN_DEPENDENCY_MISSING' | 'PLUGIN_MISSING' | 'USE_CREATE_PLUGIN' | 'USE_ELEMENT_CONTEXT'; type LogLevel = 'error' | 'info' | 'log' | 'warn'; declare class PlateError extends Error { type: DebugErrorType; constructor(message: string, type?: DebugErrorType); } declare const DebugPlugin: SlatePlugin void>>; logLevel: LogLevel; throwErrors: boolean; }, { debug: { error: (message: string | unknown, type?: DebugErrorType, details?: any) => void; info: (message: string, type?: DebugErrorType, details?: any) => void; log: (message: string, type?: DebugErrorType, details?: any) => void; warn: (message: string, type?: DebugErrorType, details?: any) => void; }; }, {}, {}>>; //#endregion //#region src/lib/plugins/node-id/NodeIdPlugin.d.ts type NodeIdOptions = { /** * By default, when a node inserted using editor.tf.insertNode(s) has an id, * it will be used instead of the id generator, except if it already exists in * the document. Set this option to true to disable this behavior. */ disableInsertOverrides?: boolean; /** * Filter inline `Element` nodes. * * @default true */ filterInline?: boolean; /** * Filter `Text` nodes. * * @default true */ filterText?: boolean; /** * Node key to store the id. * * @default 'id' */ idKey?: string; /** * Controls how missing ids are assigned in the initial value. * * - `'if-needed'`: normalize only when the first or last top-level node is * missing an id * - `'always'`: walk the whole initial value and fill any missing ids * - `false`: skip initial-value id assignment * * @default 'if-needed' */ initialValueIds?: false | 'always' | 'if-needed'; /** * Legacy alias for `initialValueIds`. * * - `false`: only check the first and last top-level nodes * - `true`: walk the whole initial value and fill missing ids * - `null`: skip initial-value id assignment * * @deprecated Use `initialValueIds` instead. */ normalizeInitialValue?: boolean | null; /** * Reports duplicate-id scan cost during inserted-node normalization. */ onDuplicateIdScan?: (stats: { candidateCount: number; duration: number; existingCount: number; visitedCount: number; }) => void; /** * Reuse ids on undo/redo and copy/pasting if not existing in the document. * This is disabled by default to avoid duplicate ids across documents. * * @default false */ reuseId?: boolean; /** * A function that generates and returns a unique ID. * * @default () => nanoid(10) */ idCreator?: () => any; } & QueryNodeOptions; type NormalizeNodeIdOptions = Pick; declare const normalizeNodeId: (value: V, options?: NormalizeNodeIdOptions) => V; declare const normalizeNodeIdWithEditor: (editor: { api: { isBlock: (node: Descendant) => boolean; }; }, value: V, options?: NormalizeNodeIdOptions) => V; type NodeIdConfig = PluginConfig<'nodeId', NodeIdOptions, {}, { nodeId: { normalize: () => void; }; }>; /** @see {@link withNodeId} */ declare const NodeIdPlugin: SlatePlugin void; /** * Reuse ids on undo/redo and copy/pasting if not existing in the document. * This is disabled by default to avoid duplicate ids across documents. * * @default false */ reuseId?: boolean; /** * A function that generates and returns a unique ID. * * @default () => nanoid(10) */ idCreator?: () => any; } & QueryNodeOptions, {}, { nodeId: { normalize: () => void; }; } & Record<"nodeId", { normalize(): void; }>, {}>>; //#endregion //#region src/lib/plugins/chunking/ChunkingPlugin.d.ts type ChunkingConfig = PluginConfig<'chunking', { /** * The number of blocks per chunk. * * @default 1000 */ chunkSize?: number; /** * Whether to render each chunk as a DOM element with `content-visibility: * auto`, which optimizes DOM painting. When set to `false`, no DOM element * will be rendered for each chunk. * * @default true */ contentVisibilityAuto?: boolean; /** * Determine which ancestors should have chunking applied to their children. * Only blocks containing other blocks can have chunking applied. * * @default NodeApi.isEditor */ query?: (ancestor: Ancestor) => boolean; }>; declare const ChunkingPlugin: SlatePlugin; //#endregion //#region src/lib/plugins/getCorePlugins.d.ts type CorePlugin = ReturnType[number]; type GetCorePluginsOptions = { /** Enable mark/element affinity. */ affinity?: boolean; /** Configure Slate's chunking optimization. */ chunking?: ChunkingConfig['options'] | boolean; /** Specifies the maximum number of characters allowed in the editor. */ maxLength?: number; /** Configure the navigation feedback plugin. */ navigationFeedback?: NavigationFeedbackConfig['options'] | boolean; /** Configure the node id plugin. */ nodeId?: NodeIdConfig['options'] | boolean; /** Override the core plugins using the same key. */ plugins?: AnyPluginConfig[]; }; declare const getCorePlugins: ({ affinity, chunking, maxLength, navigationFeedback, nodeId, plugins }: GetCorePluginsOptions) => (SlatePlugin | SlatePlugin void; onTextChange: (options: { editor: SlateEditor; node: _platejs_slate1.Descendant; operation: _platejs_slate1.TextOperation; prevText: string; text: string; }) => void; }, { isElementStateEmpty: (element: _platejs_slate1.TElement) => boolean; redecorate: () => void; }, { init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void); insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined); liftBlock: ((args_0?: LiftBlockOptions | undefined) => true | undefined) & ((args_0?: LiftBlockOptions | undefined) => true | undefined); resetBlock: ((args_0?: { at?: _platejs_slate1.Path; } | undefined) => true | undefined) & ((args_0?: { at?: _platejs_slate1.Path; } | undefined) => true | undefined); setValue: ((value?: string | _platejs_slate1.Value | undefined) => void) & ((value?: string | _platejs_slate1.Value | undefined) => void); apply: (operation: _platejs_slate1.Operation) => void; }, {}>> | SlatePlugin boolean; }, { withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void; }, {}>> | SlatePlugin NavigationFeedbackActiveTarget | null; clear: () => void; isTarget: (path: _platejs_slate1.Path) => boolean; }; }, { navigation: { clear: () => void; flashTarget: (options: NavigationFlashTargetOptions) => boolean; navigate: (options: NavigationNavigateOptions) => boolean; }; }, {}>> | SlatePlugin> | SlatePlugin | SlatePlugin> | SlatePlugin> | SlatePlugin | SlatePlugin _platejs_slate1.Descendant[]; }>, {}, {}>> | SlatePlugin> | SlatePlugin void; reuseId?: boolean; idCreator?: () => any; } & _platejs_slate1.QueryNodeOptions, {}, { nodeId: { normalize: () => void; }; } & Record<"nodeId", { normalize(): void; }>, {}>> | SlatePlugin | SlatePlugin> | SlatePlugin)[]; type CorePluginTransforms = SlateExtensionConfig['transforms'] & NavigationFeedbackConfig['transforms']; type CorePluginApi = SlateExtensionConfig['api'] & NavigationFeedbackConfig['api']; type DebugConfig = PluginConfig<'debug', { isProduction: boolean; logger: Partial>; logLevel: LogLevel; throwErrors: boolean; }, { debug: { error: (message: string | unknown, type?: DebugErrorType, details?: any) => void; info: (message: string, type?: DebugErrorType, details?: any) => void; log: (message: string, type?: DebugErrorType, details?: any) => void; warn: (message: string, type?: DebugErrorType, details?: any) => void; }; }>; type LengthConfig = PluginConfig<'length', { maxLength: number; }>; type LogFunction = (message: string, type?: DebugErrorType, details?: any) => void; //#endregion //#region src/lib/plugins/chunking/withChunking.d.ts declare const withChunking: OverrideEditor; //#endregion //#region src/lib/plugins/html/HtmlPlugin.d.ts /** * Enables support for deserializing inserted content from HTML format to Slate * format and serializing Slate content to HTML format. */ declare const HtmlPlugin: SlatePlugin _platejs_slate1.Descendant[]; }>, {}, {}>>; //#endregion //#region src/lib/plugins/html/constants.d.ts declare const CARRIAGE_RETURN = "\r"; declare const LINE_FEED = "\n"; declare const NO_BREAK_SPACE = "\u00A0"; declare const SPACE = " "; declare const TAB = "\t"; declare const ZERO_WIDTH_SPACE = "\u200B"; //#endregion //#region src/lib/plugins/html/types.d.ts type DeserializeHtmlChildren = ChildNode | Descendant | string | null; /** De */ type DeserializeHtmlNodeReturnType = Descendant | Descendant[] | DeserializeHtmlChildren[] | string | null; //#endregion //#region src/lib/plugins/html/utils/cleanHtmlBrElements.d.ts /** Replace BR elements with line feeds. */ declare const cleanHtmlBrElements: (rootNode: Node) => void; //#endregion //#region src/lib/plugins/html/utils/cleanHtmlCrLf.d.ts /** Replace \r\n and \r with \n */ declare const cleanHtmlCrLf: (html: string) => string; //#endregion //#region src/lib/plugins/html/utils/cleanHtmlEmptyElements.d.ts /** Remove empty elements from rootNode. Allowed empty elements: BR, IMG. */ declare const cleanHtmlEmptyElements: (rootNode: Node) => void; //#endregion //#region src/lib/plugins/html/utils/cleanHtmlFontElements.d.ts /** * Replace FONT elements with SPAN elements if there is textContent (remove * otherwise). */ declare const cleanHtmlFontElements: (rootNode: Node) => void; //#endregion //#region src/lib/plugins/html/utils/cleanHtmlLinkElements.d.ts /** Remove fragment hrefs and spans without inner text. */ declare const cleanHtmlLinkElements: (rootNode: Node) => void; //#endregion //#region src/lib/plugins/html/utils/cleanHtmlTextNodes.d.ts declare const cleanHtmlTextNodes: (rootNode: Node) => void; //#endregion //#region src/lib/plugins/html/utils/copyBlockMarksToSpanChild.d.ts /** * Set HTML blocks mark styles to a new child span element if any. This allows * Plate to use block marks. */ declare const copyBlockMarksToSpanChild: (rootNode: Node) => void; //#endregion //#region src/lib/plugins/html/utils/deserializeHtml.d.ts /** Deserialize HTML element to a valid document fragment. */ declare const deserializeHtml: (editor: SlateEditor, { collapseWhiteSpace: shouldCollapseWhiteSpace, defaultElementPlugin, element }: { element: HTMLElement | string; collapseWhiteSpace?: boolean; defaultElementPlugin?: WithRequiredKey; }) => Descendant[]; //#endregion //#region src/lib/plugins/html/utils/deserializeHtmlElement.d.ts /** Deserialize HTML element to fragment. */ declare const deserializeHtmlElement: (editor: SlateEditor, element: HTMLElement) => DeserializeHtmlNodeReturnType; //#endregion //#region src/lib/plugins/html/utils/deserializeHtmlNode.d.ts /** Deserialize HTML element or child node. */ declare const deserializeHtmlNode: (editor: SlateEditor) => (node: ChildNode | HTMLElement) => DeserializeHtmlNodeReturnType; //#endregion //#region src/lib/plugins/html/utils/deserializeHtmlNodeChildren.d.ts declare const deserializeHtmlNodeChildren: (editor: SlateEditor, node: ChildNode | HTMLElement, isSlateParent?: boolean) => DeserializeHtmlChildren[]; //#endregion //#region src/lib/plugins/html/utils/findHtmlElement.d.ts /** * Find the first HTML element that matches the given selector. * * @param rootNode * @param predicate */ declare const findHtmlElement: (rootNode: Node, predicate: (node: HTMLElement) => boolean) => null; declare const someHtmlElement: (rootNode: Node, predicate: (node: HTMLElement) => boolean) => boolean; //#endregion //#region src/lib/plugins/html/utils/getDataNodeProps.d.ts declare const getDataNodeProps: ({ editor, element, plugin }: { editor: SlateEditor; element: HTMLElement; plugin: AnyEditorPlugin; }) => Record | undefined; //#endregion //#region src/lib/plugins/html/utils/getHtmlComments.d.ts declare const getHtmlComments: (node: Node) => string[]; //#endregion //#region src/lib/plugins/html/utils/htmlBodyToFragment.d.ts /** Deserialize HTML body element to Fragment. */ declare const htmlBodyToFragment: (editor: SlateEditor, element: HTMLElement) => Descendant[] | undefined; //#endregion //#region src/lib/plugins/html/utils/htmlBrToNewLine.d.ts /** Deserialize HTML to break line. */ declare const htmlBrToNewLine: (node: ChildNode | HTMLElement) => "\n" | undefined; //#endregion //#region src/lib/plugins/html/utils/htmlElementToElement.d.ts /** Deserialize HTML to Element. */ declare const htmlElementToElement: (editor: SlateEditor, element: HTMLElement, isSlate?: boolean) => Descendant | undefined; //#endregion //#region src/lib/plugins/html/utils/htmlElementToLeaf.d.ts /** * Deserialize HTML to Descendant[] with marks on Text. Build the leaf from the * leaf deserializers of each plugin. */ declare const htmlElementToLeaf: (editor: SlateEditor, element: HTMLElement) => Descendant[]; //#endregion //#region src/lib/plugins/html/utils/htmlStringToDOMNode.d.ts /** Convert HTML string into HTML element. */ declare const htmlStringToDOMNode: (rawHtml: string) => HTMLElement; //#endregion //#region src/lib/plugins/html/utils/htmlTextNodeToString.d.ts declare const htmlTextNodeToString: (node: ChildNode | HTMLElement) => string | undefined; //#endregion //#region src/lib/plugins/html/utils/inlineTagNames.d.ts /** * # Methodology * * ## Step 1. Get the list of all standard tag names * * Go to https://developer.mozilla.org/en-US/docs/Web/HTML/Element and run the * following in the console to generate a JSON array of tag names: * * ```js * JSON.stringify( * Array.from(document.querySelectorAll('article table td:first-child')) * .map((td) => { * const body = document.createElement('body'); * body.innerHTML = td.textContent; * return body.firstChild?.tagName; * }) * .filter((tagName) => tagName) * ); * ``` * * Output (as of 2023-11-06): * * ```json * '["BASE","LINK","META","STYLE","TITLE","ADDRESS","ARTICLE","ASIDE","FOOTER","HEADER","H1","HGROUP","MAIN","NAV","SECTION","SEARCH","BLOCKQUOTE","DD","DIV","DL","DT","FIGCAPTION","FIGURE","HR","LI","MENU","OL","P","PRE","UL","A","ABBR","B","BDI","BDO","BR","CITE","CODE","DATA","DFN","EM","I","KBD","MARK","Q","RP","RT","RUBY","S","SAMP","SMALL","SPAN","STRONG","SUB","SUP","TIME","U","VAR","WBR","AREA","AUDIO","IMG","MAP","TRACK","VIDEO","EMBED","IFRAME","OBJECT","PICTURE","PORTAL","SOURCE","svg","math","CANVAS","NOSCRIPT","SCRIPT","DEL","INS","TABLE","BUTTON","DATALIST","FIELDSET","FORM","INPUT","LABEL","LEGEND","METER","OPTGROUP","OPTION","OUTPUT","PROGRESS","SELECT","TEXTAREA","DETAILS","DIALOG","SUMMARY","SLOT","TEMPLATE","ACRONYM","BIG","CENTER","CONTENT","DIR","FONT","IMG","MARQUEE","MENUITEM","NOBR","NOEMBED","NOFRAMES","PARAM","PLAINTEXT","RB","RTC","SHADOW","STRIKE","TT","XMP"]' * ``` * * ## Step 2. For each tag name, determine the default browser style * * Open an empty HTML file in the browser and run the following in the console: * * ```js * const tagNames = JSON.parse(); * * JSON.stringify( * tagNames.filter((tagName) => { * const element = document.createElement(tagName); * document.body.appendChild(element); * const display = window.getComputedStyle(element).display; * element.remove(); * return display.startsWith('inline'); * }) * ); * ``` * * Place the result in the array below (accurate as of 2023-11-06). */ declare const inlineTagNames: Set; //#endregion //#region src/lib/plugins/html/utils/isHtmlBlockElement.d.ts declare const isHtmlBlockElement: (node: Node) => boolean; //#endregion //#region src/lib/plugins/html/utils/isHtmlComment.d.ts declare const isHtmlComment: (node: Node) => node is Comment; //#endregion //#region src/lib/plugins/html/utils/isHtmlElement.d.ts declare const isHtmlElement: (node: Node) => node is Element; //#endregion //#region src/lib/plugins/html/utils/isHtmlFragmentHref.d.ts /** If href starts with '#'. */ declare const isHtmlFragmentHref: (href: string) => boolean; //#endregion //#region src/lib/plugins/html/utils/isHtmlInlineElement.d.ts declare const isHtmlInlineElement: (node: Node) => boolean; //#endregion //#region src/lib/plugins/html/utils/isHtmlTable.d.ts declare const isHtmlTable: (element: Element) => boolean; //#endregion //#region src/lib/plugins/html/utils/isHtmlText.d.ts declare const isHtmlText: (node: Node) => node is Text; //#endregion //#region src/lib/plugins/html/utils/isOlSymbol.d.ts declare const isOlSymbol: (symbol: string) => boolean; //#endregion //#region src/lib/plugins/html/utils/parseHtmlDocument.d.ts declare const parseHtmlDocument: (html: string) => Document; //#endregion //#region src/lib/plugins/html/utils/parseHtmlElement.d.ts declare const parseHtmlElement: (html: string) => HTMLElement; //#endregion //#region src/lib/plugins/html/utils/pipeDeserializeHtmlElement.d.ts declare const pipeDeserializeHtmlElement: (editor: SlateEditor, element: HTMLElement) => (Nullable & { node: AnyObject; }) | undefined; //#endregion //#region src/lib/plugins/html/utils/pipeDeserializeHtmlLeaf.d.ts declare const pipeDeserializeHtmlLeaf: (editor: SlateEditor, element: HTMLElement) => AnyObject; //#endregion //#region src/lib/plugins/html/utils/pluginDeserializeHtml.d.ts /** Get a deserializer by type, node names, class names and styles. */ declare const pluginDeserializeHtml: (editor: SlateEditor, plugin: AnyEditorPlugin, { deserializeLeaf, element: el }: { element: HTMLElement; deserializeLeaf?: boolean; }) => (Nullable & { node: AnyObject; }) | undefined; //#endregion //#region src/lib/plugins/html/utils/postCleanHtml.d.ts /** Trim the html and remove zero width spaces, then wrap it with a body element. */ declare const postCleanHtml: (html: string) => string; //#endregion //#region src/lib/plugins/html/utils/preCleanHtml.d.ts /** Remove HTML surroundings and clean HTML from CR/LF */ declare const preCleanHtml: (html: string) => string; //#endregion //#region src/lib/plugins/html/utils/removeHtmlNodesBetweenComments.d.ts /** Removes HTML nodes between HTML comments. */ declare const removeHtmlNodesBetweenComments: (rootNode: Node, start: string, end: string) => void; //#endregion //#region src/lib/plugins/html/utils/removeHtmlSurroundings.d.ts /** Remove string before */ declare const removeHtmlSurroundings: (html: string) => string; //#endregion //#region src/lib/plugins/html/utils/replaceTagName.d.ts declare const replaceTagName: (element: Element, tagName: string) => Element; //#endregion //#region src/lib/plugins/html/utils/traverseHtmlComments.d.ts type Callback$3 = (node: Comment) => boolean; /** Traverse HTML comments. */ declare const traverseHtmlComments: (rootNode: Node, callback: Callback$3) => void; //#endregion //#region src/lib/plugins/html/utils/traverseHtmlElements.d.ts type Callback$2 = (node: Element) => boolean; /** * Traverse the HTML elements of the given HTML node. * * @param rootNode The root HTML node to traverse. * @param callback The callback to call for each HTML element. */ declare const traverseHtmlElements: (rootNode: Node, callback: Callback$2) => void; //#endregion //#region src/lib/plugins/html/utils/traverseHtmlNode.d.ts type Callback$1 = (node: Node) => boolean; /** * Depth-first pre-order tree traverse the given HTML node and calls the given * callback for each node. see: * https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR) * * @param callback Returns a boolean indicating whether traversal should be * continued */ declare const traverseHtmlNode: (node: Node, callback: Callback$1) => void; //#endregion //#region src/lib/plugins/html/utils/traverseHtmlTexts.d.ts type Callback = (node: Text) => boolean; declare const traverseHtmlTexts: (rootNode: Node, callback: Callback) => void; //#endregion //#region src/lib/plugins/html/utils/unwrapHtmlElement.d.ts /** Unwrap the given HTML element. */ declare const unwrapHtmlElement: (element: Element) => void; //#endregion //#region src/lib/plugins/html/utils/collapse-white-space/types.d.ts type CollapseWhiteSpaceState = { inlineFormattingContext: { atStart: boolean; lastHasTrailingWhiteSpace: boolean; } | null; whiteSpaceRule: WhiteSpaceRule; }; type TrimEndRule = 'collapse' | 'single-newline'; type TrimStartRule = 'all' | 'collapse'; type WhiteSpaceRule = 'normal' | 'pre' | 'pre-line'; //#endregion //#region src/lib/plugins/html/utils/collapse-white-space/collapseString.d.ts declare const collapseString: (text: string, { shouldCollapseWhiteSpace, trimEnd, trimStart, whiteSpaceIncludesNewlines }?: { shouldCollapseWhiteSpace?: boolean; trimEnd?: TrimEndRule; trimStart?: TrimStartRule; whiteSpaceIncludesNewlines?: boolean; }) => string; //#endregion //#region src/lib/plugins/html/utils/collapse-white-space/collapseWhiteSpace.d.ts declare const collapseWhiteSpace: (element: HTMLElement) => HTMLElement; //#endregion //#region src/lib/plugins/html/utils/collapse-white-space/collapseWhiteSpaceChildren.d.ts declare const collapseWhiteSpaceChildren: (node: Node, state: CollapseWhiteSpaceState) => void; //#endregion //#region src/lib/plugins/html/utils/collapse-white-space/collapseWhiteSpaceElement.d.ts /** * Note: We do not want to start an inline formatting context until we encounter * a text node. */ declare const collapseWhiteSpaceElement: (element: HTMLElement, state: CollapseWhiteSpaceState) => void; //#endregion //#region src/lib/plugins/html/utils/collapse-white-space/collapseWhiteSpaceNode.d.ts declare const collapseWhiteSpaceNode: (node: Node, state: CollapseWhiteSpaceState) => void; //#endregion //#region src/lib/plugins/html/utils/collapse-white-space/collapseWhiteSpaceText.d.ts declare const collapseWhiteSpaceText: (text: Text, state: CollapseWhiteSpaceState) => void; //#endregion //#region src/lib/plugins/html/utils/collapse-white-space/inferWhiteSpaceRule.d.ts declare const inferWhiteSpaceRule: (element: HTMLElement) => WhiteSpaceRule | null; //#endregion //#region src/lib/plugins/html/utils/collapse-white-space/isLastNonEmptyTextOfInlineFormattingContext.d.ts declare const isLastNonEmptyTextOfInlineFormattingContext: (initialText: Text) => boolean; //#endregion //#region src/lib/plugins/html/utils/collapse-white-space/stateTransforms.d.ts declare const upsertInlineFormattingContext: (state: CollapseWhiteSpaceState) => void; declare const endInlineFormattingContext: (state: CollapseWhiteSpaceState) => void; //#endregion //#region src/lib/plugins/input-rules/createInputRules.d.ts declare const createMarkInputRule: (config: MarkInputRuleConfig) => ReturnType; declare const matchBlockStart: (context: TContext, config: MatchBlockStartOptions) => (BlockStartInputRuleMatch & TMatch) | undefined; declare const createBlockStartInputRule: (config: BlockStartInputRuleConfig) => InsertTextInputRule; declare const matchBlockFence: (context: TContext, config: MatchBlockFenceOptions) => TMatch | undefined; declare function createBlockFenceInputRule(config: BlockFenceInputRuleConfig): InsertBreakInputRule | InsertTextInputRule; declare const matchDelimitedInline: (context: SelectionInputRuleContext, { boundaryRe, close, followRe, open, requireClosingDelimiter, rejectRepeatedOpen, trim }: MatchDelimitedInlineOptions) => DelimitedInlineInputRuleMatch | undefined; declare const createTextSubstitutionInputRule: ({ enabled, patterns, priority }: TextSubstitutionInputRuleConfig) => InsertTextInputRule; //#endregion //#region src/lib/plugins/input-rules/createRuleFactory.d.ts type FactoryValue = TValue | ((input: TInput) => TValue); type Simplify = { [K in keyof T]: T[K] } & {}; type BivariantCallback unknown> = { bivarianceHack: T; }['bivarianceHack']; type RuntimeOptions = { enabled?: (context: TContext) => boolean; priority?: number; }; type FactoryInput = TContext & TDefaults & TRequired; type PublicOptions = Simplify & TRequired & RuntimeOptions>; type CreateRuleFactoryReturn = keyof TRequired extends never ? (options?: PublicOptions) => AnyInputRule : (options: PublicOptions) => AnyInputRule; type RuleFactoryConfigBuilder = (options: PublicOptions) => TConfig; type MarkRuleFactoryConfig = { type: 'mark'; end?: FactoryValue, string | undefined>; mark?: FactoryValue, string | undefined>; marks?: FactoryValue, string[] | undefined>; start: FactoryValue, string>; trim?: FactoryValue, MarkInputRuleConfig['trim']>; trigger: FactoryValue, string>; enabled?: (input: FactoryInput) => boolean; priority?: number; }; type BlockStartRuleFactoryConfig = { type: 'blockStart'; apply?: BivariantCallback<(input: FactoryInput, match: BlockStartInputRuleMatch & TMatch) => boolean | void>; match: FactoryValue, RegExp | string | undefined>; mode?: FactoryValue, BlockStartInputRuleConfig['mode']>; node?: FactoryValue, string | undefined>; removeMatchedText?: FactoryValue, boolean | undefined>; resolveMatch?: (args: { match: RegExpMatchArray | string; range: BlockStartInputRuleMatch['range']; text: string; }, input: FactoryInput) => TMatch | undefined; trigger: FactoryValue, string>; enabled?: (input: FactoryInput) => boolean; priority?: number; }; type BlockFenceRuleFactoryConfig = { type: 'blockFence'; apply: BivariantCallback<(input: FactoryInput, match: TMatch) => boolean | void>; block?: FactoryValue, string | undefined>; fence: FactoryValue, string>; on?: FactoryValue, BlockFenceInputRuleConfig['on']>; resolveMatch?: (args: { fence: string; path: BlockFenceInputRuleMatch['path']; range: BlockFenceInputRuleMatch['range']; text: string; }, input: FactoryInput) => TMatch | undefined; enabled?: (input: FactoryInput) => boolean; priority?: number; }; type InsertTextRuleFactoryConfig = { type: 'insertText'; apply: BivariantCallback<(input: FactoryInput, match: TMatch) => boolean | void>; resolve?: (input: FactoryInput) => TMatch | undefined; trigger: FactoryValue, InsertTextInputRule['trigger']>; enabled?: (input: FactoryInput) => boolean; priority?: number; }; type InsertBreakRuleFactoryConfig = { type: 'insertBreak'; apply: BivariantCallback<(input: FactoryInput, match: TMatch) => boolean | void>; resolve?: (input: FactoryInput) => TMatch | undefined; enabled?: (input: FactoryInput) => boolean; priority?: number; }; type InsertDataRuleFactoryConfig = { type: 'insertData'; apply: BivariantCallback<(input: FactoryInput, match: TMatch) => boolean | void>; mimeTypes?: FactoryValue, string[] | undefined>; resolve?: (input: FactoryInput) => TMatch | undefined; enabled?: (input: FactoryInput) => boolean; priority?: number; }; type TextSubstitutionRuleFactoryConfig = { type: 'textSubstitution'; patterns: FactoryValue, TextSubstitutionInputRuleConfig['patterns']>; enabled?: (input: FactoryInput) => boolean; priority?: number; }; type AnyRuleFactoryConfig, TRequired extends object = Record, TMatch = unknown> = MarkRuleFactoryConfig | BlockStartRuleFactoryConfig | BlockFenceRuleFactoryConfig | InsertTextRuleFactoryConfig | InsertBreakRuleFactoryConfig | InsertDataRuleFactoryConfig | TextSubstitutionRuleFactoryConfig; type AnyRuleFactoryConfigLoose, TRequired extends object = Record> = MarkRuleFactoryConfig | BlockStartRuleFactoryConfig | BlockFenceRuleFactoryConfig | InsertTextRuleFactoryConfig | InsertBreakRuleFactoryConfig | InsertDataRuleFactoryConfig | TextSubstitutionRuleFactoryConfig; type ContextFromFactoryConfig = TConfig extends MarkRuleFactoryConfig | BlockStartRuleFactoryConfig | InsertTextRuleFactoryConfig | TextSubstitutionRuleFactoryConfig ? InsertTextInputRuleContext : TConfig extends BlockFenceRuleFactoryConfig ? SelectionInputRuleContext : TConfig extends InsertBreakRuleFactoryConfig ? InsertBreakInputRuleContext : InsertDataInputRuleContext; declare function createRuleFactory = AnyRuleFactoryConfig>(config: TConfig & TDefaults): CreateRuleFactoryReturn, TDefaults, TRequired>; declare function createRuleFactory(configBuilder: RuleFactoryConfigBuilder>): CreateRuleFactoryReturn; //#endregion //#region src/lib/plugins/input-rules/defineInputRule.d.ts declare function defineInputRule(rule: InsertBreakInputRule): InsertBreakInputRule; declare function defineInputRule(rule: InsertDataInputRule): InsertDataInputRule; declare function defineInputRule(rule: InsertTextInputRule): InsertTextInputRule; declare function defineInputRule(rule: TRule): TRule; //#endregion //#region src/lib/plugins/length/LengthPlugin.d.ts declare const LengthPlugin: SlatePlugin; //#endregion //#region src/lib/plugins/node-id/normalizeStaticValue.d.ts declare const STATIC_VALUE_CREATED_AT = 1704067200000; type NormalizeStaticValueOptions = NormalizeNodeIdOptions & { createdAt?: number; }; declare const normalizeStaticValue: (value: V, options?: NormalizeStaticValueOptions) => V; //#endregion //#region src/lib/plugins/node-id/withNodeId.d.ts /** Enables support for inserting nodes with an id key. */ declare const withNodeId: OverrideEditor; //#endregion //#region src/lib/plugins/override/OverridePlugin.d.ts /** * Merge and register all the inline types and void types from the plugins and * options, using `editor.api.isInline`, `editor.api.markableVoid` and * `editor.api.isVoid` */ declare const withOverrides: OverrideEditor; /** Override the editor api and transforms based on the plugins. */ declare const OverridePlugin: SlatePlugin>; //#endregion //#region src/lib/plugins/override/withBreakRules.d.ts declare const withBreakRules: OverrideEditor; //#endregion //#region src/lib/plugins/override/withDeleteRules.d.ts declare const withDeleteRules: OverrideEditor; //#endregion //#region src/lib/plugins/override/withMergeRules.d.ts declare const withMergeRules: OverrideEditor; //#endregion //#region src/lib/plugins/override/withNormalizeRules.d.ts declare const withNormalizeRules: OverrideEditor; //#endregion //#region src/lib/plugins/paragraph/BaseParagraphPlugin.d.ts type ParagraphConfig = PluginConfig<'p'>; declare const BaseParagraphPlugin: SlatePlugin>; //#endregion //#region src/lib/plugin/BasePlugin.d.ts type AnyPluginConfig = { key: any; api: any; options: any; selectors: any; transforms: any; }; type BaseDeserializer = AnyObject & { /** * Deserialize an element. Overrides plugin.isElement. * * @default plugin.isElement */ isElement?: boolean; /** * Deserialize a leaf. Overrides plugin.isLeaf. * * @default plugin.isLeaf */ isLeaf?: boolean; }; type BaseHtmlDeserializer = BaseDeserializer & { /** List of HTML attribute names to store their values in `node.attributes`. */ attributeNames?: string[]; rules?: { /** * Deserialize an element: * * - If this option (string) is in the element attribute names. * - If this option (object) values match the element attributes. */ validAttribute?: Record | string; /** Valid element `className`. */ validClassName?: string; /** Valid element `nodeName`. Set '*' to allow any node name. */ validNodeName?: string[] | string; /** * Valid element style values. Can be a list of string (only one match is * needed). */ validStyle?: Partial>; }[]; /** Whether or not to include deserialized children on this node */ withoutChildren?: boolean; }; type BaseInjectProps = { /** * Object whose keys are node values and values are classNames which will be * extended. */ classNames?: AnyObject; /** * Default node value. The node key would be unset if the node value = * defaultNodeValue. */ defaultNodeValue?: any; /** Node key to map to the styles. */ nodeKey?: string; /** * Style key to override. * * @default nodeKey */ styleKey?: keyof CSSStyleDeclaration; /** List of supported node values. */ validNodeValues?: any[]; }; type BasePlugin = { /** Unique identifier for this plugin. */ key: C['key']; /** API methods provided by this plugin. */ api: InferApi; /** * An array of plugin keys that this plugin depends on. These plugins will be * loaded before this plugin. */ dependencies: string[]; inject: Nullable<{ /** Plugin keys of elements to exclude the children from */ excludeBelowPlugins?: string[]; /** Plugin keys of elements to exclude */ excludePlugins?: string[]; /** Whether to filter blocks */ isBlock?: boolean; /** Whether to filter elements */ isElement?: boolean; /** Whether to filter leaves */ isLeaf?: boolean; /** Filter nodes with path above this level. */ maxLevel?: number; /** * Plugin keys used by {@link InjectNodeProps} and the targetPluginToInject * function. For plugin injection by key, use the inject.plugins property. * * @default [ParagraphPlugin.key] */ targetPlugins?: string[]; }>; /** Node-specific configuration for this plugin. */ node: BasePluginNode; /** Extended properties used by any plugin as options. */ options: InferOptions; /** Store for managing plugin options. */ optionsStore: TStateApi; override: { /** Enable or disable plugins */ enabled?: Partial>; }; /** * Defines the order in which plugins are registered and executed. * * Plugins with higher priority values are registered and executed before * those with lower values. This affects two main aspects: * * 1. Plugin Order: Plugins with higher priority will be added to the editor * earlier. * 2. Execution Order: For operations that involve multiple plugins (e.g., editor * methods), plugins with higher priority will be processed first. * * @default 100 */ priority: number; render: Nullable<{ /** * Renders a component above the `Editable` component but within the `Slate` * wrapper. Useful for adding UI elements that should appear above the * editable area. */ aboveEditable?: React.FC<{ children: React.ReactNode; }>; /** * Renders a component above the `Slate` wrapper. This is the outermost * render position in the editor structure. */ aboveSlate?: React.FC<{ children: React.ReactNode; }>; /** * Specifies the HTML tag name to use when rendering the node component. * Only used when no custom `component` is provided for the plugin. * * @default 'div' for elements, 'span' for leaves */ as?: keyof HTMLElementTagNameMap; /** * Renders a component below leaf nodes when `isLeaf: true` and * `isDecoration: false`. Use `render.node` instead when `isDecoration: * true`. */ leaf?: NodeComponent; /** * Renders a component for: * * - Elements nodes if `isElement: true` * - Below text nodes if `isLeaf: true` and `isDecoration: false` * - Below leaf if `isLeaf: true` and `isDecoration: true` */ node?: NodeComponent; }>; rules: { /** * Defines actions on insert break based on block state. * * - `'default'`: Default behavior * - `'exit'`: Exit the current block * - `'lift'`: Lift the current block out of the nearest matching ancestor * - `'reset'`: Reset block to default paragraph type * - `'lineBreak'`: Insert newline character * - `'deleteExit'`: Delete backward then exit */ break?: BreakRules; /** * Defines actions on delete based on block state. * * - `'default'`: Default behavior * - `'lift'`: Lift the current block out of the nearest matching ancestor * - `'reset'`: Reset block to default paragraph type */ delete?: DeleteRules; /** Defines the behavior of merging nodes. */ merge?: MergeRules; /** Defines the behavior of normalizing nodes. */ normalize?: NormalizeRules; /** Defines the behavior of selection. */ selection?: SelectionRules; }; /** Selectors for the plugin. */ selectors: InferSelectors; /** Transforms (state-modifying operations) that can be applied to the editor. */ transforms: InferTransforms; /** * Configures edit-only behavior for various plugin functionalities. * * - If `true` (boolean): * * - `render`, `handlers`, and `inject.nodeProps` are active only when the * editor is NOT read-only. * - If an object ({@link EditOnlyConfig}): Allows fine-grained control: * * - `render`: Edit-only by default (true if not specified). Set to `false` to * always be active. * - `handlers`: Edit-only by default (true if not specified). Set to `false` to * always be active. * - `inject` (for `inject.nodeProps`): Edit-only by default (true if not * specified). Set to `false` to always be active. * - `transformInitialValue`: NOT edit-only by default (false if not specified). * Set to `true` to make it edit-only. */ editOnly?: EditOnlyConfig | boolean; /** * Enables or disables the plugin. Used by Plate to determine if the plugin * should be used. */ enabled?: boolean; }; type BasePluginContext = { api: C['api'] & EditorApi & CorePluginApi; setOptions: (options: ((state: Draft>>) => void) | Partial>) => void; tf: C['transforms'] & EditorTransforms & CorePluginTransforms; type: string; getOption: | keyof InferSelectors | 'state'>(key: K$1, ...args: K$1 extends keyof InferSelectors ? Parameters[K$1]> : unknown[]) => K$1 extends 'state' ? InferOptions : K$1 extends keyof InferSelectors ? ReturnType[K$1]> : K$1 extends keyof InferOptions ? InferOptions[K$1] : never; getOptions: () => InferOptions; setOption: >(optionKey: K$1, value: InferOptions[K$1]) => void; }; type BasePluginNode = { /** * Specifies the type identifier for this plugin's nodes. * * For elements (when {@link isElement} is `true`): * * - The {@link NodeComponent} will be used for any node where `node.type === * type`. * * For leaves/marks (when {@link isLeaf} is `true`): * * - The {@link NodeComponent} will be used for any leaf where `node[type] === * true`. * * This property is crucial for Plate to correctly match nodes to their * respective plugins. * * @default plugin.key */ type: string; component?: NodeComponent | null; /** * Controls which (if any) attribute names in the `attributes` property of an * element will be passed as `nodeProps` to the {@link NodeComponent}, and * subsequently rendered as DOM attributes. * * WARNING: If used improperly, this property WILL make your application * vulnerable to cross-site scripting (XSS) or information exposure attacks. * * For example, if the `href` attribute is allowed and the component passes * `nodeProps` to an `` element, then attackers can direct users to open a * document containing a malicious link element: * * { type: 'link', url: 'https://safesite.com/', attributes: { href: * 'javascript:alert("xss")' }, children: [{ text: 'Click me' }], } * * The same is true of the `src` attribute when passed to certain HTML * elements, such as `