@lofcz/platejs-core 52.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4294 @@
1
+ import * as _platejs_slate1 from "@platejs/slate";
2
+ import { Ancestor, DOMRange, DecoratedRange, Descendant, Editor, EditorAboveOptions, EditorApi, EditorBase, EditorTransforms, LeafPosition, NodeEntry, NodeOf, NodeOperation, Operation, Path, QueryNodeOptions, ScrollIntoViewOptions, TElement, TNode, TRange, TSelection, TText, TextOperation, Value } from "@platejs/slate";
3
+ import { nanoid as nanoid$1 } from "nanoid";
4
+ import { AnyObject, Deep2Partial, Modify, Nullable, OmitFirst, Simplify, UnionToIntersection, UnknownObject } from "@udecode/utils";
5
+ import { createVanillaStore, createVanillaStore as createZustandStore$1 } from "zustand-x/vanilla";
6
+ import { KeyboardEventLike, isHotkey } from "is-hotkey";
7
+ import * as slate0 from "slate";
8
+ import { EditorPathOptions, EditorPointOptions, NodeEntry as NodeEntry$1, Selection } from "slate";
9
+ import React$1, { JSX } from "react";
10
+ import { TStateApi, TStateApi as ZustandStoreApi } from "zustand-x";
11
+ import { Draft } from "mutative";
12
+ import * as slate_dom0 from "slate-dom";
13
+ import { DOMEditor, DOMNode, DOMPoint, DOMRange as DOMRange$1 } from "slate-dom";
14
+ import { StandardBehaviorOptions } from "scroll-into-view-if-needed";
15
+ import { EditorFragmentDeletionOptions, EditorPathRefOptions, EditorPointRefOptions, EditorRangeRefOptions } from "slate/dist/interfaces/editor";
16
+ import { SelectionCollapseOptions, SelectionMoveOptions, SelectionSetPointOptions } from "slate/dist/interfaces/transforms/selection";
17
+
18
+ //#region src/lib/plugins/AstPlugin.d.ts
19
+ /**
20
+ * Enables support for deserializing inserted content from Slate Ast format to
21
+ * Slate format while apply a small bug fix.
22
+ */
23
+ declare const AstPlugin: SlatePlugin<PluginConfig<"ast", {}, {}, {}, {}>>;
24
+ //#endregion
25
+ //#region src/lib/plugin/HandlerReturnType.d.ts
26
+ /** If true, the next handlers will be skipped. */
27
+ type HandlerReturnType = boolean | void;
28
+ //#endregion
29
+ //#region src/static/pluginRenderElementStatic.d.ts
30
+ type SlateRenderElement = (props: RenderElementProps) => React$1.ReactElement<any> | undefined;
31
+ declare const pluginRenderElementStatic: (editor: SlateEditor, plugin: AnyEditorPlugin) => SlateRenderElement;
32
+ //#endregion
33
+ //#region src/static/pipeRenderElementStatic.d.ts
34
+ declare const pipeRenderElementStatic: (editor: SlateEditor, {
35
+ renderElement: renderElementProp
36
+ }?: {
37
+ renderElement?: SlateRenderElement;
38
+ }) => SlateRenderElement;
39
+ //#endregion
40
+ //#region src/static/pluginRenderLeafStatic.d.ts
41
+ type SlateRenderLeaf = (props: RenderLeafProps) => React$1.ReactElement<any> | undefined;
42
+ declare const pluginRenderLeafStatic: (editor: SlateEditor, plugin: SlatePlugin) => SlateRenderLeaf;
43
+ /** @see {@link RenderLeaf} */
44
+ declare const pipeRenderLeafStatic: (editor: SlateEditor, {
45
+ renderLeaf: renderLeafProp
46
+ }?: {
47
+ renderLeaf?: SlateRenderLeaf;
48
+ }) => SlateRenderLeaf;
49
+ //#endregion
50
+ //#region src/static/pluginRenderTextStatic.d.ts
51
+ type SlateRenderText = (props: RenderTextProps) => React$1.ReactElement<any> | undefined;
52
+ declare const pluginRenderTextStatic: (editor: SlateEditor, plugin: SlatePlugin) => SlateRenderText;
53
+ /** @see {@link RenderText} */
54
+ declare const pipeRenderTextStatic: (editor: SlateEditor, {
55
+ renderText: renderTextProp
56
+ }?: {
57
+ renderText?: SlateRenderText;
58
+ }) => SlateRenderText;
59
+ //#endregion
60
+ //#region src/static/components/PlateStatic.d.ts
61
+ declare function BaseElementStatic({
62
+ decorate,
63
+ decorations,
64
+ editor,
65
+ element
66
+ }: {
67
+ decorate: EditableProps['decorate'];
68
+ decorations: DecoratedRange[];
69
+ editor: SlateEditor;
70
+ element: TElement;
71
+ style?: React$1.CSSProperties;
72
+ }): React$1.JSX.Element;
73
+ declare const ElementStatic: React$1.MemoExoticComponent<typeof BaseElementStatic>;
74
+ declare function BaseLeafStatic({
75
+ decorations,
76
+ editor,
77
+ text
78
+ }: {
79
+ decorations: DecoratedRange[];
80
+ editor: SlateEditor;
81
+ text: TText;
82
+ }): React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>> | undefined;
83
+ declare const LeafStatic: React$1.MemoExoticComponent<typeof BaseLeafStatic>;
84
+ type PlateStaticProps = {
85
+ /** Editor instance. */
86
+ editor: SlateEditor;
87
+ style?: React$1.CSSProperties;
88
+ /** Controlled value. Alias to `editor.children`. */
89
+ value?: Value;
90
+ } & React$1.HTMLAttributes<HTMLDivElement>;
91
+ declare function PlateStatic(props: PlateStaticProps): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
92
+ //#endregion
93
+ //#region src/static/serializeHtml.d.ts
94
+ type SerializeHtmlOptions<T extends PlateStaticProps = PlateStaticProps> = {
95
+ /** The component used to render the editor content */
96
+ editorComponent?: React$1.ComponentType<T>;
97
+ /** List of className prefixes to preserve from being stripped out */
98
+ preserveClassNames?: string[];
99
+ /** Props to pass to the editor component */
100
+ props?: Partial<T>;
101
+ /** Enable stripping class names */
102
+ stripClassNames?: boolean;
103
+ /** Enable stripping data attributes */
104
+ stripDataAttributes?: boolean;
105
+ };
106
+ /**
107
+ * Serialize the editor content to HTML. By default, uses `PlateStatic` as the
108
+ * editor component, but you can provide a custom component (e.g.
109
+ * `EditorStatic`).
110
+ */
111
+ declare const serializeHtml: <T extends PlateStaticProps = PlateStaticProps>(editor: SlateEditor, {
112
+ editorComponent: EditorComponent,
113
+ preserveClassNames,
114
+ props,
115
+ stripClassNames,
116
+ stripDataAttributes
117
+ }?: SerializeHtmlOptions<T>) => Promise<string>;
118
+ //#endregion
119
+ //#region src/static/types.d.ts
120
+ type BoxStaticProps = React.ComponentProps<'div'> & {
121
+ as?: React.ElementType;
122
+ };
123
+ type SlateRenderElementProps<N$1 extends TElement = TElement, C extends AnyPluginConfig = PluginConfig> = SlateRenderNodeProps<C> & RenderElementProps<N$1>;
124
+ type SlateRenderLeafProps<N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig> = SlateRenderNodeProps<C> & RenderLeafProps<N$1>;
125
+ type SlateRenderNodeProps<C extends AnyPluginConfig = PluginConfig> = SlatePluginContext<C> & {
126
+ attributes?: AnyObject;
127
+ className?: string;
128
+ /** @see {@link NodeProps} */
129
+ nodeProps?: AnyObject;
130
+ };
131
+ type SlateRenderTextProps<N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig> = SlateRenderNodeProps<C> & RenderTextProps<N$1>;
132
+ //#endregion
133
+ //#region src/static/components/slate-nodes.d.ts
134
+ declare const useNodeAttributes: (props: any, ref?: any) => any;
135
+ type SlateElementProps<N$1 extends TElement = TElement, C extends AnyPluginConfig = PluginConfig> = SlateNodeProps<C> & RenderElementProps<N$1> & {
136
+ attributes: UnknownObject;
137
+ path: Path;
138
+ } & DeprecatedNodeProps;
139
+ type DeprecatedNodeProps = {
140
+ /**
141
+ * @deprecated Optional class to be merged with `attributes.className`.
142
+ * @default undefined
143
+ */
144
+ className?: string;
145
+ /**
146
+ * @deprecated Optional style to be merged with `attributes.style`
147
+ * @default undefined
148
+ */
149
+ style?: React$1.CSSProperties;
150
+ };
151
+ type SlateNodeProps<C extends AnyPluginConfig = PluginConfig> = SlatePluginContext<C> & {
152
+ /**
153
+ * Optional ref to be merged with `attributes.ref`
154
+ *
155
+ * @default undefined
156
+ */
157
+ ref?: any;
158
+ };
159
+ type SlateHTMLProps<C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = 'div'> = SlateNodeProps<C> & {
160
+ /** HTML attributes to pass to the underlying HTML element */
161
+ attributes: React$1.PropsWithoutRef<React$1.JSX.IntrinsicElements[T]> & UnknownObject;
162
+ as?: T;
163
+ /** Class to be merged with `attributes.className` */
164
+ className?: string;
165
+ /** Style to be merged with `attributes.style` */
166
+ style?: React$1.CSSProperties;
167
+ };
168
+ type StyledSlateElementProps<N$1 extends TElement = TElement, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = 'div'> = Omit<SlateElementProps<N$1, C>, keyof DeprecatedNodeProps> & SlateHTMLProps<C, T>;
169
+ declare const SlateElement: <N$1 extends TElement = TElement, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = "div">(props: StyledSlateElementProps<N$1, C, T>) => React$1.ReactElement;
170
+ type SlateTextProps<N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig> = SlateNodeProps<C> & RenderTextProps<N$1> & DeprecatedNodeProps & {
171
+ attributes: UnknownObject;
172
+ };
173
+ type StyledSlateTextProps<N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = 'span'> = Omit<SlateTextProps<N$1, C>, keyof DeprecatedNodeProps> & SlateHTMLProps<C, T>;
174
+ declare const SlateText: <N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = "span">(props: StyledSlateTextProps<N$1, C, T>) => React$1.ReactElement;
175
+ type SlateLeafProps<N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig> = SlateNodeProps<C> & RenderLeafProps<N$1> & DeprecatedNodeProps & {
176
+ attributes: UnknownObject;
177
+ inset?: boolean;
178
+ };
179
+ type StyledSlateLeafProps<N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = 'span'> = Omit<SlateLeafProps<N$1, C>, keyof DeprecatedNodeProps> & SlateHTMLProps<C, T>;
180
+ declare const SlateLeaf: <N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = "span">({
181
+ className,
182
+ ...props
183
+ }: StyledSlateLeafProps<N$1, C, T>) => React$1.ReactElement;
184
+ //#endregion
185
+ //#region src/static/deserialize/htmlStringToEditorDOM.d.ts
186
+ /**
187
+ * Convert HTML string exported from Plate into HTML element.
188
+ *
189
+ * @param html - The HTML string to convert exported from Plate.
190
+ * @returns The Editor element without head and body.
191
+ */
192
+ declare const getEditorDOMFromHtmlString: (html: string) => HTMLElement;
193
+ //#endregion
194
+ //#region src/static/editor/withStatic.d.ts
195
+ type CreateStaticEditorOptions<V extends Value = Value, P extends AnyPluginConfig = CorePlugin> = CreateSlateEditorOptions<V, P> & {};
196
+ declare const createStaticEditor: <V extends Value = Value, P extends AnyPluginConfig = CorePlugin>({
197
+ editor,
198
+ ...options
199
+ }?: CreateStaticEditorOptions<V, P>) => TSlateEditor<V, P>;
200
+ //#endregion
201
+ //#region ../slate/dist/index.d.ts
202
+ //#region src/internal/dom-editor/findDocumentOrShadowRoot.d.ts
203
+ declare const findDocumentOrShadowRoot: (editor: Editor$1) => Document | ShadowRoot | undefined;
204
+ //#endregion
205
+ //#region src/internal/dom-editor/findEventRange.d.ts
206
+ declare const findEventRange: (editor: Editor$1, event: any) => slate0.BaseRange | undefined;
207
+ //#endregion
208
+ //#region src/internal/dom-editor/findKey.d.ts
209
+ declare const findKey: (editor: Editor$1, node: TNode$1) => slate_dom0.Key | undefined;
210
+ //#endregion
211
+ //#region src/internal/dom-editor/getWindow.d.ts
212
+ declare const getWindow: (editor: Editor$1) => Window | undefined;
213
+ //#endregion
214
+ //#region src/internal/dom-editor/hasDOMNode.d.ts
215
+ declare const hasDOMNode: (editor: Editor$1, target: DOMNode, options?: Parameters<typeof DOMEditor.hasDOMNode>[2]) => boolean;
216
+ //#endregion
217
+ //#region src/internal/dom-editor/hasRange.d.ts
218
+ declare const hasRange: (editor: Editor$1, range: TRange$1) => boolean;
219
+ //#endregion
220
+ //#region src/internal/dom-editor/isComposing.d.ts
221
+ declare const isComposing: (editor: Editor$1) => boolean;
222
+ //#endregion
223
+ //#region src/internal/dom-editor/isFocused.d.ts
224
+ declare const isFocused: (editor: Editor$1) => boolean;
225
+ //#endregion
226
+ //#region src/internal/dom-editor/isReadOnly.d.ts
227
+ declare const isReadOnly: (editor: Editor$1) => boolean;
228
+ //#endregion
229
+ //#region src/internal/dom-editor/isTargetInsideNonReadonlyVoid.d.ts
230
+ declare const isTargetInsideNonReadonlyVoid: (editor: Editor$1, target: EventTarget | null) => boolean;
231
+ //#endregion
232
+ //#region src/types.d.ts
233
+ type At = TLocation | TNode$1;
234
+ type AtOrDescendant = Descendant$1 | TLocation;
235
+ type LeafEdge = 'end' | 'start';
236
+ type TextUnit = 'block' | 'character' | 'line' | 'word';
237
+ type TextUnitAdjustment = TextUnit | 'offset';
238
+ type TSelection$1 = Selection;
239
+ //#endregion
240
+ //#region src/interfaces/point.d.ts
241
+ type Point = {
242
+ /** The index of the character in the text node. */
243
+ offset: number;
244
+ /** The path to the text node. */
245
+ path: Path$2;
246
+ };
247
+ /** Point retrieval, check and transform methods. */
248
+
249
+ //#endregion
250
+ //#region src/interfaces/range.d.ts
251
+ /**
252
+ * `TRange` objects are a set of points that refer to a specific span of a Slate
253
+ * document. They can define a span inside a single node or a can span across
254
+ * multiple nodes.
255
+ */
256
+ type TRange$1 = {
257
+ /** The start point of the range. */
258
+ anchor: Point;
259
+ /** The end point of the range. */
260
+ focus: Point;
261
+ };
262
+ //#endregion
263
+ //#region src/interfaces/operation.d.ts
264
+ /**
265
+ * `Operation` objects define the low-level instructions that Slate editors use
266
+ * to apply changes to their internal state. Representing all changes as
267
+ * operations is what allows Slate editors to easily implement history,
268
+ * collaboration, and other features.
269
+ */
270
+ type Operation$1<N$1 extends Descendant$1 = Descendant$1> = NodeOperation$1<N$1> | SelectionOperation | TextOperation$1;
271
+ /** Operation manipulation and check methods. */
272
+
273
+ type InsertNodeOperation<N$1 extends Descendant$1 = Descendant$1> = {
274
+ [key: string]: unknown;
275
+ node: N$1;
276
+ path: Path$2;
277
+ type: 'insert_node';
278
+ };
279
+ type InsertTextOperation = {
280
+ [key: string]: unknown;
281
+ offset: number;
282
+ path: Path$2;
283
+ text: string;
284
+ type: 'insert_text';
285
+ };
286
+ type MergeNodeOperation<N$1 extends Descendant$1 = Descendant$1> = {
287
+ [key: string]: unknown;
288
+ path: Path$2;
289
+ position: number;
290
+ properties: Partial<NodeProps<N$1>>;
291
+ type: 'merge_node';
292
+ };
293
+ type MoveNodeOperation = {
294
+ [key: string]: unknown;
295
+ newPath: Path$2;
296
+ path: Path$2;
297
+ type: 'move_node';
298
+ };
299
+ type NodeOperation$1<N$1 extends Descendant$1 = Descendant$1> = InsertNodeOperation<N$1> | MergeNodeOperation<N$1> | MoveNodeOperation | RemoveNodeOperation<N$1> | SetNodeOperation<N$1> | SplitNodeOperation<N$1>;
300
+ type RemoveNodeOperation<N$1 extends Descendant$1 = Descendant$1> = {
301
+ [key: string]: unknown;
302
+ node: N$1;
303
+ path: Path$2;
304
+ type: 'remove_node';
305
+ };
306
+ type RemoveTextOperation = {
307
+ [key: string]: unknown;
308
+ offset: number;
309
+ path: Path$2;
310
+ text: string;
311
+ type: 'remove_text';
312
+ };
313
+ type SelectionOperation = SetSelectionOperation;
314
+ type SetNodeOperation<N1 extends Descendant$1 = Descendant$1, N2 extends Descendant$1 = Descendant$1> = {
315
+ [key: string]: unknown;
316
+ newProperties: Partial<NodeProps<N1>>;
317
+ path: Path$2;
318
+ properties: Partial<NodeProps<N2>>;
319
+ type: 'set_node';
320
+ };
321
+ type SetSelectionOperation = {
322
+ [key: string]: unknown;
323
+ newProperties: null;
324
+ properties: TRange$1;
325
+ type: 'set_selection';
326
+ } | {
327
+ [key: string]: unknown;
328
+ newProperties: Partial<TRange$1>;
329
+ properties: Partial<TRange$1>;
330
+ type: 'set_selection';
331
+ } | {
332
+ [key: string]: unknown;
333
+ newProperties: TRange$1;
334
+ properties: null;
335
+ type: 'set_selection';
336
+ };
337
+ type SplitNodeOperation<N$1 extends Descendant$1 = Descendant$1> = {
338
+ [key: string]: unknown;
339
+ path: Path$2;
340
+ position: number;
341
+ properties: Partial<NodeProps<N$1>>;
342
+ type: 'split_node';
343
+ };
344
+ type TextOperation$1 = InsertTextOperation | RemoveTextOperation;
345
+ //#endregion
346
+ //#region src/interfaces/path.d.ts
347
+ /**
348
+ * `Path` arrays are a list of indexes that describe a node's exact position in
349
+ * a Slate node tree. Although they are usually relative to the root `Editor`
350
+ * object, they can be relative to any `Node` object.
351
+ */
352
+ type Path$2 = number[];
353
+ /** Path retrieval, check and transform methods. */
354
+
355
+ /**
356
+ * `TText` objects represent the nodes that contain the actual text content of a
357
+ * Slate document along with any formatting properties. They are always leaf
358
+ * nodes in the document tree as they cannot contain any children.
359
+ */
360
+ type TText$1 = {
361
+ text: string;
362
+ } & UnknownObject;
363
+ /** Text retrieval and check methods. */
364
+
365
+ type MarksIn<V extends Value$1> = MarksOf<V[number]>;
366
+ type MarksOf<N$1 extends TNode$1> = Simplify<UnionToIntersection<NodeProps<TextOf<N$1>>>>;
367
+ /** A utility type to get all the text node types from a root node type. */
368
+ type TextIn<V extends Value$1> = TextOf<V[number]>;
369
+ type TextOf<N$1 extends TNode$1> = Editor$1 extends N$1 ? TText$1 : TElement$1 extends N$1 ? TText$1 : N$1 extends Editor$1 ? TextOf<N$1['children'][number]> : N$1 extends TElement$1 ? Extract<N$1['children'][number], TText$1> | TextOf<N$1['children'][number]> : N$1 extends TText$1 ? N$1 : never;
370
+ //#endregion
371
+ //#region src/interfaces/node-entry.d.ts
372
+ /** Ancestor entry from a node. */
373
+
374
+ /**
375
+ * `NodeEntry` objects are returned when iterating over the nodes in a Slate
376
+ * document tree. They consist of the node and its `Path` relative to the root
377
+ * node in the document.
378
+ */
379
+ type NodeEntry$2<N$1 extends TNode$1 = TNode$1> = [N$1, Path$2];
380
+ /** Node entry from an editor. */
381
+
382
+ /**
383
+ * The `Descendant` union type represents nodes that are descendants in the
384
+ * tree. It is returned as a convenience in certain cases to narrow a value
385
+ * further than the more generic `Node` union.
386
+ */
387
+ type Descendant$1 = TElement$1 | TText$1;
388
+ /** Convenience type for returning the props of a node. */
389
+ type NodeProps<N$1 extends TNode$1 = TNode$1> = N$1 extends Editor$1 ? Omit<N$1, 'children'> : N$1 extends TElement$1 ? Omit<N$1, 'children'> : Omit<N$1, 'text'>;
390
+ /**
391
+ * The `TNode` union type represents all of the different types of nodes that
392
+ * occur in a Slate document tree.
393
+ */
394
+ type TNode$1 = Editor$1 | TElement$1 | TText$1;
395
+ /** A utility type to get all the ancestor node types from a root node type. */
396
+ type AncestorIn<V extends Value$1> = AncestorOf<Editor$1 | V[number]>;
397
+ type AncestorOf<N$1 extends TNode$1> = Editor$1 extends N$1 ? Editor$1 | TElement$1 : TElement$1 extends N$1 ? TElement$1 : N$1 extends Editor$1 ? ElementOf<N$1['children'][number]> | N$1 | N$1['children'][number] : N$1 extends TElement$1 ? ElementOf<N$1> | N$1 : never;
398
+ /** A utility type to get the child node types from a root node type. */
399
+
400
+ /** A utility type to get all the descendant node types from a root node type. */
401
+ type DescendantIn$1<V extends Value$1> = DescendantOf<V[number]>;
402
+ type DescendantOf<N$1 extends TNode$1> = N$1 extends Editor$1 ? ElementOf<N$1> | TextOf<N$1> : N$1 extends TElement$1 ? ElementOf<N$1['children'][number]> | TextOf<N$1> : never;
403
+ /**
404
+ * The `Node` union type represents all of the different types of nodes that
405
+ * occur in a Slate document tree.
406
+ */
407
+
408
+ /** A utility type to get all possible node types from a Value type */
409
+ type NodeIn<V extends Value$1> = NodeOf$1<Editor$1 | V[number]>;
410
+ /** A utility type to get all the node types from a root node type. */
411
+ type NodeOf$1<N$1 extends TNode$1> = ElementOf<N$1> | N$1 | TextOf<N$1>;
412
+ //#endregion
413
+ //#region src/internal/dom-editor/toDOMNode.d.ts
414
+ declare const toDOMNode: (editor: Editor$1, node: TNode$1) => HTMLElement | undefined;
415
+ //#endregion
416
+ //#region src/internal/dom-editor/toDOMPoint.d.ts
417
+ declare const toDOMPoint: (editor: Editor$1, point: Point) => slate_dom0.DOMPoint | undefined;
418
+ //#endregion
419
+ //#region src/internal/dom-editor/toDOMRange.d.ts
420
+ declare const toDOMRange: (editor: Editor$1, range: TRange$1) => Range | undefined;
421
+ //#endregion
422
+ //#region src/internal/dom-editor/toSlateNode.d.ts
423
+ declare const toSlateNode: (editor: Editor$1, domNode: DOMNode) => TNode$1 | undefined;
424
+ //#endregion
425
+ //#region src/internal/dom-editor/toSlatePoint.d.ts
426
+ declare const toSlatePoint: (editor: Editor$1, domPoint: DOMPoint, options: Omit<Parameters<typeof DOMEditor.toSlatePoint>[2], "suppressThrow">) => slate0.BasePoint | null | undefined;
427
+ //#endregion
428
+ //#region src/internal/dom-editor/toSlateRange.d.ts
429
+ declare const toSlateRange: (editor: Editor$1, domRange: Parameters<typeof DOMEditor.toSlateRange>[1], options: Omit<Parameters<typeof DOMEditor.toSlateRange>[2], "supressThrow">) => slate0.BaseRange | null | undefined;
430
+ //#endregion
431
+ //#region src/internal/editor/createPathRef.d.ts
432
+ declare const createPathRef: (editor: Editor$1, at: Path$2, options?: EditorPathRefOptions) => slate0.PathRef;
433
+ //#endregion
434
+ //#region src/internal/editor/createPointRef.d.ts
435
+ declare const createPointRef: (editor: Editor$1, point: Point, options?: EditorPointRefOptions) => slate0.PointRef;
436
+ //#endregion
437
+ //#region src/internal/editor/createRangeRef.d.ts
438
+ declare const createRangeRef: (editor: Editor$1, range: TRange$1, options?: EditorRangeRefOptions) => slate0.RangeRef;
439
+ //#endregion
440
+ //#region src/internal/editor/editor-path.d.ts
441
+ declare const path$1: (editor: Editor$1, at: At, options?: EditorPathOptions) => slate0.Path | undefined;
442
+ //#endregion
443
+ //#region src/internal/editor/getEdgePoints.d.ts
444
+ declare const getEdgePoints: (editor: Editor$1, at: At) => [slate0.BasePoint, slate0.BasePoint] | undefined;
445
+ //#endregion
446
+ //#region src/internal/editor/getEditorString.d.ts
447
+ declare const getEditorString: (editor: Editor$1, at?: At | null, options?: EditorStringOptions) => string;
448
+ //#endregion
449
+ //#region src/internal/editor/getEndPoint.d.ts
450
+ declare const getEndPoint: (editor: Editor$1, at: At, options?: EditorEndOptions) => slate0.BasePoint | undefined;
451
+ //#endregion
452
+ //#region src/internal/editor/getPathRefs.d.ts
453
+ declare const getPathRefs: (editor: Editor$1) => Set<slate0.PathRef>;
454
+ //#endregion
455
+ //#region src/internal/editor/getPoint.d.ts
456
+ declare const getPoint: (editor: Editor$1, at: At, options?: EditorPointOptions) => slate0.BasePoint | undefined;
457
+ //#endregion
458
+ //#region src/internal/editor/getPointAfter.d.ts
459
+ declare const getPointAfter: (editor: Editor$1, at: At, options?: EditorAfterOptions) => slate0.BasePoint | undefined;
460
+ //#endregion
461
+ //#region src/internal/editor/getPointBefore.d.ts
462
+ declare const getPointBefore: (editor: Editor$1, at: At, options?: EditorBeforeOptions) => Point | undefined;
463
+ //#endregion
464
+ //#region src/internal/editor/getPointRefs.d.ts
465
+ declare const getPointRefs: (editor: Editor$1) => Set<slate0.PointRef>;
466
+ //#endregion
467
+ //#region src/internal/editor/getPositions.d.ts
468
+ declare const getPositions: (editor: Editor$1, options?: EditorPositionsOptions) => Generator<slate0.BasePoint, void, undefined>;
469
+ //#endregion
470
+ //#region src/internal/editor/getRangeRefs.d.ts
471
+ declare const getRangeRefs: (editor: Editor$1) => Set<slate0.RangeRef>;
472
+ //#endregion
473
+ //#region src/internal/editor/getStartPoint.d.ts
474
+ declare const getStartPoint: (editor: Editor$1, at: At, options?: EditorStartOptions) => slate0.BasePoint | undefined;
475
+ //#endregion
476
+ //#region src/internal/editor/hasBlocks.d.ts
477
+ declare const hasBlocks$1: (editor: Editor$1, element: TElement$1) => boolean;
478
+ //#endregion
479
+ //#region src/internal/editor/hasInlines.d.ts
480
+ declare const hasInlines$1: (editor: Editor$1, element: TElement$1) => boolean;
481
+ //#endregion
482
+ //#region src/internal/editor/hasTexts.d.ts
483
+ declare const hasTexts$1: (editor: Editor$1, element: TElement$1) => boolean;
484
+ //#endregion
485
+ //#region src/internal/editor/isBlock.d.ts
486
+ declare const isBlock$1: (editor: Editor$1, value: any) => value is TElement$1;
487
+ //#endregion
488
+ //#region src/internal/editor/isEdgePoint.d.ts
489
+ declare const isEdgePoint: (editor: Editor$1, point: Point, at: TLocation) => boolean;
490
+ //#endregion
491
+ //#region src/internal/editor/isEditorNormalizing.d.ts
492
+ declare const isEditorNormalizing: (editor: Editor$1) => boolean;
493
+ //#endregion
494
+ //#region src/internal/editor/isElementReadOnly.d.ts
495
+ declare const isElementReadOnly: <E extends Editor$1 = Editor$1>(editor: E, options?: EditorElementReadOnlyOptions) => slate0.NodeEntry<slate0.BaseElement> | undefined;
496
+ //#endregion
497
+ //#region src/internal/editor/isEmpty.d.ts
498
+ declare const isEmpty$1: <E extends Editor$1>(editor: E, target?: At | null, options?: EditorEmptyOptions) => boolean;
499
+ //#endregion
500
+ //#region src/internal/editor/isEndPoint.d.ts
501
+ declare const isEndPoint: (editor: Editor$1, point: Point | null | undefined, at: TLocation) => boolean;
502
+ //#endregion
503
+ //#region src/internal/editor/isStartPoint.d.ts
504
+ declare const isStartPoint: (editor: Editor$1, point: Point | null | undefined, at: TLocation) => boolean;
505
+ //#endregion
506
+ //#region src/internal/editor/range.d.ts
507
+ declare const range$1: (editor: Editor$1, at: At | "before" | "start", to?: At | null, options?: {
508
+ before?: EditorBeforeOptions;
509
+ }) => TRange$1 | undefined;
510
+ //#endregion
511
+ //#region src/internal/editor/unhangRange.d.ts
512
+ declare const unhangRange$1: (editor: Editor$1, range: TRange$1, options?: EditorUnhangRangeOptions) => TRange$1;
513
+ //#endregion
514
+ //#region src/internal/editor-extension/hasMark.d.ts
515
+ declare const hasMark: (editor: Editor$1, key: string) => boolean;
516
+ //#endregion
517
+ //#region src/internal/editor-extension/isAt.d.ts
518
+ /**
519
+ * Check if a location (point/range) is at a specific position.
520
+ *
521
+ * For ranges:
522
+ *
523
+ * - If text=true, check if range is in single text node
524
+ * - If block=true, check if range is in single block
525
+ * - If blocks=true, check if range is across multiple blocks
526
+ * - If start=true, check if range starts at block start
527
+ * - If end=true, check if range ends at block end
528
+ *
529
+ * For points:
530
+ *
531
+ * - If word=true, check relative to word boundaries
532
+ * - If start=true, check if at start
533
+ * - If end=true, check if at end
534
+ */
535
+ declare const isAt: <E extends Editor$1>(editor: E, {
536
+ at,
537
+ block,
538
+ blocks,
539
+ end,
540
+ start,
541
+ text,
542
+ word,
543
+ ...options
544
+ }?: {
545
+ /** The location to check. Defaults to current selection */
546
+ at?: TLocation | null;
547
+ /** Check if range is in single block */
548
+ block?: boolean;
549
+ /** Check if range is across multiple blocks */
550
+ blocks?: boolean;
551
+ /** Check if range ends at block end or point is at word end */
552
+ end?: boolean;
553
+ /** Check if range starts at block start */
554
+ start?: boolean;
555
+ /** Check if range is in single text node */
556
+ text?: boolean;
557
+ /** Check if point is at word boundary (only with end=true) */
558
+ word?: boolean;
559
+ } & Omit<EditorAboveOptions$1<ValueOf$1<E>>, "at" | "block">) => boolean;
560
+ //#endregion
561
+ //#region src/internal/editor-extension/isText.d.ts
562
+ /** Check if a node at a location is a Text node */
563
+ declare const isText$1: (editor: Editor$1, at: At) => boolean;
564
+ //#endregion
565
+ //#region src/interfaces/scroll.d.ts
566
+ type ScrollIntoViewOptions$1 = StandardBehaviorOptions | boolean;
567
+ //#endregion
568
+ //#region src/internal/editor-extension/scrollIntoView.d.ts
569
+ declare function scrollIntoView(editor: Editor$1, target: DOMRange$1 | Point, options?: ScrollIntoViewOptions$1): void;
570
+ //#endregion
571
+ //#region src/internal/editor-extension/some.d.ts
572
+ /**
573
+ * Iterate through all of the nodes in the editor and break early for the first
574
+ * truthy match. Otherwise returns false.
575
+ */
576
+ declare const some: <E extends Editor$1 = Editor$1>(editor: E, options: EditorNodesOptions<ValueOf$1<E>>) => boolean;
577
+ //#endregion
578
+ //#region src/slate-history/with-history.d.ts
579
+ /**
580
+ * The `withHistory` plugin keeps track of the operation history of a Slate
581
+ * editor as operations are applied to it, using undo and redo stacks.
582
+ */
583
+
584
+ //#endregion
585
+ //#region src/utils/match.d.ts
586
+ type Predicate<T extends TNode$1> = PredicateFn<T> | PredicateObj;
587
+ type PredicateFn<T extends TNode$1> = (obj: T, path: Path$2) => boolean;
588
+ type PredicateObj = Record<string, any[] | any>;
589
+ /**
590
+ * Match the object with a predicate object or function. If predicate is:
591
+ *
592
+ * - Object: every predicate key/value should be in obj.
593
+ * - Function: it should return true.
594
+ */
595
+
596
+ //#endregion
597
+ //#region src/utils/queryNode.d.ts
598
+ /** Filter nodes. */
599
+ type QueryNodeOptions$1 = {
600
+ /** List of types that are valid. If empty or undefined - allow all. */
601
+ allow?: string[] | string | null;
602
+ /** List of types that are invalid. */
603
+ exclude?: string[] | string | null;
604
+ /** Query the node entry. */
605
+ filter?: <N$1 extends TNode$1>(entry: NodeEntry$2<N$1>) => boolean;
606
+ /** Valid path levels. */
607
+ level?: number[] | number | null;
608
+ /** Paths above that value are invalid. */
609
+ maxLevel?: number | null;
610
+ };
611
+ /** Query the node entry. */
612
+
613
+ //#endregion
614
+ //#region src/interfaces/location.d.ts
615
+ /**
616
+ * The `TLocation` interface is a union of the ways to refer to a specific
617
+ * location in a Slate document: paths, points or ranges.
618
+ *
619
+ * Methods will often accept a `Location` instead of requiring only a `Path`,
620
+ * `Point` or `TRange`. This eliminates the need for developers to manage
621
+ * converting between the different interfaces in their own code base.
622
+ */
623
+ type TLocation = Path$2 | Point | TRange$1;
624
+ /** Location check methods. */
625
+
626
+ /**
627
+ * The `Span` interface is a low-level way to refer to locations in nodes
628
+ * without using `Point` which requires leaf text nodes to be present.
629
+ */
630
+ type Span$1 = [Path$2, Path$2];
631
+ //#endregion
632
+ //#region src/interfaces/editor/editor-api.d.ts
633
+ type EditorAboveOptions$1<V extends Value$1 = Value$1> = QueryOptions<V> & QueryMode & QueryVoids;
634
+ type EditorAfterOptions = {
635
+ distance?: number;
636
+ } & QueryTextUnit & QueryVoids;
637
+ type EditorApi$1<V extends Value$1 = Value$1> = {
638
+ /** Get the fragment at a location or selection. */
639
+ fragment: <N$1 extends ElementOrTextIn<V>>(at?: At | null, options?: EditorFragmentOptions) => N$1[];
640
+ /** Get the dirty paths of the editor. */
641
+ getDirtyPaths: <N$1 extends DescendantIn$1<V>>(operation: Operation$1<N$1>) => Path$2[];
642
+ /**
643
+ * Returns the fragment at the current selection. Used when cutting or
644
+ * copying, as an example, to get the fragment at the current selection.
645
+ */
646
+ getFragment: (at?: At) => ElementOrTextIn<V>[];
647
+ /** Check if a value is a read-only `Element` object. */
648
+ isElementReadOnly: <N$1 extends ElementIn<V>>(element: N$1) => boolean;
649
+ /** Check if a path is selected by the current selection. */
650
+ isSelected: (target: Path$2 | TRange$1, options?: EditorIsSelectedOptions) => boolean;
651
+ /** Check if a value is a void `Element` object. */
652
+ isVoid: <N$1 extends ElementIn<V>>(element: N$1) => boolean;
653
+ /** Check if a value is a markable `Element` object. */
654
+ markableVoid: <N$1 extends ElementIn<V>>(element: N$1) => boolean;
655
+ /**
656
+ * Manually set if the editor should currently be normalizing. Note: Using
657
+ * this incorrectly can leave the editor in an invalid state.
658
+ */
659
+ setNormalizing: (isNormalizing: boolean) => void;
660
+ /** Whether nodes should be merged. */
661
+ shouldMergeNodes: (prevNodeEntry: NodeEntry$2, curNodeEntry: NodeEntry$2, options?: {
662
+ reverse?: boolean;
663
+ }) => boolean;
664
+ /** Override this method to prevent normalizing the editor. */
665
+ shouldNormalize: (options: {
666
+ dirtyPaths: Path$2[];
667
+ initialDirtyPathsLength: number;
668
+ iteration: number;
669
+ operation?: Operation$1;
670
+ }) => boolean;
671
+ /**
672
+ * Override this method to prevent normalizing a specific node. Defaults to
673
+ * returning `true`.
674
+ */
675
+ shouldNormalizeNode: (entry: NodeEntry$2) => boolean;
676
+ /** Called when there is a change in the editor. */
677
+ onChange: (options?: {
678
+ operation?: Operation$1;
679
+ }) => void;
680
+ } & {
681
+ /**
682
+ * Get the point after a location.
683
+ *
684
+ * If there is no point after the location (e.g. we are at the bottom of the
685
+ * document) returns `undefined`.
686
+ */
687
+ after: OmitFirst<typeof getPointAfter>;
688
+ /**
689
+ * Returns the point before a location with optional matching criteria.
690
+ *
691
+ * If there is no point before the location (e.g. we are at the top of the
692
+ * document) returns `undefined`.
693
+ */
694
+ before: OmitFirst<typeof getPointBefore>;
695
+ /** Get the start and end points of a location. */
696
+ edges: OmitFirst<typeof getEdgePoints>;
697
+ /** Check if an element is read-only. */
698
+ elementReadOnly: OmitFirst<typeof isElementReadOnly>;
699
+ /** Get the end point of a location. */
700
+ end: OmitFirst<typeof getEndPoint>;
701
+ /** Check if a node has block children. */
702
+ hasBlocks: OmitFirst<typeof hasBlocks$1>;
703
+ /** Check if a node has inline and text children. */
704
+ hasInlines: OmitFirst<typeof hasInlines$1>;
705
+ /** Check if mark is active at selection */
706
+ hasMark: OmitFirst<typeof hasMark>;
707
+ /** Check if a node has text children. */
708
+ hasTexts: OmitFirst<typeof hasTexts$1>;
709
+ /** Check if a value is a block `Element` object. */
710
+ isBlock: OmitFirst<typeof isBlock$1>;
711
+ /** Check if a point is an edge of a location. */
712
+ isEdge: OmitFirst<typeof isEdgePoint>;
713
+ /**
714
+ * Check if an element is empty, accounting for void nodes.
715
+ *
716
+ * @example
717
+ * ```ts
718
+ * editor.api.isEmpty() // Check if editor is empty
719
+ * editor.api.isEmpty(at) // Check if nodes at location are empty
720
+ * editor.api.isEmpty(at, { after: true }) // Check if text after location is empty
721
+ * editor.api.isEmpty(at, { block: true }) // Check if block above location is empty
722
+ * ```;
723
+ */
724
+ isEmpty: OmitFirst<typeof isEmpty$1>;
725
+ /** Check if a point is the end point of a location. */
726
+ isEnd: OmitFirst<typeof isEndPoint>;
727
+ /** Check if the editor is currently normalizing after each operation. */
728
+ isNormalizing: OmitFirst<typeof isEditorNormalizing>;
729
+ /** Check if a point is the start point of a location. */
730
+ isStart: OmitFirst<typeof isStartPoint>;
731
+ /** Get the path of a location. */
732
+ path: OmitFirst<typeof path$1>;
733
+ /**
734
+ * Create a mutable ref for a `Path` object, which will stay in sync as new
735
+ * operations are applied to the editor.
736
+ */
737
+ pathRef: OmitFirst<typeof createPathRef>;
738
+ /** Get the set of currently tracked path refs of the editor. */
739
+ pathRefs: OmitFirst<typeof getPathRefs>;
740
+ /** Get the `start` or `end` (default is `start`) point of a location. */
741
+ point: OmitFirst<typeof getPoint>;
742
+ /**
743
+ * Create a mutable ref for a `Point` object, which will stay in sync as new
744
+ * operations are applied to the editor.
745
+ */
746
+ pointRef: OmitFirst<typeof createPointRef>;
747
+ /** Get the set of currently tracked point refs of the editor. */
748
+ pointRefs: OmitFirst<typeof getPointRefs>;
749
+ /**
750
+ * Iterate through all of the positions in the document where a `Point` can be
751
+ * placed. The first `Point` returns is always the starting point followed by
752
+ * the next `Point` as determined by the `unit` option. Note: By default void
753
+ * nodes are treated as a single point and iteration will not happen inside
754
+ * their content unless the voids option is set, then iteration will occur.
755
+ */
756
+ positions: OmitFirst<typeof getPositions>;
757
+ /**
758
+ * Get a range from a location to another location.
759
+ *
760
+ * @example
761
+ * ```ts
762
+ * editor.api.range(at, to) // From a location to another location
763
+ * editor.api.range('start', at) // From block start to a location
764
+ * editor.api.range('before', at, { before }) // From the point before a location
765
+ * ```;
766
+ */
767
+ range: OmitFirst<typeof range$1>;
768
+ /**
769
+ * Create a mutable ref for a `TRange` object, which will stay in sync as new
770
+ * operations are applied to the editor.
771
+ */
772
+ rangeRef: OmitFirst<typeof createRangeRef>;
773
+ /** Get the set of currently tracked range refs of the editor. */
774
+ rangeRefs: OmitFirst<typeof getRangeRefs>;
775
+ /** Get the start point of a location. */
776
+ start: OmitFirst<typeof getStartPoint>;
777
+ /**
778
+ * Get the text string content of a location.
779
+ *
780
+ * Note: by default the text of void nodes is considered to be an empty
781
+ * string, regardless of content, unless you pass in true for the voids
782
+ * option.
783
+ *
784
+ * @example
785
+ * ```ts
786
+ * editor.api.string() // Get selection string
787
+ * editor.api.string([]) // Get whole editor string
788
+ * editor.api.string(at) // Get string at location
789
+ * ```;
790
+ */
791
+ string: OmitFirst<typeof getEditorString>;
792
+ /**
793
+ * Convert a range into a non-hanging one.
794
+ *
795
+ * A "hanging" range is one created by the browser's "triple-click" selection
796
+ * behavior. When triple-clicking a block, the browser selects from the start
797
+ * of that block to the start of the _next_ block. The range thus "hangs over"
798
+ * into the next block. If `unhangRange` is given such a range, it moves the
799
+ * end backwards until it's in a non-empty text node that precedes the hanging
800
+ * block.
801
+ *
802
+ * Note that `unhangRange` is designed for the specific purpose of fixing
803
+ * triple-clicked blocks, and therefore currently has a number of caveats:
804
+ *
805
+ * - It does not modify the start of the range; only the end. For example, it
806
+ * does not "unhang" a selection that starts at the end of a previous
807
+ * block.
808
+ * - It only does anything if the start block is fully selected. For example, it
809
+ * does not handle ranges created by double-clicking the end of a paragraph
810
+ * (which browsers treat by selecting from the end of that paragraph to the
811
+ * start of the next).
812
+ */
813
+ unhangRange: OmitFirst<typeof unhangRange$1>;
814
+ /** Get the matching ancestor above a location in the document. */
815
+ above: <N$1 extends AncestorIn<V>>(options?: EditorAboveOptions$1<V>) => NodeEntry$2<N$1> | undefined;
816
+ /** Get the first node at a location. */
817
+ first: <N$1 extends DescendantIn$1<V>>(at: At) => NodeEntry$2<N$1> | undefined;
818
+ /** Get the fragment at a location. */
819
+ fragment: <N$1 extends ElementOrTextIn<V>>(at: At) => N$1[] | undefined;
820
+ /** Check if a path exists in the editor. */
821
+ hasPath: (path: Path$2) => boolean;
822
+ /** Get the last node at a location. */
823
+ last: <N$1 extends DescendantIn$1<V>>(at: At, options?: EditorLastOptions) => NodeEntry$2<N$1> | undefined;
824
+ /** Get the leaf text node at a location. */
825
+ leaf: <N$1 extends TextIn<V>>(at: At, options?: EditorLeafOptions) => NodeEntry$2<N$1> | undefined;
826
+ /** Iterate through all of the levels at a location. */
827
+ levels: <N$1 extends NodeIn<V>>(options?: EditorLevelsOptions<V>) => Generator<NodeEntry$2<N$1>, void, undefined>;
828
+ /** Get the marks that would be added to text at the current selection. */
829
+ marks: () => MarksIn<V> | null;
830
+ /**
831
+ * Get the matching node in the branch of the document after a location.
832
+ *
833
+ * Note: To find the next Point, and not the next Node, use the `Editor.after`
834
+ * method
835
+ */
836
+ next: <N$1 extends DescendantIn$1<V>>(options?: EditorNextOptions<V>) => NodeEntry$2<N$1> | undefined;
837
+ /**
838
+ * Get the node at a location or find the first node that matches options.
839
+ *
840
+ * @example
841
+ * ```ts
842
+ * editor.api.node([0]) // Get node at path [0]
843
+ * editor.api.node({ at: [], id: '1' }) // Find first node with id '1'
844
+ * editor.api.node({ at: path, block: true }) // Find first block at path
845
+ * ```;
846
+ */
847
+ node: <N$1 extends DescendantIn$1<V>>(atOrOptions: AtOrDescendant | EditorNodesOptions<V>, nodeOptions?: EditorNodeOptions) => NodeEntry$2<N$1> | undefined;
848
+ /**
849
+ * At any given `Location` or `Span` in the editor provided by `at` (default
850
+ * is the current selection), the method returns a Generator of `NodeEntry`
851
+ * objects that represent the nodes that include `at`. At the top of the
852
+ * hierarchy is the `Editor` object itself.
853
+ */
854
+ nodes: <N$1 extends DescendantIn$1<V>>(options?: EditorNodesOptions<V>) => Generator<NodeEntry$2<N$1>, void, undefined>;
855
+ /** Get the parent node of a location. */
856
+ parent: <N$1 extends AncestorIn<V>>(at: At, options?: EditorParentOptions) => NodeEntry$2<N$1> | undefined;
857
+ /**
858
+ * Get the matching node in the branch of the document before a location.
859
+ *
860
+ * Note: To find the previous Point, and not the previous Node, use the
861
+ * `Editor.before` method
862
+ */
863
+ previous: <N$1 extends DescendantIn$1<V>>(options?: EditorPreviousOptions<V>) => NodeEntry$2<N$1> | undefined;
864
+ /** Match a void node in the current branch of the editor. */
865
+ void: <N$1 extends ElementIn<V>>(options?: EditorVoidOptions) => NodeEntry$2<N$1> | undefined;
866
+ } & {
867
+ findDocumentOrShadowRoot: OmitFirst<typeof findDocumentOrShadowRoot>;
868
+ /** Get the target range from a DOM `event` */
869
+ findEventRange: OmitFirst<typeof findEventRange>;
870
+ /**
871
+ * Find a key for a Slate node. Returns an instance of `Key` which looks like
872
+ * `{ id: string }`
873
+ */
874
+ findKey: OmitFirst<typeof findKey>;
875
+ getWindow: OmitFirst<typeof getWindow>;
876
+ /** Check if a DOM node is within the editor */
877
+ hasDOMNode: OmitFirst<typeof hasDOMNode>;
878
+ hasRange: OmitFirst<typeof hasRange>;
879
+ /** Check if the user is currently composing inside the editor */
880
+ isComposing: OmitFirst<typeof isComposing>;
881
+ /** Check if the editor is focused */
882
+ isFocused: OmitFirst<typeof isFocused>;
883
+ /** Check if the editor is in read-only mode */
884
+ isReadOnly: OmitFirst<typeof isReadOnly>;
885
+ /** Check if the target is inside a non-readonly void element. */
886
+ isTargetInsideNonReadonlyVoid: OmitFirst<typeof isTargetInsideNonReadonlyVoid>;
887
+ /** Find the native DOM element from a Slate node */
888
+ toDOMNode: OmitFirst<typeof toDOMNode>;
889
+ /** Find a native DOM selection point from a Slate point */
890
+ toDOMPoint: OmitFirst<typeof toDOMPoint>;
891
+ /** Find a native DOM range from a Slate `range` */
892
+ toDOMRange: OmitFirst<typeof toDOMRange>;
893
+ /** Find a Slate point from a DOM selection's `domNode` and `domOffset`. */
894
+ toSlatePoint: OmitFirst<typeof toSlatePoint>;
895
+ /** Find a Slate range from a DOM range or selection. */
896
+ toSlateRange: OmitFirst<typeof toSlateRange>;
897
+ /**
898
+ * Find the path of Slate node. If DOM node is not found, it will use
899
+ * `findNodePath` (traversal method).
900
+ */
901
+ findPath: (node: TNode$1, options?: EditorFindPathOptions) => Path$2 | undefined;
902
+ hasEditableTarget: (target: EventTarget | null) => target is Node;
903
+ hasSelectableTarget: (target: EventTarget | null) => target is Node;
904
+ hasTarget: (target: EventTarget | null) => target is Node;
905
+ /** Find a Slate node from a native DOM `element` */
906
+ toSlateNode: <N$1 extends NodeIn<V>>(domNode: Parameters<typeof toSlateNode>[1]) => N$1 | undefined;
907
+ } & {
908
+ /** Get the merge flag's current value. */
909
+ isMerging: OmitFirst<typeof HistoryApi.isMerging>;
910
+ /** Get the saving flag's current value. */
911
+ isSaving: OmitFirst<typeof HistoryApi.isSaving>;
912
+ isSplittingOnce: OmitFirst<typeof HistoryApi.isSplittingOnce>;
913
+ } & {
914
+ create: {
915
+ /** Default block factory. */
916
+ block: (node?: Partial<TElement$1>, path?: Path$2) => TElement$1;
917
+ /** Default value factory. */
918
+ value: () => Value$1;
919
+ };
920
+ /**
921
+ * Check if a location (point/range) is at a specific position.
922
+ *
923
+ * @example
924
+ * ```ts
925
+ * // For ranges:
926
+ * editor.api.isAt({ text: true }) // Check if range is in single text node
927
+ * editor.api.isAt({ block: true }) // Check if range is in single block
928
+ * editor.api.isAt({ blocks: true }) // Check if range is across multiple blocks
929
+ * editor.api.isAt({ start: true }) // Check if range starts at block start
930
+ * editor.api.isAt({ end: true }) // Check if range ends at block end
931
+ *
932
+ * // For points:
933
+ * editor.api.isAt({ word: true }) // Check relative to word boundaries
934
+ * editor.api.isAt({ start: true }) // Check if at start
935
+ * editor.api.isAt({ end: true }) // Check if at end
936
+ * ```;
937
+ */
938
+ isAt: OmitFirst<typeof isAt>;
939
+ /** Check if a node at a location is a Text node */
940
+ isText: OmitFirst<typeof isText$1>;
941
+ /**
942
+ * Scroll the editor to bring a target point into view.
943
+ *
944
+ * @param target - The point to scroll into view
945
+ * @param options - Scroll options
946
+ */
947
+ scrollIntoView: OmitFirst<typeof scrollIntoView>;
948
+ /**
949
+ * Check if any node at a location (default: selection) matches the given
950
+ * criteria
951
+ */
952
+ some: OmitFirst<typeof some>;
953
+ /**
954
+ * Get the block at a location or find the first block that matches options.
955
+ * If `above` is true, get the block above the location, similar to
956
+ * `editor.api.above({ block: true })`. If `highest` is true, get the highest
957
+ * block at the location.
958
+ *
959
+ * @example
960
+ * ```ts
961
+ * editor.api.block() // Get block above selection
962
+ * editor.api.block({ above: true }) // Get block above selection
963
+ * editor.api.block({ at: [0, 0] }) // Get block at [0, 0]
964
+ * editor.api.block({ at: [0, 0], above: true }) // Get block at [0]
965
+ * editor.api.block({ highest: true }) // Get highest block at selection
966
+ * ```;
967
+ */
968
+ block: <N$1 extends ElementIn<V>>(options?: EditorBlockOptions<V>) => NodeEntry$2<N$1> | undefined;
969
+ /** Returns all matching blocks. */
970
+ blocks: <N$1 extends ElementIn<V>>(options?: EditorNodesOptions<V>) => NodeEntry$2<N$1>[];
971
+ /** Returns the first matching descendant. */
972
+ descendant: <N$1 extends DescendantIn$1<V>>(options: EditorNodesOptions<V>) => NodeEntry$2<N$1> | undefined;
973
+ /** Returns the edge blocks above a location (default: selection). */
974
+ edgeBlocks: <N1 extends ElementIn<V>, N2 extends ElementIn<V> = N1>(options?: EditorAboveOptions$1<V>) => [NodeEntry$2<N1>, NodeEntry$2<N2>] | null;
975
+ /** Check if the selection is collapsed */
976
+ isCollapsed: () => boolean;
977
+ /** Check if selection is at editor end */
978
+ isEditorEnd: () => boolean;
979
+ /** Check if the selection is expanded */
980
+ isExpanded: () => boolean;
981
+ /** Check if a value is an inline `Element` object. */
982
+ isInline: <N$1 extends DescendantIn$1<V>>(element: N$1) => boolean;
983
+ /** Check if a value is a selectable `Element` object. */
984
+ isSelectable: <N$1 extends ElementIn<V>>(element: N$1) => boolean;
985
+ /** Returns the selection mark value by key. */
986
+ mark: <K$1 extends keyof MarksIn<V>>(key: K$1) => MarksIn<V>[K$1] | null | undefined;
987
+ /** Returns the range spanning the given node entries. */
988
+ nodesRange: (nodes: NodeEntry$2[]) => TRange$1 | undefined;
989
+ /**
990
+ * Get a property value from a list of nodes. Returns undefined if the
991
+ * property value is not consistent across all nodes.
992
+ */
993
+ prop: (options: EditorPropOptions<V>) => string | undefined;
994
+ };
995
+ type EditorBeforeOptions = {
996
+ distance?: number;
997
+ } & QueryTextUnit & QueryVoids & {
998
+ /**
999
+ * If true, get the point after the matching point. If false, get the
1000
+ * matching point.
1001
+ */
1002
+ afterMatch?: boolean;
1003
+ /** Return block start point if no match found */
1004
+ matchBlockStart?: boolean;
1005
+ /**
1006
+ * If true, `matchString` will be interpreted as regex expression(s).
1007
+ * Otherwise, it will be compared by string equality.
1008
+ *
1009
+ * @default false
1010
+ */
1011
+ matchByRegex?: boolean;
1012
+ /** Lookup before the location for `matchString`. */
1013
+ matchString?: string[] | string;
1014
+ /**
1015
+ * If true, lookup until the start of the editor value. If false, lookup
1016
+ * until the first invalid character.
1017
+ */
1018
+ skipInvalid?: boolean;
1019
+ /** Lookup before the location until this predicate is true */
1020
+ match?: (value: {
1021
+ at: At;
1022
+ beforePoint: Point;
1023
+ beforeString: string;
1024
+ }) => boolean;
1025
+ };
1026
+ type EditorBlockOptions<V extends Value$1 = Value$1> = Omit<EditorNodesOptions<V>, 'block' | 'mode'> & {
1027
+ /**
1028
+ * If true, get the block above the location. This has no effect when `at` is
1029
+ * not a block path.
1030
+ */
1031
+ above?: boolean;
1032
+ /**
1033
+ * If true, get the highest block at the location. This will return the block
1034
+ * at the root level (path length 1).
1035
+ */
1036
+ highest?: boolean;
1037
+ };
1038
+ type EditorElementReadOnlyOptions = {
1039
+ at?: TLocation;
1040
+ } & QueryMode & QueryVoids;
1041
+ type EditorEmptyOptions = {
1042
+ /** Check if text after selection is empty */
1043
+ after?: boolean;
1044
+ /** Check if block above location is empty */
1045
+ block?: boolean;
1046
+ } & Omit<EditorNodesOptions, 'at' | 'block'>;
1047
+ type EditorEndOptions = {
1048
+ /** Get the end point of the previous node */
1049
+ previous?: boolean;
1050
+ };
1051
+ type EditorFindPathOptions = Omit<EditorNodesOptions<Value$1>, 'at' | 'block' | 'match'>;
1052
+ type EditorFragmentOptions = {
1053
+ /** Types of container nodes to unwrap */
1054
+ unwrap?: string[];
1055
+ };
1056
+ type EditorIsSelectedOptions = {
1057
+ /** Check if selection contains the entire path range */
1058
+ contains?: boolean;
1059
+ };
1060
+ type EditorLastOptions = {
1061
+ /** Get last node at this level (0-based). */
1062
+ level?: number;
1063
+ };
1064
+ type EditorLeafOptions = {
1065
+ depth?: number;
1066
+ edge?: LeafEdge;
1067
+ };
1068
+ type EditorLevelsOptions<V extends Value$1 = Value$1> = {
1069
+ reverse?: boolean;
1070
+ } & QueryOptions<V> & QueryVoids;
1071
+ type EditorNextOptions<V extends Value$1 = Value$1> = QueryOptions<V> & QueryVoids & {
1072
+ /**
1073
+ * Determines where to start traversing from:
1074
+ *
1075
+ * - `'after'` (default): Start from the point after the current location
1076
+ * - `'child'`: Start from the first child of the current path. `at` must be a
1077
+ * path.
1078
+ */
1079
+ from?: 'after' | 'child';
1080
+ /**
1081
+ * - `'all'` (default if `from` is `child`): Return all matching nodes.
1082
+ * - `'highest'`: in a hierarchy of nodes, only return the highest level
1083
+ * matching nodes
1084
+ * - `'lowest'` (default if `from` is `after`): in a hierarchy of nodes, only
1085
+ * return the lowest level matching nodes
1086
+ */
1087
+ mode?: 'all' | 'highest' | 'lowest';
1088
+ };
1089
+ type EditorNodeOptions = {
1090
+ depth?: number;
1091
+ edge?: LeafEdge;
1092
+ };
1093
+ type EditorNodesOptions<V extends Value$1 = Value$1> = {
1094
+ /** Where to start at. @default editor.selection */
1095
+ at?: At | Span$1;
1096
+ ignoreNonSelectable?: boolean;
1097
+ reverse?: boolean;
1098
+ universal?: boolean;
1099
+ } & Omit<QueryOptions<V>, 'at'> & QueryMode & QueryVoids;
1100
+ type EditorNormalizeOptions = {
1101
+ force?: boolean;
1102
+ operation?: Operation$1;
1103
+ };
1104
+ type EditorParentOptions = {
1105
+ depth?: number;
1106
+ edge?: LeafEdge;
1107
+ };
1108
+ type EditorPositionsOptions = {
1109
+ ignoreNonSelectable?: boolean;
1110
+ /**
1111
+ * When `true` returns the positions in reverse order. In the case of the
1112
+ * `unit` being `word`, the actual returned positions are different (i.e. we
1113
+ * will get the start of a word in reverse instead of the end).
1114
+ */
1115
+ reverse?: boolean;
1116
+ } & QueryAt & QueryVoids & QueryTextUnit;
1117
+ type EditorPreviousOptions<V extends Value$1 = Value$1> = QueryOptions<V> & QueryVoids & {
1118
+ /**
1119
+ * Determines where to start traversing from:
1120
+ *
1121
+ * - `'before'` (default): Start from the point before the current location
1122
+ * - `'parent'`: Start from the parent of the current location
1123
+ */
1124
+ from?: 'before' | 'parent';
1125
+ /**
1126
+ * - `'all'`: Return all matching nodes
1127
+ * - `'highest'`: in a hierarchy of nodes, only return the highest level
1128
+ * matching nodes
1129
+ * - `'lowest'` (default): in a hierarchy of nodes, only return the lowest
1130
+ * level matching nodes
1131
+ */
1132
+ mode?: 'all' | 'highest' | 'lowest';
1133
+ /** Get the previous sibling node */
1134
+ sibling?: boolean;
1135
+ };
1136
+ type EditorPropOptions<V extends Value$1 = Value$1> = {
1137
+ /** Nodes to get the property value from. */
1138
+ nodes: TElement$1[];
1139
+ /** Property key to get. */
1140
+ key?: string;
1141
+ /** Default value to return if property is not found. */
1142
+ defaultValue?: string;
1143
+ /**
1144
+ * - `'all'`: Get the property value from all nodes.
1145
+ * - `'block'`: Get the property value from the first block node.
1146
+ * - `'text'`: Get the property value from the first text node.
1147
+ */
1148
+ mode?: 'all' | 'block' | 'text';
1149
+ /** Function to get the property value from a node. */
1150
+ getProp?: (node: DescendantIn$1<V>) => any;
1151
+ };
1152
+ type EditorStartOptions = {
1153
+ /** Get the start point of the next node */
1154
+ next?: boolean;
1155
+ };
1156
+ type EditorStringOptions = QueryVoids;
1157
+ type EditorUnhangRangeOptions = {
1158
+ /**
1159
+ * When true, unhang a range of length 1 so both edges are in the same text
1160
+ * node. This is useful for handling ranges created by character-level
1161
+ * operations.
1162
+ */
1163
+ character?: boolean;
1164
+ /** @default true */
1165
+ unhang?: boolean;
1166
+ /** Allow placing the end of the selection in a void node */
1167
+ voids?: boolean;
1168
+ };
1169
+ type EditorVoidOptions = QueryAt & QueryMode & QueryVoids;
1170
+ type QueryAt = {
1171
+ /** Where to start at. @default editor.selection */
1172
+ at?: At;
1173
+ };
1174
+ type QueryMode = {
1175
+ /**
1176
+ * - `'all'` (default): Return all matching nodes
1177
+ * - `'highest'`: in a hierarchy of nodes, only return the highest level
1178
+ * matching nodes
1179
+ * - `'lowest'`: in a hierarchy of nodes, only return the lowest level matching
1180
+ * nodes
1181
+ */
1182
+ mode?: 'all' | 'highest' | 'lowest';
1183
+ };
1184
+ type QueryOptions<V extends Value$1 = Value$1> = {
1185
+ /** Match the node by id. `true` will match all nodes with an id. */
1186
+ id?: boolean | string;
1187
+ /** Match block nodes. */
1188
+ block?: boolean;
1189
+ /** When true, match only empty nodes. When false, match only non-empty nodes */
1190
+ empty?: boolean;
1191
+ /** Match the node. */
1192
+ match?: Predicate<NodeIn<V>>;
1193
+ /** When true, match only text nodes */
1194
+ text?: boolean;
1195
+ } & QueryAt;
1196
+ type QueryTextUnit = {
1197
+ /**
1198
+ * - `offset`: Moves to the next offset `Point`. It will include the `Point` at
1199
+ * the end of a `Text` object and then move onto the first `Point` (at the
1200
+ * 0th offset) of the next `Text` object. This may be counter-intuitive
1201
+ * because the end of a `Text` and the beginning of the next `Text` might be
1202
+ * thought of as the same position.
1203
+ * - `character`: Moves to the next `character` but is not always the next
1204
+ * `index` in the string. This is because Unicode encodings may require
1205
+ * multiple bytes to create one character. Unlike `offset`, `character` will
1206
+ * not count the end of a `Text` and the beginning of the next `Text` as
1207
+ * separate positions to return. Warning: The character offsets for Unicode
1208
+ * characters does not appear to be reliable in some cases like a Smiley
1209
+ * Emoji will be identified as 2 characters.
1210
+ * - `word`: Moves to the position immediately after the next `word`. In
1211
+ * `reverse` mode, moves to the position immediately before the previous
1212
+ * `word`.
1213
+ * - `line` | `block`: Starts at the beginning position and then the position at
1214
+ * the end of the block. Then starts at the beginning of the next block and
1215
+ * then the end of the next block.
1216
+ */
1217
+ unit?: TextUnitAdjustment;
1218
+ };
1219
+ type QueryVoids = {
1220
+ /** When `true` include void Nodes. */
1221
+ voids?: boolean;
1222
+ };
1223
+ //#endregion
1224
+ //#region src/internal/dom-editor/blur.d.ts
1225
+ declare const blur: (editor: Editor$1) => void;
1226
+ //#endregion
1227
+ //#region src/internal/dom-editor/deselectDOM.d.ts
1228
+ declare const deselectDOM: (editor: Editor$1) => void;
1229
+ //#endregion
1230
+ //#region src/internal/dom-editor/focus.d.ts
1231
+ declare const focus$1: (editor: Editor$1, {
1232
+ at,
1233
+ edge,
1234
+ retries
1235
+ }?: FocusOptions) => void;
1236
+ //#endregion
1237
+ //#region src/internal/editor/addMark.d.ts
1238
+ declare const addMark$1: (editor: Editor$1, key: string, value: any) => void;
1239
+ //#endregion
1240
+ //#region src/internal/editor/deleteBackward.d.ts
1241
+ declare const deleteBackward$1: (editor: Editor$1, unit?: TextUnit) => void;
1242
+ //#endregion
1243
+ //#region src/internal/editor/deleteForward.d.ts
1244
+ declare const deleteForward$1: (editor: Editor$1, unit?: TextUnit) => void;
1245
+ //#endregion
1246
+ //#region src/internal/editor/deleteFragment.d.ts
1247
+ declare const deleteFragment$1: (editor: Editor$1, options?: EditorFragmentDeletionOptions) => void;
1248
+ //#endregion
1249
+ //#region src/internal/editor/insertBreak.d.ts
1250
+ declare const insertBreak$1: (editor: Editor$1) => void;
1251
+ //#endregion
1252
+ //#region src/internal/editor/withoutNormalizing.d.ts
1253
+ declare const withoutNormalizing$1: (editor: Editor$1, fn: () => boolean | void) => boolean;
1254
+ //#endregion
1255
+ //#region src/internal/transforms/collapseSelection.d.ts
1256
+ declare const collapseSelection: (editor: Editor$1, options?: SelectionCollapseOptions) => void;
1257
+ //#endregion
1258
+ //#region src/internal/transforms/deleteText.d.ts
1259
+ declare const deleteText: <E extends Editor$1>(editor: E, options?: DeleteTextOptions) => void;
1260
+ //#endregion
1261
+ //#region src/internal/transforms/moveSelection.d.ts
1262
+ declare const moveSelection: (editor: Editor$1, options?: SelectionMoveOptions) => void;
1263
+ //#endregion
1264
+ //#region src/internal/transforms/select.d.ts
1265
+ declare const select$1: (editor: Editor$1, target?: At, options?: SelectOptions) => void;
1266
+ //#endregion
1267
+ //#region src/internal/transforms/setPoint.d.ts
1268
+ declare const setPoint$1: (editor: Editor$1, props: Partial<Point>, options?: SelectionSetPointOptions) => void;
1269
+ //#endregion
1270
+ //#region src/internal/transforms/setSelection.d.ts
1271
+ declare const setSelection$1: (editor: Editor$1, props: Partial<TRange$1>) => void;
1272
+ //#endregion
1273
+ //#region src/internal/transforms-extension/addMarks.d.ts
1274
+ declare const addMarks: (editor: Editor$1, marks: EditorMarks, {
1275
+ remove
1276
+ }?: AddMarksOptions) => void;
1277
+ //#endregion
1278
+ //#region src/internal/transforms-extension/duplicateNodes.d.ts
1279
+ declare const duplicateNodes: (editor: Editor$1, {
1280
+ block,
1281
+ nodes,
1282
+ ...options
1283
+ }?: DuplicateNodesOptions) => void;
1284
+ //#endregion
1285
+ //#region src/internal/transforms-extension/removeMarks.d.ts
1286
+ declare const removeMarks: (editor: Editor$1, keys?: string[] | string | null, {
1287
+ at,
1288
+ shouldChange,
1289
+ ...options
1290
+ }?: RemoveMarksOptions) => void;
1291
+ //#endregion
1292
+ //#region src/internal/transforms-extension/reset.d.ts
1293
+ declare const reset: (editor: Editor$1, options?: ResetOptions) => void;
1294
+ //#endregion
1295
+ //#region src/internal/transforms-extension/toggleBlock.d.ts
1296
+ declare const toggleBlock: (editor: Editor$1, type: string, {
1297
+ defaultType: defaultTypeProp,
1298
+ someOptions,
1299
+ wrap,
1300
+ ...options
1301
+ }?: ToggleBlockOptions) => void;
1302
+ //#endregion
1303
+ //#region src/internal/transforms-extension/toggleMark.d.ts
1304
+ /** Add or remove mark in the selection. */
1305
+ declare const toggleMark: (editor: Editor$1, key: string, {
1306
+ remove
1307
+ }?: ToggleMarkOptions) => void;
1308
+ //#endregion
1309
+ //#region src/interfaces/editor/editor-transforms.d.ts
1310
+ type AddMarksOptions = {
1311
+ /** Marks to remove before adding new ones */
1312
+ remove?: string[] | string;
1313
+ };
1314
+ type DeleteTextOptions = {
1315
+ distance?: number;
1316
+ hanging?: boolean;
1317
+ reverse?: boolean;
1318
+ unit?: TextUnit;
1319
+ } & QueryAt & QueryVoids & QueryTextUnit;
1320
+ type DuplicateNodesOptions<V extends Value$1 = Value$1> = {
1321
+ /** Location to get nodes from and insert after. Default: selection */
1322
+ at?: At;
1323
+ /** If true, duplicate blocks above location. Ignored if `nodes` is provided */
1324
+ block?: boolean;
1325
+ /** Specific nodes to duplicate. If provided, ignores `block` option */
1326
+ nodes?: NodeEntry$2[];
1327
+ } & Omit<InsertNodesOptions<V>, 'at' | 'block'>;
1328
+ type EditorTransforms$1<V extends Value$1 = Value$1> = {
1329
+ /**
1330
+ * Add a custom property to the leaf text nodes in the current selection.
1331
+ *
1332
+ * If the selection is currently collapsed, the marks will be added to the
1333
+ * `editor.marks` property instead, and applied when text is inserted next.
1334
+ */
1335
+ addMark: OmitFirst<typeof addMark$1>;
1336
+ /**
1337
+ * Add multiple marks to the leaf text nodes in the current selection. If
1338
+ * marks with the same keys exist, they will be removed first.
1339
+ *
1340
+ * @example
1341
+ * ```ts
1342
+ * editor.tf.addMarks({ bold: true, italic: true })
1343
+ * editor.tf.addMarks({ bold: subscript }, { remove: 'superscript' })
1344
+ * editor.tf.addMarks({ bold: true }, { remove: ['italic', 'underline'] })
1345
+ * ```;
1346
+ */
1347
+ addMarks: OmitFirst<typeof addMarks>;
1348
+ /** Delete content in the editor backward from the current selection. */
1349
+ deleteBackward: OmitFirst<typeof deleteBackward$1>;
1350
+ /** Delete content in the editor forward from the current selection. */
1351
+ deleteForward: OmitFirst<typeof deleteForward$1>;
1352
+ /** Delete the content of the current selection. */
1353
+ deleteFragment: OmitFirst<typeof deleteFragment$1>;
1354
+ /**
1355
+ * Duplicate nodes at a location. By default duplicates nodes at the current
1356
+ * selection. When `block: true`, duplicates the blocks above the location.
1357
+ */
1358
+ duplicateNodes: OmitFirst<typeof duplicateNodes>;
1359
+ /** Insert a block break at the current selection. */
1360
+ insertBreak: OmitFirst<typeof insertBreak$1>;
1361
+ /**
1362
+ * Remove marks from text nodes.
1363
+ *
1364
+ * - If `keys` is provided: removes specific mark(s) from text nodes
1365
+ * - If `at` is provided: removes from range
1366
+ * - If `at` is not provided and selection is expanded: removes marks only if
1367
+ * `keys` is provided
1368
+ * - If `at` is not provided and selection is collapsed: removes from
1369
+ * `editor.marks`
1370
+ *
1371
+ * - If `keys` is provided: removes specific mark(s)
1372
+ * - If `keys` is not provided: removes all marks
1373
+ *
1374
+ * If the selection is currently collapsed, the removal will be stored on
1375
+ * `editor.marks` and applied to the text inserted next.
1376
+ *
1377
+ * @example
1378
+ * ```ts
1379
+ * editor.tf.removeMarks() // Remove all marks from editor.marks
1380
+ * editor.tf.removeMarks('bold') // Remove bold mark at selection
1381
+ * editor.tf.removeMarks(['bold', 'italic']) // Remove multiple marks at selection
1382
+ * editor.tf.removeMarks('bold', { at: range }) // Remove bold in range
1383
+ * ```;
1384
+ */
1385
+ removeMarks: OmitFirst<typeof removeMarks>;
1386
+ /**
1387
+ * Reset the editor state. Use `children: true` to only reset children without
1388
+ * clearing history and operations
1389
+ */
1390
+ reset: OmitFirst<typeof reset>;
1391
+ /**
1392
+ * Toggle a block type. If wrap is true, wrap/unwrap the block in the
1393
+ * specified type. Otherwise, sets the block type directly.
1394
+ *
1395
+ * @example
1396
+ * ```ts
1397
+ * editor.tf.toggleBlock('blockquote') // Toggle blockquote
1398
+ * editor.tf.toggleBlock('list', { wrap: true }) // Toggle list wrapper
1399
+ * ```;
1400
+ */
1401
+ toggleBlock: OmitFirst<typeof toggleBlock>;
1402
+ /**
1403
+ * Toggle a mark on the leaf text nodes in the current selection. If the mark
1404
+ * exists, it will be removed. Otherwise, it will be added.
1405
+ *
1406
+ * When adding a mark, you can specify marks to remove first using the
1407
+ * `remove` option. This is useful for mutually exclusive marks like
1408
+ * subscript/superscript.
1409
+ *
1410
+ * @example
1411
+ * ```ts
1412
+ * editor.tf.toggleMark('bold') // Toggle bold mark
1413
+ * editor.tf.toggleMark('subscript', { remove: 'superscript' }) // Add subscript, remove superscript
1414
+ * ```;
1415
+ */
1416
+ toggleMark: OmitFirst<typeof toggleMark>;
1417
+ /**
1418
+ * Call a function, deferring normalization until after it completes
1419
+ *
1420
+ * @returns True if normalized.
1421
+ */
1422
+ withoutNormalizing: OmitFirst<typeof withoutNormalizing$1>;
1423
+ /**
1424
+ * Handle `Escape`.
1425
+ *
1426
+ * @returns `true` if the event is handled, `false` otherwise.
1427
+ */
1428
+ escape: () => boolean | undefined;
1429
+ /**
1430
+ * Insert of fragment of nodes at the specified location or (if not defined)
1431
+ * the current selection or (if not defined) the end of the document.
1432
+ */
1433
+ insertFragment: <N$1 extends ElementOrTextIn<V>>(fragment: N$1[], options?: InsertFragmentOptions) => void;
1434
+ /**
1435
+ * Atomically insert `node` at the specified location or (if not defined) the
1436
+ * current selection or (if not defined) the end of the document.
1437
+ */
1438
+ insertNode: <N$1 extends DescendantIn$1<V>>(node: N$1, options?: InsertNodesOptions<V>) => void;
1439
+ /**
1440
+ * Atomically inserts `nodes` at the specified location or (if not defined)
1441
+ * the current selection or (if not defined) the end of the document.
1442
+ */
1443
+ insertNodes: <N$1 extends ElementOrTextIn<V>>(nodes: N$1 | N$1[], options?: InsertNodesOptions<V>) => void;
1444
+ /**
1445
+ * Insert a soft break at the current selection. If the selection is currently
1446
+ * expanded, delete it first.
1447
+ */
1448
+ insertSoftBreak: () => void;
1449
+ /**
1450
+ * Lift nodes at the specified location upwards in the document tree. If
1451
+ * necessary, the parent node is split. If no location is specified, use the
1452
+ * selection.
1453
+ */
1454
+ liftNodes: (options?: LiftNodesOptions<V>) => void;
1455
+ /**
1456
+ * Merge a node at the specified location with the previous node at the same
1457
+ * depth. If no location is specified, use the selection. Resulting empty
1458
+ * container nodes are removed.
1459
+ */
1460
+ mergeNodes: (options?: MergeNodesOptions<V>) => void;
1461
+ /**
1462
+ * Handle `ArrowDown` and `ArrowUp` (reverse).
1463
+ *
1464
+ * @returns `true` if the event is handled, `false` otherwise.
1465
+ */
1466
+ moveLine: (options: {
1467
+ reverse: boolean;
1468
+ }) => boolean | undefined;
1469
+ /**
1470
+ * Move the nodes from an origin to a destination. A destination must be
1471
+ * specified in the `options`. If no origin is specified, move the selection.
1472
+ */
1473
+ moveNodes: (options: MoveNodesOptions<V>) => boolean | void;
1474
+ /** Normalize any dirty objects in the editor. */
1475
+ normalize: (options?: EditorNormalizeOptions) => void;
1476
+ /** Redo to the next saved state. */
1477
+ redo: () => void;
1478
+ /**
1479
+ * Remove a custom property from all of the leaf text nodes within non-void
1480
+ * nodes or void nodes that `editor.api.markableVoid()` allows in the current
1481
+ * selection.
1482
+ *
1483
+ * If the selection is currently collapsed, the removal will be stored on
1484
+ * `editor.marks` and applied to the text inserted next.
1485
+ */
1486
+ removeMark: (key: string) => void;
1487
+ /**
1488
+ * Remove nodes at the specified location in the document. If no location is
1489
+ * specified, remove the nodes in the selection.
1490
+ */
1491
+ removeNodes: (options?: RemoveNodesOptions<V>) => void;
1492
+ /**
1493
+ * Replace nodes at a location with new nodes.
1494
+ *
1495
+ * @example
1496
+ * ```ts
1497
+ * editor.tf.replaceNodes(node, { at }) // Replace node at location
1498
+ * editor.tf.replaceNodes(node, { at, select: true }) // Replace node then select
1499
+ * editor.tf.replaceNodes(node, { at, children: true }) // Replace children at location
1500
+ * ```;
1501
+ */
1502
+ replaceNodes: <N$1 extends ElementOrTextIn<V>>(nodes: N$1 | N$1[], options?: ReplaceNodesOptions<V>) => void;
1503
+ /**
1504
+ * Handle `mod+a`.
1505
+ *
1506
+ * @returns `true` if the event is handled, `false` otherwise.
1507
+ */
1508
+ selectAll: () => boolean | undefined;
1509
+ /**
1510
+ * Set properties of nodes at the specified location. If no location is
1511
+ * specified, use the selection.
1512
+ *
1513
+ * If `props` contains `undefined` values, the node's corresponding property
1514
+ * will also be set to `undefined` as opposed to ignored.
1515
+ */
1516
+ setNodes: <N$1 extends DescendantIn$1<V>>(props: Partial<NodeProps<N$1>>, options?: SetNodesOptions<V>) => void;
1517
+ /**
1518
+ * Split nodes at the specified location. If no location is specified, split
1519
+ * the selection.
1520
+ */
1521
+ splitNodes: (options?: SplitNodesOptions<V>) => void;
1522
+ /**
1523
+ * Handle `Tab`, `Shift+Tab` (reverse).
1524
+ *
1525
+ * @returns `true` if the event is handled, `false` otherwise.
1526
+ */
1527
+ tab: (options: {
1528
+ reverse: boolean;
1529
+ }) => boolean | undefined;
1530
+ /** Undo to the previous saved state. */
1531
+ undo: () => void;
1532
+ /**
1533
+ * Unset properties of nodes at the specified location. If no location is
1534
+ * specified, use the selection.
1535
+ */
1536
+ unsetNodes: <N$1 extends DescendantIn$1<V>>(props: (keyof NodeProps<N$1>)[] | keyof NodeProps<N$1>, options?: UnsetNodesOptions<V>) => void;
1537
+ /**
1538
+ * Unwrap nodes at the specified location. If necessary, the parent node is
1539
+ * split. If no location is specified, use the selection.
1540
+ */
1541
+ unwrapNodes: (options?: UnwrapNodesOptions<V>) => void;
1542
+ /**
1543
+ * Wrap nodes at the specified location in the `element` container. If no
1544
+ * location is specified, wrap the selection.
1545
+ */
1546
+ wrapNodes: <N$1 extends ElementIn<V>>(element: N$1, options?: WrapNodesOptions<V>) => void;
1547
+ /**
1548
+ * Push a batch of operations as either `undos` or `redos` onto `editor.undos`
1549
+ * or `editor.redos`
1550
+ */
1551
+ writeHistory: (stack: 'redos' | 'undos', batch: any) => void;
1552
+ } /** Text Transforms */ & {
1553
+ /** Delete text in the document. */
1554
+ delete: OmitFirst<typeof deleteText>;
1555
+ /**
1556
+ * Insert a string of text at the specified location or (if not defined) the
1557
+ * current selection or (if not defined) the end of the document.
1558
+ */
1559
+ insertText: (text: string, options?: InsertTextOptions) => void;
1560
+ } /** Selection Transforms */ & {
1561
+ /** Collapse the selection to a single point. */
1562
+ collapse: OmitFirst<typeof collapseSelection>;
1563
+ /** Move the selection's point forward or backward. */
1564
+ move: OmitFirst<typeof moveSelection>;
1565
+ /**
1566
+ * Set the selection to a new value specified by `at`. When a selection
1567
+ * already exists, this method is just a proxy for `setSelection` and will
1568
+ * update the existing value.
1569
+ *
1570
+ * @example
1571
+ * ```ts
1572
+ * editor.tf.select(at) // Select at location
1573
+ * editor.tf.select(at, { edge: 'end' }) // Select end of block above
1574
+ * editor.tf.select(at, { edge: 'start' }) // Select start of block above
1575
+ * ```;
1576
+ */
1577
+ select: OmitFirst<typeof select$1>;
1578
+ /** Set new properties on one of the selection's points. */
1579
+ setPoint: OmitFirst<typeof setPoint$1>;
1580
+ /**
1581
+ * Set new properties on an active selection. Since the value is a
1582
+ * `Partial<TRange>`, this method can only handle updates to an existing
1583
+ * selection. If there is no active selection the operation will be void. Use
1584
+ * `select` if you'd like to create a selection when there is none.
1585
+ */
1586
+ setSelection: OmitFirst<typeof setSelection$1>;
1587
+ /** Unset the selection. */
1588
+ deselect: () => void;
1589
+ } & {
1590
+ /** Blur the editor */
1591
+ blur: OmitFirst<typeof blur>;
1592
+ /** Deselect the editor. */
1593
+ deselectDOM: OmitFirst<typeof deselectDOM>;
1594
+ /**
1595
+ * Focus the editor.
1596
+ *
1597
+ * - If `at` is defined: select the location and focus
1598
+ * - If `edge` is defined: select the location (default: editor) edge ('start' |
1599
+ * 'end') and focus
1600
+ *
1601
+ * @example
1602
+ * ```ts
1603
+ * editor.tf.focus() // focus editor
1604
+ * editor.tf.focus({ edge: 'end' }) // end of selection if selection exists
1605
+ * editor.tf.focus({ edge: 'end' }) // end of editor if selection is null
1606
+ * ```;
1607
+ */
1608
+ focus: OmitFirst<typeof focus$1>;
1609
+ /**
1610
+ * Insert data from a `DataTransfer` into the editor. This is a proxy method
1611
+ * to call in this order `insertFragmentData(editor: Editor, data:
1612
+ * DataTransfer)` and then `insertTextData(editor: Editor, data:
1613
+ * DataTransfer)`.
1614
+ */
1615
+ insertData: DOMEditor['insertData'];
1616
+ /**
1617
+ * Insert fragment data from a `DataTransfer` into the editor. Returns true if
1618
+ * some content has been effectively inserted.
1619
+ */
1620
+ insertFragmentData: DOMEditor['insertFragmentData'];
1621
+ /**
1622
+ * Insert text data from a `DataTransfer` into the editor. Returns true if
1623
+ * some content has been effectively inserted.
1624
+ */
1625
+ insertTextData: DOMEditor['insertTextData'];
1626
+ /** Sets data from the currently selected fragment on a `DataTransfer`. */
1627
+ setFragmentData: DOMEditor['setFragmentData'];
1628
+ } & {
1629
+ setSplittingOnce: OmitFirst<typeof HistoryApi.setSplittingOnce>;
1630
+ /**
1631
+ * Apply a series of changes inside a synchronous `fn`, These operations will
1632
+ * be merged into the previous history.
1633
+ */
1634
+ withMerging: OmitFirst<typeof HistoryApi.withMerging>;
1635
+ /**
1636
+ * Apply a series of changes inside a synchronous `fn`, ensuring that the
1637
+ * first operation starts a new batch in the history. Subsequent operations
1638
+ * will be merged as usual.
1639
+ */
1640
+ withNewBatch: OmitFirst<typeof HistoryApi.withNewBatch>;
1641
+ /**
1642
+ * Apply a series of changes inside a synchronous `fn`, without merging any of
1643
+ * the new operations into previous save point in the history.
1644
+ */
1645
+ withoutMerging: OmitFirst<typeof HistoryApi.withoutMerging>;
1646
+ /**
1647
+ * Apply a series of changes inside a synchronous `fn`, without saving any of
1648
+ * their operations into the history.
1649
+ */
1650
+ withoutSaving: OmitFirst<typeof HistoryApi.withoutSaving>;
1651
+ } & {
1652
+ /** Apply an operation in the editor. */
1653
+ apply: <N$1 extends DescendantIn$1<V>>(operation: Operation$1<N$1>) => void;
1654
+ /** Normalize a Node according to the schema. */
1655
+ normalizeNode: <N$1 extends NodeIn<V>>(entry: NodeEntry$2<N$1>, options?: {
1656
+ operation?: Operation$1;
1657
+ }) => void;
1658
+ };
1659
+ type FocusOptions = {
1660
+ /** Target location to select before focusing */
1661
+ at?: At;
1662
+ /** Focus at location or editor edge. Default location is at or selection. */
1663
+ edge?: 'end' | 'endEditor' | 'start' | 'startEditor';
1664
+ /** Number of times to retry focusing */
1665
+ retries?: number;
1666
+ };
1667
+ type InsertFragmentOptions = {
1668
+ batchDirty?: boolean;
1669
+ hanging?: boolean;
1670
+ } & QueryAt & QueryVoids;
1671
+ type InsertNodesOptions<V extends Value$1 = Value$1> = {
1672
+ batchDirty?: boolean;
1673
+ hanging?: boolean;
1674
+ /**
1675
+ * Insert the nodes after the currect block. Does not apply if the removeEmpty
1676
+ * option caused the current block to be removed.
1677
+ */
1678
+ nextBlock?: boolean;
1679
+ /**
1680
+ * Remove the currect block if empty before inserting. Only applies to
1681
+ * paragraphs by default, but can be customized by passing a QueryNodeOptions
1682
+ * object.
1683
+ */
1684
+ removeEmpty?: QueryNodeOptions$1 | boolean;
1685
+ /** If true, select the inserted nodes. */
1686
+ select?: boolean;
1687
+ } & QueryOptions<V> & QueryMode & QueryVoids;
1688
+ type InsertTextOptions = {
1689
+ /** @default true */
1690
+ marks?: boolean;
1691
+ } & QueryAt & QueryVoids;
1692
+ type LiftNodesOptions<V extends Value$1 = Value$1> = QueryOptions<V> & QueryMode & QueryVoids;
1693
+ type MergeNodesOptions<V extends Value$1, _E extends Editor$1 = Editor$1> = {
1694
+ hanging?: boolean;
1695
+ /** Whether it's merging node from `deleteForward`. */
1696
+ reverse?: boolean;
1697
+ } & QueryOptions<V> & QueryMode & QueryVoids;
1698
+ type MoveNodesOptions<V extends Value$1 = Value$1> = {
1699
+ to: Path$2;
1700
+ /** Move only children of the node at location */
1701
+ children?: boolean;
1702
+ /** Start index of the children to move. Default: 0 */
1703
+ fromIndex?: number;
1704
+ } & QueryOptions<V> & QueryMode & QueryVoids;
1705
+ type RemoveMarksOptions = {
1706
+ /** Range where the mark(s) will be removed. Default: selection */
1707
+ at?: TRange$1;
1708
+ /** When true, trigger onChange if collapsed selection */
1709
+ shouldChange?: boolean;
1710
+ } & Omit<UnsetNodesOptions, 'match' | 'split'>;
1711
+ type RemoveNodesOptions<V extends Value$1 = Value$1> = {
1712
+ /** When true, remove all children of the node at the specified location */
1713
+ children?: boolean;
1714
+ event?: {
1715
+ type: 'mergeNodes';
1716
+ };
1717
+ hanging?: boolean;
1718
+ /** When true, remove the previous empty block if it exists */
1719
+ previousEmptyBlock?: boolean;
1720
+ } & QueryOptions<V> & QueryMode & QueryVoids;
1721
+ type ReplaceNodesOptions<V extends Value$1 = Value$1> = {
1722
+ /** When true, replace all children of the node at the specified location */
1723
+ children?: boolean;
1724
+ /** Options for removing nodes */
1725
+ removeNodes?: Omit<RemoveNodesOptions<V>, 'at'>;
1726
+ } & InsertNodesOptions<V>;
1727
+ type ResetOptions = {
1728
+ /** When true, only reset children without clearing history and operations */
1729
+ children?: boolean;
1730
+ } & Omit<ReplaceNodesOptions, 'at' | 'children'>;
1731
+ type SelectOptions = {
1732
+ /** Select edge of the block above location */
1733
+ edge?: 'end' | 'start';
1734
+ /** If true, focus the editor before selecting */
1735
+ focus?: boolean;
1736
+ /** Select start of next sibling */
1737
+ next?: boolean;
1738
+ /** Select end of previous sibling */
1739
+ previous?: boolean;
1740
+ };
1741
+ type SetNodesOptions<V extends Value$1 = Value$1> = {
1742
+ compare?: PropsCompare;
1743
+ hanging?: boolean;
1744
+ /**
1745
+ * When true, only apply to text nodes in non-void nodes or markable void
1746
+ * nodes
1747
+ */
1748
+ marks?: boolean;
1749
+ merge?: PropsMerge;
1750
+ split?: boolean;
1751
+ } & QueryOptions<V> & QueryMode & QueryVoids;
1752
+ type SplitNodesOptions<V extends Value$1 = Value$1> = {
1753
+ always?: boolean;
1754
+ height?: number;
1755
+ } & QueryOptions<V> & QueryMode & QueryVoids;
1756
+ type ToggleBlockOptions = {
1757
+ /** The default block type to revert to when untoggling. Defaults to paragraph. */
1758
+ defaultType?: string;
1759
+ someOptions?: EditorNodesOptions;
1760
+ /**
1761
+ * If true, toggles wrapping the block with the specified type. Otherwise,
1762
+ * toggles the block type directly.
1763
+ */
1764
+ wrap?: boolean;
1765
+ } & SetNodesOptions;
1766
+ type ToggleMarkOptions = {
1767
+ /** Mark keys to remove when adding the mark. */
1768
+ remove?: string[] | string;
1769
+ };
1770
+ type UnsetNodesOptions<V extends Value$1 = Value$1> = {
1771
+ hanging?: boolean;
1772
+ split?: boolean;
1773
+ } & QueryOptions<V> & QueryMode & QueryVoids;
1774
+ type UnwrapNodesOptions<V extends Value$1 = Value$1> = {
1775
+ hanging?: boolean;
1776
+ split?: boolean;
1777
+ } & QueryOptions<V> & QueryMode & QueryVoids;
1778
+ type WrapNodesOptions<V extends Value$1 = Value$1> = {
1779
+ /**
1780
+ * When true, wrap node children into a single element:
1781
+ *
1782
+ * - Wraps the first child node into the element
1783
+ * - Move the other child nodes next to the element children
1784
+ */
1785
+ children?: boolean;
1786
+ hanging?: boolean;
1787
+ /**
1788
+ * Indicates that it's okay to split a node in order to wrap the location. For
1789
+ * example, if `ipsum` was selected in a `Text` node with `lorem ipsum dolar`,
1790
+ * `split: true` would wrap the word `ipsum` only, resulting in splitting the
1791
+ * `Text` node. If `split: false`, the entire `Text` node `lorem ipsum dolar`
1792
+ * would be wrapped.
1793
+ */
1794
+ split?: boolean;
1795
+ } & QueryOptions<V> & QueryMode & QueryVoids;
1796
+ type PropsCompare = (prop: Partial<Descendant$1>, node: Partial<Descendant$1>) => boolean;
1797
+ type PropsMerge = (prop: Partial<Descendant$1>, node: Partial<Descendant$1>) => object;
1798
+ //#endregion
1799
+ //#region src/interfaces/editor/legacy-editor.d.ts
1800
+
1801
+ //#endregion
1802
+ //#region src/interfaces/element.d.ts
1803
+ /**
1804
+ * `TElement` objects are a type of node in a Slate document that contain other
1805
+ * element nodes or text nodes. They can be either "blocks" or "inlines"
1806
+ * depending on the Slate editor's configuration.
1807
+ */
1808
+ type TElement$1 = {
1809
+ children: Descendant$1[];
1810
+ type: string;
1811
+ } & UnknownObject;
1812
+ /** Element retrieval and check methods. */
1813
+
1814
+ /** A utility type to get all the element nodes type from a root node. */
1815
+ type ElementIn<V extends Value$1> = ElementOf<V[number]>;
1816
+ type ElementOf<N$1 extends TNode$1> = Editor$1 extends N$1 ? TElement$1 : TElement$1 extends N$1 ? TElement$1 : N$1 extends Editor$1 ? ElementOf<N$1['children'][number]> | Extract<N$1['children'][number], TElement$1> : N$1 extends TElement$1 ? ElementOf<N$1['children'][number]> | Extract<N$1['children'][number], TElement$1> | N$1 : never;
1817
+ /**
1818
+ * `ElementEntry` objects refer to an `Element` and the `Path` where it can be
1819
+ * found inside a root node.
1820
+ */
1821
+ /** Element or text of an editor. */
1822
+ type ElementOrTextIn<V extends Value$1> = ElementIn<V> | TextIn<V>;
1823
+ //#endregion
1824
+ //#region src/slate-history/history.d.ts
1825
+ /** `HistoryApi` contains helpers for history-enabled editors. */
1826
+ declare const HistoryApi: {
1827
+ /** Check if a value is a `History` object. */
1828
+ isHistory(value: any): value is History;
1829
+ /** Get the merge flag's current value. */
1830
+ isMerging(editor: Editor$1): boolean | undefined;
1831
+ /** Get the splitting once flag's current value. */
1832
+ isSaving(editor: Editor$1): boolean | undefined;
1833
+ isSplittingOnce(editor: Editor$1): boolean | undefined;
1834
+ /** Get the saving flag's current value. */
1835
+ redo(editor: Editor$1): void;
1836
+ /** Redo to the previous saved state. */
1837
+ setSplittingOnce(editor: Editor$1, value: boolean | undefined): void;
1838
+ /** Undo to the previous saved state. */
1839
+ undo(editor: Editor$1): void;
1840
+ /**
1841
+ * Apply a series of changes inside a synchronous `fn`, These operations will
1842
+ * be merged into the previous history.
1843
+ */
1844
+ withMerging(editor: Editor$1, fn: () => void): void;
1845
+ /**
1846
+ * Apply a series of changes inside a synchronous `fn`, ensuring that the
1847
+ * first operation starts a new batch in the history. Subsequent operations
1848
+ * will be merged as usual.
1849
+ */
1850
+ withNewBatch(editor: Editor$1, fn: () => void): void;
1851
+ /**
1852
+ * Apply a series of changes inside a synchronous `fn`, without merging any of
1853
+ * the new operations into previous save point in the history.
1854
+ */
1855
+ withoutMerging(editor: Editor$1, fn: () => void): void;
1856
+ /**
1857
+ * Apply a series of changes inside a synchronous `fn`, without saving any of
1858
+ * their operations into the history.
1859
+ */
1860
+ withoutSaving(editor: Editor$1, fn: () => void): void;
1861
+ };
1862
+ type History = {
1863
+ /** Redos of the editor. */
1864
+ redos: Batch[];
1865
+ /** Undos of the editor. */
1866
+ undos: Batch[];
1867
+ };
1868
+ /**
1869
+ * `History` objects hold all of the operations that are applied to a value, so
1870
+ * they can be undone or redone as necessary.
1871
+ */
1872
+ type Batch = {
1873
+ operations: Operation$1[];
1874
+ selectionBefore: TRange$1 | null;
1875
+ };
1876
+ //#endregion
1877
+ //#region src/interfaces/editor/editor-type.d.ts
1878
+ type Editor$1<V extends Value$1 = Value$1> = EditorBase$1<V> & {
1879
+ api: EditorApi$1<V>;
1880
+ tf: EditorTransforms$1<V>;
1881
+ transforms: EditorTransforms$1<V>;
1882
+ };
1883
+ type EditorBase$1<V extends Value$1 = Value$1> = {
1884
+ /** Unique identifier for the editor. */
1885
+ id: string;
1886
+ /** Value of the editor. */
1887
+ children: V;
1888
+ /** Contains the undos and redos of the editor. */
1889
+ history: History;
1890
+ /** Marks that are currently applied to the editor. */
1891
+ marks: EditorMarks | null;
1892
+ /**
1893
+ * Editor metadata. Use this for custom fields instead of extending the editor
1894
+ * directly.
1895
+ */
1896
+ meta: UnknownObject & {
1897
+ isNormalizing?: boolean;
1898
+ };
1899
+ /** Operations that have been applied to the editor. */
1900
+ operations: Operation$1<DescendantIn$1<V>>[];
1901
+ /** The current selection of the editor. */
1902
+ selection: EditorSelection;
1903
+ } & EditorMethods<V> & UnknownObject;
1904
+ type EditorMarks = Record<string, any>;
1905
+ type EditorMethods<V extends Value$1 = Value$1> = Pick<EditorTransforms$1<V>, 'redo' | 'undo'>;
1906
+ type EditorSelection = TRange$1 | null;
1907
+ type Value$1 = TElement$1[];
1908
+ /** A helper type for getting the value of an editor. */
1909
+ type ValueOf$1<E extends Editor$1> = E['children'];
1910
+ //#endregion
1911
+ //#region src/create-editor.d.ts
1912
+ //#endregion
1913
+ //#region src/static/plugins/ViewPlugin.d.ts
1914
+ declare const ViewPlugin: SlatePlugin<PluginConfig<"dom", {
1915
+ scrollMode?: ScrollMode;
1916
+ scrollOperations?: AutoScrollOperationsMap;
1917
+ scrollOptions?: ScrollIntoViewOptions$1;
1918
+ }, {
1919
+ getFragment: () => Descendant$1[];
1920
+ isScrolling: () => boolean;
1921
+ }, {
1922
+ withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
1923
+ }, {}>>;
1924
+ //#endregion
1925
+ //#region src/static/plugins/getStaticPlugins.d.ts
1926
+ declare const getStaticPlugins: () => SlatePlugin<PluginConfig<"dom", {
1927
+ scrollMode?: ScrollMode;
1928
+ scrollOperations?: AutoScrollOperationsMap;
1929
+ scrollOptions?: ScrollIntoViewOptions$1;
1930
+ }, {
1931
+ getFragment: () => Descendant$1[];
1932
+ isScrolling: () => boolean;
1933
+ }, {
1934
+ withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
1935
+ }, {}>>[];
1936
+ //#endregion
1937
+ //#region src/static/utils/createStaticString.d.ts
1938
+ declare function createStaticString({
1939
+ text
1940
+ }: {
1941
+ text: string;
1942
+ }): React$1.ReactElement<{
1943
+ 'data-slate-string': boolean;
1944
+ }, string | React$1.JSXElementConstructor<any>>;
1945
+ //#endregion
1946
+ //#region src/static/utils/getNodeDataAttributes.d.ts
1947
+ declare const getNodeDataAttributes: (editor: SlateEditor, node: TElement | TText, {
1948
+ isElement,
1949
+ isLeaf,
1950
+ isText
1951
+ }: {
1952
+ isElement?: boolean;
1953
+ isLeaf?: boolean;
1954
+ isText?: boolean;
1955
+ }) => Record<string, any>;
1956
+ declare const getPluginDataAttributes: (editor: SlateEditor, plugin: AnyEditorPlugin, node: TElement | TText) => {
1957
+ [x: string]: any;
1958
+ };
1959
+ //#endregion
1960
+ //#region src/static/utils/getRenderNodeStaticProps.d.ts
1961
+ declare const getRenderNodeStaticProps: ({
1962
+ attributes: nodeAttributes,
1963
+ editor,
1964
+ node,
1965
+ plugin,
1966
+ props
1967
+ }: {
1968
+ editor: SlateEditor;
1969
+ props: SlateRenderNodeProps;
1970
+ attributes?: AnyObject;
1971
+ node?: TElement | TText;
1972
+ plugin?: AnyEditorPlugin;
1973
+ }) => SlateRenderNodeProps;
1974
+ //#endregion
1975
+ //#region src/static/utils/getSelectedDomBlocks.d.ts
1976
+ /** Get the slate nodes from the DOM selection */
1977
+ /** @deprecated Use getSelectedDomFragment instead */
1978
+ declare const getSelectedDomBlocks: () => Element[] | undefined;
1979
+ //#endregion
1980
+ //#region src/static/utils/getSelectedDomFragment.d.ts
1981
+ declare const getSelectedDomFragment: (editor: SlateEditor) => Descendant[];
1982
+ //#endregion
1983
+ //#region src/static/utils/getSelectedDomNode.d.ts
1984
+ /** Get the DOM node from the DOM selection */
1985
+ declare const getSelectedDomNode: () => HTMLDivElement | undefined;
1986
+ //#endregion
1987
+ //#region src/static/utils/isSelectOutside.d.ts
1988
+ /** Check if the DOM selection is outside the editor */
1989
+ declare const isSelectOutside: (html?: HTMLElement) => boolean;
1990
+ //#endregion
1991
+ //#region src/static/utils/pipeDecorate.d.ts
1992
+ /**
1993
+ * @see {@link Decorate} .
1994
+ * Optimization: return undefined if empty list so Editable uses a memo.
1995
+ */
1996
+ declare const pipeDecorate: (editor: SlateEditor, decorateProp?: ((ctx: {
1997
+ editor: SlateEditor;
1998
+ entry: NodeEntry;
1999
+ }) => TRange[] | undefined) | null) => EditableProps["decorate"];
2000
+ //#endregion
2001
+ //#region src/static/utils/stripHtmlClassNames.d.ts
2002
+ /**
2003
+ * Remove all class names that do not start with one of preserveClassNames
2004
+ * (`slate-` by default)
2005
+ */
2006
+ declare const stripHtmlClassNames: (html: string, {
2007
+ preserveClassNames
2008
+ }: {
2009
+ preserveClassNames?: string[];
2010
+ }) => string;
2011
+ //#endregion
2012
+ //#region src/static/utils/stripSlateDataAttributes.d.ts
2013
+ declare const stripSlateDataAttributes: (rawHtml: string) => string;
2014
+ //#endregion
2015
+ //#region src/lib/plugin/SlatePlugin.d.ts
2016
+ type AnyEditorPlugin = EditorPlugin<AnyPluginConfig>;
2017
+ type AnySlatePlugin = SlatePlugin<AnyPluginConfig>;
2018
+ /**
2019
+ * Property used by Plate to decorate editor ranges. If the function returns
2020
+ * undefined then no ranges are modified. If the function returns an array the
2021
+ * returned ranges are merged with the ranges called by other plugins.
2022
+ */
2023
+ type Decorate<C extends AnyPluginConfig = PluginConfig> = (ctx: SlatePluginContext<C> & {
2024
+ entry: NodeEntry;
2025
+ }) => DecoratedRange[] | undefined;
2026
+ type Deserializer<C extends AnyPluginConfig = PluginConfig> = BaseDeserializer & {
2027
+ parse?: (options: AnyObject & SlatePluginContext<C> & {
2028
+ element: any;
2029
+ }) => Partial<Descendant> | undefined | void;
2030
+ query?: (options: AnyObject & SlatePluginContext<C> & {
2031
+ element: any;
2032
+ }) => boolean;
2033
+ };
2034
+ type EditorPlugin<C extends AnyPluginConfig = PluginConfig> = Omit<SlatePlugin<C>, keyof SlatePluginMethods | 'override' | 'plugins'>;
2035
+ /** Plate plugin overriding the `editor` methods. Naming convention is `with*`. */
2036
+ type ExtendEditor<C extends AnyPluginConfig = PluginConfig> = (ctx: SlatePluginContext<C>) => SlateEditor;
2037
+ type ExtendEditorApi<C extends AnyPluginConfig = PluginConfig, EA = {}> = (ctx: SlatePluginContext<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 };
2038
+ type ExtendEditorTransforms<C extends AnyPluginConfig = PluginConfig, EA = {}> = (ctx: SlatePluginContext<C>) => EA & 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 };
2039
+ type HtmlDeserializer<C extends AnyPluginConfig = PluginConfig> = BaseHtmlDeserializer & {
2040
+ /**
2041
+ * Whether to disable the default node props parsing logic. By default, all
2042
+ * data-slate-* attributes will be parsed into node props.
2043
+ *
2044
+ * @default false
2045
+ */
2046
+ disableDefaultNodeProps?: boolean;
2047
+ parse?: (options: SlatePluginContext<C> & {
2048
+ element: HTMLElement;
2049
+ node: AnyObject;
2050
+ }) => Partial<Descendant> | undefined | void;
2051
+ query?: (options: SlatePluginContext<C> & {
2052
+ element: HTMLElement;
2053
+ }) => boolean;
2054
+ toNodeProps?: (options: SlatePluginContext<C> & {
2055
+ element: HTMLElement;
2056
+ }) => Partial<Descendant> | undefined | void;
2057
+ };
2058
+ type HtmlSerializer<C extends AnyPluginConfig = PluginConfig> = BaseSerializer & {
2059
+ parse?: (options: SlatePluginContext<C> & {
2060
+ node: Descendant;
2061
+ }) => string;
2062
+ query?: (options: SlatePluginContext<C> & {
2063
+ node: Descendant;
2064
+ }) => boolean;
2065
+ };
2066
+ type InferConfig<P> = P extends SlatePlugin<infer C> ? C : never;
2067
+ type InjectNodeProps<C extends AnyPluginConfig = PluginConfig> = BaseInjectProps & {
2068
+ query?: (options: NonNullable<NonNullable<InjectNodeProps>> & SlatePluginContext<C> & {
2069
+ nodeProps: GetInjectNodePropsOptions;
2070
+ }) => boolean;
2071
+ transformClassName?: (options: TransformOptions<C>) => any;
2072
+ transformNodeValue?: (options: TransformOptions<C>) => any;
2073
+ transformProps?: (options: TransformOptions<C> & {
2074
+ props: GetInjectNodePropsReturnType;
2075
+ }) => AnyObject | undefined;
2076
+ transformStyle?: (options: TransformOptions<C>) => CSSStyleDeclaration;
2077
+ };
2078
+ type LeafStaticProps<C extends AnyPluginConfig = PluginConfig> = ((props: SlateRenderLeafProps<TText, C>) => AnyObject | undefined) | AnyObject;
2079
+ type NodeStaticProps<C extends AnyPluginConfig = PluginConfig> = ((props: SlateRenderElementProps<TElement, C> & SlateRenderLeafProps<TText, C>) => AnyObject | undefined) | AnyObject;
2080
+ /** @deprecated Use {@link RenderStaticNodeWrapper} instead. */
2081
+ type NodeStaticWrapperComponent<C extends AnyPluginConfig = PluginConfig> = (props: NodeStaticWrapperComponentProps<C>) => NodeStaticWrapperComponentReturnType<C>;
2082
+ /** @deprecated Use {@link RenderStaticNodeWrapperProps} instead. */
2083
+ interface NodeStaticWrapperComponentProps<C extends AnyPluginConfig = PluginConfig> extends SlateRenderElementProps<TElement, C> {
2084
+ key: string;
2085
+ }
2086
+ /** @deprecated Use {@link RenderStaticNodeWrapperFunction} instead. */
2087
+ type NodeStaticWrapperComponentReturnType<C extends AnyPluginConfig = PluginConfig> = React.FC<SlateRenderElementProps<TElement, C>> | undefined;
2088
+ type NormalizeInitialValue<C extends AnyPluginConfig = PluginConfig> = (ctx: SlatePluginContext<C> & {
2089
+ value: Value;
2090
+ }) => void;
2091
+ type OverrideEditor<C extends AnyPluginConfig = PluginConfig> = (ctx: SlatePluginContext<C>) => {
2092
+ 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 };
2093
+ 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 };
2094
+ };
2095
+ type Parser<C extends AnyPluginConfig = PluginConfig> = {
2096
+ format?: string[] | string;
2097
+ mimeTypes?: string[];
2098
+ deserialize?: (options: ParserOptions & SlatePluginContext<C>) => Descendant[] | undefined;
2099
+ preInsert?: (options: ParserOptions & SlatePluginContext<C> & {
2100
+ fragment: Descendant[];
2101
+ }) => HandlerReturnType;
2102
+ query?: (options: ParserOptions & SlatePluginContext<C>) => boolean;
2103
+ transformData?: (options: ParserOptions & SlatePluginContext<C>) => string;
2104
+ transformFragment?: (options: ParserOptions & SlatePluginContext<C> & {
2105
+ fragment: Descendant[];
2106
+ }) => Descendant[];
2107
+ };
2108
+ type PartialEditorPlugin<C extends AnyPluginConfig = PluginConfig> = Omit<Partial<EditorPlugin<C>>, 'node'> & {
2109
+ node?: Partial<EditorPlugin<C>['node']>;
2110
+ };
2111
+ type RenderStaticNodeWrapper<C extends AnyPluginConfig = PluginConfig> = (props: RenderStaticNodeWrapperProps<C>) => RenderStaticNodeWrapperFunction;
2112
+ type RenderStaticNodeWrapperFunction = ((hocProps: SlateRenderElementProps) => React.ReactNode) | undefined;
2113
+ interface RenderStaticNodeWrapperProps<C extends AnyPluginConfig = PluginConfig> extends SlateRenderElementProps<TElement, C> {
2114
+ key: string;
2115
+ }
2116
+ type Serializer<C extends AnyPluginConfig = PluginConfig> = BaseSerializer & {
2117
+ parse?: (options: AnyObject & SlatePluginContext<C> & {
2118
+ node: Descendant;
2119
+ }) => any;
2120
+ query?: (options: AnyObject & SlatePluginContext<C> & {
2121
+ node: Descendant;
2122
+ }) => boolean;
2123
+ };
2124
+ /** The `PlatePlugin` interface is a base interface for all plugins. */
2125
+ type SlatePlugin<C extends AnyPluginConfig = PluginConfig> = BasePlugin<C> & Nullable<{
2126
+ decorate?: Decorate<WithAnyKey<C>>;
2127
+ extendEditor?: ExtendEditor<WithAnyKey<C>>;
2128
+ normalizeInitialValue?: NormalizeInitialValue<WithAnyKey<C>>;
2129
+ }> & SlatePluginMethods<C> & {
2130
+ handlers: Nullable<{
2131
+ onNodeChange?: (ctx: SlatePluginContext<C> & {
2132
+ node: Descendant;
2133
+ operation: NodeOperation;
2134
+ prevNode: Descendant;
2135
+ }) => HandlerReturnType;
2136
+ onTextChange?: (ctx: SlatePluginContext<C> & {
2137
+ node: Descendant;
2138
+ operation: TextOperation;
2139
+ prevText: string;
2140
+ text: string;
2141
+ }) => HandlerReturnType;
2142
+ }>;
2143
+ inject: Nullable<{
2144
+ nodeProps?: InjectNodeProps<WithAnyKey<C>>;
2145
+ plugins?: Record<string, PartialEditorPlugin<AnyPluginConfig>>;
2146
+ targetPluginToInject?: (ctx: SlatePluginContext<C> & {
2147
+ targetPlugin: string;
2148
+ }) => Partial<SlatePlugin<AnyPluginConfig>>;
2149
+ }>;
2150
+ node: {
2151
+ /** Override `data-slate-leaf` element attributes */
2152
+ leafProps?: LeafStaticProps<WithAnyKey<C>>;
2153
+ /** Override node attributes */
2154
+ props?: NodeStaticProps<WithAnyKey<C>>;
2155
+ /** Override `data-slate-node="text"` element attributes */
2156
+ textProps?: TextStaticProps<WithAnyKey<C>>;
2157
+ };
2158
+ override: {
2159
+ components?: NodeComponents;
2160
+ plugins?: Record<string, PartialEditorPlugin<AnyPluginConfig>>;
2161
+ };
2162
+ parser: Nullable<Parser<WithAnyKey<C>>>;
2163
+ parsers: (Record<string, {
2164
+ deserializer?: Deserializer<WithAnyKey<C>>;
2165
+ serializer?: Serializer<WithAnyKey<C>>;
2166
+ }> & {
2167
+ html?: never;
2168
+ }) | {
2169
+ html?: Nullable<{
2170
+ deserializer?: HtmlDeserializer<WithAnyKey<C>>;
2171
+ serializer?: HtmlSerializer<WithAnyKey<C>>;
2172
+ }>;
2173
+ };
2174
+ /**
2175
+ * Recursive plugin support to allow having multiple plugins in a single
2176
+ * plugin. Plate eventually flattens all the plugins into the editor.
2177
+ */
2178
+ plugins: any[];
2179
+ render: Nullable<{
2180
+ /**
2181
+ * When other plugins' `node` components are rendered, this function can
2182
+ * return an optional wrapper function that turns a `node`'s props to a
2183
+ * wrapper React node as its parent. Useful for wrapping or decorating
2184
+ * nodes with additional UI elements.
2185
+ *
2186
+ * NOTE: The function can run React hooks. NOTE: Do not run React hooks
2187
+ * in the wrapper function. It is not equivalent to a React component.
2188
+ */
2189
+ aboveNodes?: RenderStaticNodeWrapper<WithAnyKey<C>>;
2190
+ /**
2191
+ * When other plugins' `node` components are rendered, this function can
2192
+ * return an optional wrapper function that turns a `node`'s props to a
2193
+ * wrapper React node. The wrapper node is the `node`'s child and its
2194
+ * original children's parent. Useful for wrapping or decorating nodes
2195
+ * with additional UI elements.
2196
+ *
2197
+ * NOTE: The function can run React hooks. NOTE: Do not run React hooks
2198
+ * in the wrapper function. It is not equivalent to a React component.
2199
+ */
2200
+ belowNodes?: RenderStaticNodeWrapper<WithAnyKey<C>>;
2201
+ /** Renders a component above the main Slate component, as its sibling. */
2202
+ aboveSlate?: () => React.ReactElement<any> | null;
2203
+ /** Renders a component after the main editor container. */
2204
+ afterContainer?: () => React.ReactElement<any> | null;
2205
+ /**
2206
+ * Renders a component after the `Editable` component. This is the last
2207
+ * render position within the editor structure.
2208
+ */
2209
+ afterEditable?: () => React.ReactElement<any> | null;
2210
+ /** Renders a component before the main editor container. */
2211
+ beforeContainer?: () => React.ReactElement<any> | null;
2212
+ /** Renders a component before the `Editable` component. */
2213
+ beforeEditable?: () => React.ReactElement<any> | null;
2214
+ /**
2215
+ * Function to render content below the root element but above its
2216
+ * children. Similar to belowNodes but renders directly in the element
2217
+ * rather than wrapping. Multiple plugins can provide this, and all
2218
+ * their content will be rendered in sequence.
2219
+ */
2220
+ belowRootNodes?: (props: SlateElementProps<TElement, AnySlatePlugin>) => React.ReactNode;
2221
+ }>;
2222
+ rules: {
2223
+ /**
2224
+ * Function to determine if this plugin's rules should apply to a node.
2225
+ * Used to override behavior based on node properties beyond just type
2226
+ * matching.
2227
+ *
2228
+ * Example: List plugin sets `match: ({ node }) => !!node.listStyleType`
2229
+ * to override paragraph behavior when the paragraph is a list item.
2230
+ *
2231
+ * @default type === node.type
2232
+ */
2233
+ match?: (options: {
2234
+ node: TElement;
2235
+ path: Path;
2236
+ rule: MatchRules;
2237
+ } & SlatePluginContext<C>) => boolean;
2238
+ };
2239
+ /**
2240
+ * Keyboard shortcuts configuration mapping shortcut names to their key
2241
+ * combinations and handlers. Each shortcut can link to a transform
2242
+ * method, an API method, or use a custom handler function.
2243
+ */
2244
+ shortcuts: Partial<Record<(string & {}) | Exclude<keyof InferApi<C>[C['key']], keyof InferTransforms<C>[C['key']]> | keyof InferTransforms<C>[C['key']], SlateShortcut | null>>;
2245
+ };
2246
+ type SlatePluginConfig$1<K$1 extends string = any, O = {}, A = {}, T = {}, S = {}, EO = {}, EA = {}, ET = {}, ES = {}> = Partial<Omit<SlatePlugin<PluginConfig<K$1, Partial<O>, A, T, S>>, keyof SlatePluginMethods | 'api' | 'node' | 'optionsStore' | 'transforms'> & {
2247
+ api: EA;
2248
+ node: Partial<SlatePlugin['node']>;
2249
+ options: EO;
2250
+ selectors: ES;
2251
+ transforms: ET;
2252
+ }>;
2253
+ type SlatePluginContext<C extends AnyPluginConfig = PluginConfig> = BasePluginContext<C> & {
2254
+ editor: SlateEditor;
2255
+ plugin: EditorPlugin<C>;
2256
+ };
2257
+ type SlatePluginMethods<C extends AnyPluginConfig = PluginConfig> = {
2258
+ __apiExtensions: ((ctx: SlatePluginContext<AnyPluginConfig>) => any)[];
2259
+ __configuration: ((ctx: SlatePluginContext<AnyPluginConfig>) => any) | null;
2260
+ __extensions: ((ctx: SlatePluginContext<AnyPluginConfig>) => any)[];
2261
+ __selectorExtensions: ((ctx: SlatePluginContext<AnyPluginConfig>) => any)[];
2262
+ clone: () => SlatePlugin<C>;
2263
+ configure: (config: ((ctx: SlatePluginContext<C>) => SlatePluginConfig$1<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>>) | SlatePluginConfig$1<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>>) => SlatePlugin<C>;
2264
+ configurePlugin: <P extends AnySlatePlugin>(plugin: Partial<P>, config: ((ctx: SlatePluginContext<P>) => SlatePluginConfig$1<any, InferOptions<P>, InferApi<P>, InferTransforms<P>, InferSelectors<P>>) | SlatePluginConfig$1<any, InferOptions<P>, InferApi<P>, InferTransforms<P>, InferSelectors<P>>) => SlatePlugin<C>;
2265
+ extend: <EO = {}, EA = {}, ET = {}, ES = {}>(extendConfig: ((ctx: SlatePluginContext<C>) => SlatePluginConfig$1<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>, EO, EA, ET, ES>) | SlatePluginConfig$1<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>, EO, EA, ET, ES>) => SlatePlugin<PluginConfig<C['key'], EO & InferOptions<C>, EA & InferApi<C>, ET & InferTransforms<C>, ES & InferSelectors<C>>>;
2266
+ extendApi: <EA extends Record<string, (...args: any[]) => any> = Record<string, never>>(extension: (ctx: SlatePluginContext<C>) => EA) => SlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C> & Record<C['key'], EA>, InferTransforms<C>, InferSelectors<C>>>;
2267
+ extendEditorApi: <EA extends Record<string, ((...args: any[]) => any) | Record<string, (...args: any[]) => any>> = Record<string, never>>(extension: ExtendEditorApi<C, EA>) => SlatePlugin<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>>>;
2268
+ extendEditorTransforms: <ET extends Record<string, ((...args: any[]) => any) | Record<string, (...args: any[]) => any>> = Record<string, never>>(extension: ExtendEditorTransforms<C, ET>) => SlatePlugin<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>>>;
2269
+ extendPlugin: <P extends AnySlatePlugin, EO = {}, EA = {}, ET = {}, ES = {}>(plugin: Partial<P>, extendConfig: ((ctx: SlatePluginContext<P>) => SlatePluginConfig$1<any, InferOptions<P>, InferApi<P>, InferTransforms<P>, InferSelectors<P>, EO, EA, ET, ES>) | SlatePluginConfig$1<any, InferOptions<P>, InferApi<P>, InferTransforms<P>, InferSelectors<P>, EO, EA, ET, ES>) => SlatePlugin<C>;
2270
+ extendSelectors: <ES extends Record<string, (...args: any[]) => any> = Record<string, never>>(extension: (ctx: SlatePluginContext<C>) => ES) => SlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C>, ES & InferSelectors<C>>>;
2271
+ extendTransforms: <ET extends Record<string, (...args: any[]) => any> = Record<string, never>>(extension: (ctx: SlatePluginContext<C>) => ET) => SlatePlugin<PluginConfig<C['key'], InferOptions<C>, InferApi<C>, InferTransforms<C> & Record<C['key'], ET>, InferSelectors<C>>>;
2272
+ overrideEditor: (override: OverrideEditor<C>) => SlatePlugin<C>;
2273
+ /** Returns a new instance of the plugin with the component. */
2274
+ withComponent: (component: NodeComponent) => SlatePlugin<C>;
2275
+ __resolved?: boolean;
2276
+ };
2277
+ type SlatePlugins = AnySlatePlugin[];
2278
+ type TextStaticProps<C extends AnyPluginConfig = PluginConfig> = ((props: SlateRenderTextProps<TText, C>) => AnyObject | undefined) | AnyObject;
2279
+ type TransformOptions<C extends AnyPluginConfig = PluginConfig> = BaseTransformOptions & SlatePluginContext<C>;
2280
+ type SlateShortcut = {
2281
+ keys?: (({} & string)[][] | readonly string[] | string) | null;
2282
+ delimiter?: string;
2283
+ description?: string;
2284
+ document?: Document;
2285
+ enabled?: Trigger;
2286
+ enableOnContentEditable?: boolean;
2287
+ enableOnFormTags?: boolean;
2288
+ ignoreEventWhenPrevented?: boolean;
2289
+ ignoreModifiers?: boolean;
2290
+ keydown?: boolean;
2291
+ keyup?: boolean;
2292
+ preventDefault?: Trigger;
2293
+ priority?: number;
2294
+ scopes?: readonly string[] | string;
2295
+ splitKey?: string;
2296
+ useKey?: boolean;
2297
+ handler?: (ctx: {
2298
+ editor: SlateEditor;
2299
+ event: KeyboardEvent;
2300
+ eventDetails: any;
2301
+ }) => boolean | void;
2302
+ ignoreEventWhen?: (e: KeyboardEvent) => boolean;
2303
+ };
2304
+ type Trigger = ((keyboardEvent: KeyboardEvent, hotkeysEvent: any) => boolean) | boolean;
2305
+ //#endregion
2306
+ //#region src/lib/plugin/createSlatePlugin.d.ts
2307
+ type SlatePluginConfig<K$1 extends string = any, O = {}, A = {}, T = {}, S = {}> = Omit<Partial<Modify<SlatePlugin<PluginConfig<K$1, O, A, T, S>>, {
2308
+ node?: Partial<SlatePlugin<PluginConfig<K$1, O, A, T, S>>['node']>;
2309
+ }>>, keyof SlatePluginMethods | 'optionsStore'>;
2310
+ type TSlatePluginConfig<C extends AnyPluginConfig = PluginConfig> = Omit<Partial<Modify<SlatePlugin<C>, {
2311
+ node?: Partial<SlatePlugin<C>['node']>;
2312
+ }>>, keyof SlatePluginMethods | 'optionsStore'>;
2313
+ /**
2314
+ * Creates a new Plate plugin with the given configuration.
2315
+ *
2316
+ * @remarks
2317
+ * - The plugin's key is required and specified by the K generic.
2318
+ * - The `__extensions` array stores functions to be applied when `resolvePlugin`
2319
+ * is called with an editor.
2320
+ * - The `extend` method adds new extensions to be applied later.
2321
+ * - The `extendPlugin` method extends an existing plugin (including nested
2322
+ * plugins) or adds a new one if not found.
2323
+ *
2324
+ * @example
2325
+ * const myPlugin = createSlatePlugin<
2326
+ * 'myPlugin',
2327
+ * MyOptions,
2328
+ * MyApi,
2329
+ * MyTransforms
2330
+ * >({
2331
+ * key: 'myPlugin',
2332
+ * options: { someOption: true },
2333
+ * transforms: { someTransform: () => {} },
2334
+ * });
2335
+ *
2336
+ * const extendedPlugin = myPlugin.extend({
2337
+ * options: { anotherOption: false },
2338
+ * });
2339
+ *
2340
+ * const pluginWithNestedExtension = extendedPlugin.extendPlugin(
2341
+ * nestedPlugin,
2342
+ * { options: { nestedOption: true } }
2343
+ * );
2344
+ *
2345
+ * @template K - The literal type of the plugin key.
2346
+ * @template O - The type of the plugin options.
2347
+ * @template A - The type of the plugin utilities.
2348
+ * @template T - The type of the plugin transforms.
2349
+ * @template S - The type of the plugin storage.
2350
+ * @param {Partial<SlatePlugin<K, O, A, T, S>>} config - The configuration
2351
+ * object for the plugin.
2352
+ * @returns {SlatePlugin<K, O, A, T, S>} A new Plate plugin instance with the
2353
+ * following properties and methods:
2354
+ *
2355
+ * - All properties from the input config, merged with default values.
2356
+ * - `configure`: A method to create a new plugin instance with updated options.
2357
+ * - `extend`: A method to create a new plugin instance with additional
2358
+ * configuration.
2359
+ * - `extendPlugin`: A method to extend an existing plugin (including nested
2360
+ * plugins) or add a new one if not found.
2361
+ */
2362
+ declare function createSlatePlugin<K$1 extends string = any, O = {}, A = {}, T = {}, S = {}>(config?: ((editor: SlateEditor) => SlatePluginConfig<K$1, O, A, T, S>) | SlatePluginConfig<K$1, O, A, T, S>): SlatePlugin<PluginConfig<K$1, O, A, T, S>>;
2363
+ /**
2364
+ * Explicitly typed version of `createSlatePlugin`.
2365
+ *
2366
+ * @remarks
2367
+ * While `createSlatePlugin` uses type inference, this function requires an
2368
+ * explicit type parameter. Use this when you need precise control over the
2369
+ * plugin's type structure or when type inference doesn't provide the desired
2370
+ * result.
2371
+ */
2372
+ declare function createTSlatePlugin<C extends AnyPluginConfig = PluginConfig>(config?: ((editor: SlateEditor) => TSlatePluginConfig<C>) | TSlatePluginConfig<C>): SlatePlugin<C>;
2373
+ //#endregion
2374
+ //#region src/lib/plugin/getEditorPlugin.d.ts
2375
+ declare function getEditorPlugin<P extends AnyPluginConfig | SlatePlugin<AnyPluginConfig>>(editor: SlateEditor, p: WithRequiredKey<P>): SlatePluginContext<InferConfig<P> extends never ? P : InferConfig<P>>;
2376
+ //#endregion
2377
+ //#region src/lib/plugin/getSlatePlugin.d.ts
2378
+ /** Get editor plugin by key or plugin object. */
2379
+ declare function getSlatePlugin<C extends AnyPluginConfig = PluginConfig>(editor: SlateEditor, p: WithRequiredKey<C>): C extends {
2380
+ node: any;
2381
+ } ? C : SlatePlugin<C>;
2382
+ /** Get editor plugin type by key or plugin object. */
2383
+ declare function getPluginType(editor: SlateEditor, key: string): string;
2384
+ /** Get editor plugin types by key. */
2385
+ declare const getPluginTypes: (editor: SlateEditor, keys: string[]) => string[];
2386
+ declare const getPluginKey: (editor: SlateEditor, type: string) => string | undefined;
2387
+ declare const getPluginKeys: (editor: SlateEditor, types: string[]) => string[];
2388
+ declare const getPluginByType: (editor: SlateEditor, type: string) => EditorPlugin<AnyPluginConfig> | null;
2389
+ declare const getContainerTypes: (editor: SlateEditor) => string[];
2390
+ //#endregion
2391
+ //#region src/lib/plugins/HistoryPlugin.d.ts
2392
+ declare const withPlateHistory: ExtendEditor;
2393
+ /** @see {@link withHistory} */
2394
+ declare const HistoryPlugin: SlatePlugin<PluginConfig<"history", {}, {}, {}, {}>>;
2395
+ //#endregion
2396
+ //#region src/lib/plugins/ParserPlugin.d.ts
2397
+ declare const ParserPlugin: SlatePlugin<PluginConfig<"parser", {}, {}, {}, {}>>;
2398
+ //#endregion
2399
+ //#region src/lib/plugins/slate-extension/transforms/init.d.ts
2400
+ type InitOptions = {
2401
+ autoSelect?: boolean | 'end' | 'start';
2402
+ selection?: TSelection;
2403
+ shouldNormalizeEditor?: boolean;
2404
+ value?: any;
2405
+ onReady?: (ctx: {
2406
+ editor: SlateEditor;
2407
+ isAsync: boolean;
2408
+ value: Value;
2409
+ }) => void;
2410
+ };
2411
+ declare const init: (editor: SlateEditor, {
2412
+ autoSelect,
2413
+ selection,
2414
+ shouldNormalizeEditor,
2415
+ value,
2416
+ onReady
2417
+ }: InitOptions) => void;
2418
+ //#endregion
2419
+ //#region src/lib/plugins/slate-extension/transforms/insertExitBreak.d.ts
2420
+ type InsertExitBreakOptions = {
2421
+ match?: EditorAboveOptions['match'];
2422
+ reverse?: boolean;
2423
+ };
2424
+ /**
2425
+ * Exits the current block structure by creating a new block next to the
2426
+ * appropriate ancestor.
2427
+ *
2428
+ * This function automatically determines the exit point by finding the first
2429
+ * ancestor that doesn't have strict sibling constraints (`isStrictSiblings:
2430
+ * false`), allowing standard text blocks to be inserted as siblings.
2431
+ *
2432
+ * For example:
2433
+ *
2434
+ * - In `column_group > column > codeblock > codeline`, exits after `codeblock`,
2435
+ * then after `column_group`
2436
+ * - In `table > tr > td > p`, exits after `table`
2437
+ */
2438
+ declare const insertExitBreak: (editor: SlateEditor, {
2439
+ match,
2440
+ reverse
2441
+ }?: InsertExitBreakOptions) => true | undefined;
2442
+ //#endregion
2443
+ //#region src/lib/plugins/slate-extension/transforms/resetBlock.d.ts
2444
+ /**
2445
+ * Reset the current block to a paragraph, removing all properties except id and
2446
+ * type.
2447
+ */
2448
+ declare const resetBlock: (editor: SlateEditor, {
2449
+ at
2450
+ }?: {
2451
+ at?: Path;
2452
+ }) => true | undefined;
2453
+ //#endregion
2454
+ //#region src/lib/plugins/slate-extension/transforms/setValue.d.ts
2455
+ declare const setValue: <V extends Value>(editor: SlateEditor, value?: V | string) => void;
2456
+ //#endregion
2457
+ //#region src/lib/plugins/slate-extension/SlateExtensionPlugin.d.ts
2458
+ type SlateExtensionConfig = PluginConfig<'slateExtension', {
2459
+ onNodeChange: (options: {
2460
+ editor: SlateEditor;
2461
+ node: Descendant;
2462
+ operation: NodeOperation;
2463
+ prevNode: Descendant;
2464
+ }) => void;
2465
+ onTextChange: (options: {
2466
+ editor: SlateEditor;
2467
+ node: Descendant;
2468
+ operation: TextOperation;
2469
+ prevText: string;
2470
+ text: string;
2471
+ }) => void;
2472
+ }, {}, {
2473
+ init: OmitFirst<typeof init>;
2474
+ insertExitBreak: OmitFirst<typeof insertExitBreak>;
2475
+ resetBlock: OmitFirst<typeof resetBlock>;
2476
+ setValue: OmitFirst<typeof setValue>;
2477
+ }>;
2478
+ /** Opinionated extension of slate default behavior. */
2479
+ declare const SlateExtensionPlugin: SlatePlugin<PluginConfig<"slateExtension", {
2480
+ onNodeChange: (options: {
2481
+ editor: SlateEditor;
2482
+ node: Descendant;
2483
+ operation: NodeOperation;
2484
+ prevNode: Descendant;
2485
+ }) => void;
2486
+ onTextChange: (options: {
2487
+ editor: SlateEditor;
2488
+ node: Descendant;
2489
+ operation: TextOperation;
2490
+ prevText: string;
2491
+ text: string;
2492
+ }) => void;
2493
+ }, {}, {
2494
+ init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
2495
+ insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
2496
+ resetBlock: ((args_0?: {
2497
+ at?: _platejs_slate1.Path;
2498
+ } | undefined) => true | undefined) & ((args_0?: {
2499
+ at?: _platejs_slate1.Path;
2500
+ } | undefined) => true | undefined);
2501
+ setValue: ((value?: string | _platejs_slate1.Value | undefined) => void) & ((value?: string | _platejs_slate1.Value | undefined) => void);
2502
+ apply: <N$1 extends _platejs_slate1.TElement | TText>(operation: _platejs_slate1.Operation<N$1>) => void;
2503
+ }, {}>>;
2504
+ //#endregion
2505
+ //#region src/lib/plugins/dom/withScrolling.d.ts
2506
+ type WithAutoScrollOptions = {
2507
+ mode?: ScrollMode;
2508
+ operations?: AutoScrollOperationsMap;
2509
+ scrollOptions?: ScrollIntoViewOptions;
2510
+ };
2511
+ declare const withScrolling: (editor: SlateEditor, fn: () => void, options?: WithAutoScrollOptions) => void;
2512
+ //#endregion
2513
+ //#region src/lib/plugins/dom/DOMPlugin.d.ts
2514
+ declare const AUTO_SCROLL: WeakMap<SlateEditor, boolean>;
2515
+ type AutoScrollOperationsMap = Partial<Record<Operation['type'], boolean>>;
2516
+ type DomConfig = PluginConfig<'dom', {
2517
+ /** Choose the first or last matching operation as the scroll target */
2518
+ scrollMode?: ScrollMode;
2519
+ /**
2520
+ * Operations map; false to disable an operation, true or undefined to
2521
+ * enable
2522
+ */
2523
+ scrollOperations?: AutoScrollOperationsMap;
2524
+ /** Options passed to scrollIntoView */
2525
+ scrollOptions?: ScrollIntoViewOptions;
2526
+ }>;
2527
+ /** Mode for picking target op when multiple enabled */
2528
+ type ScrollMode = 'first' | 'last';
2529
+ /**
2530
+ * Placeholder plugin for DOM interaction, that could be replaced with
2531
+ * ReactPlugin.
2532
+ */
2533
+ declare const DOMPlugin: SlatePlugin<PluginConfig<"dom", {
2534
+ /** Choose the first or last matching operation as the scroll target */
2535
+ scrollMode?: ScrollMode;
2536
+ /**
2537
+ * Operations map; false to disable an operation, true or undefined to
2538
+ * enable
2539
+ */
2540
+ scrollOperations?: AutoScrollOperationsMap;
2541
+ /** Options passed to scrollIntoView */
2542
+ scrollOptions?: ScrollIntoViewOptions;
2543
+ }, {
2544
+ isScrolling: () => boolean;
2545
+ }, {
2546
+ withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
2547
+ }, {}>>;
2548
+ //#endregion
2549
+ //#region src/lib/plugins/affinity/AffinityPlugin.d.ts
2550
+ type ElementAffinity = {
2551
+ affinity: 'backward' | 'forward';
2552
+ at: Path;
2553
+ type: string;
2554
+ };
2555
+ type AffinityConfig = PluginConfig<'affinity'>;
2556
+ declare const AffinityPlugin: SlatePlugin<AffinityConfig>;
2557
+ //#endregion
2558
+ //#region src/lib/plugins/affinity/types.d.ts
2559
+ type EdgeNodes = [NodeEntry$1<TElement | TText>, NodeEntry$1<TElement | TText>] | [NodeEntry$1<TElement | TText>, null] | [null, NodeEntry$1<TElement | TText>];
2560
+ //#endregion
2561
+ //#region src/lib/plugins/affinity/queries/getEdgeNodes.d.ts
2562
+ /**
2563
+ * When the cursor is at a mark edge, this function returns the inward node and
2564
+ * the outward node (if any). If the cursor is at the start of the text, then
2565
+ * the node before the text is returned. If the cursor is at the end of the
2566
+ * text, then the node after the text is returned. Otherwise, null is returned.
2567
+ */
2568
+ declare const getEdgeNodes: (editor: SlateEditor) => EdgeNodes | null;
2569
+ //#endregion
2570
+ //#region src/lib/plugins/affinity/queries/getMarkBoundaryAffinity.d.ts
2571
+ declare const getMarkBoundaryAffinity: (editor: SlateEditor, markBoundary: EdgeNodes) => "backward" | "forward" | undefined;
2572
+ //#endregion
2573
+ //#region src/lib/plugins/affinity/queries/isNodeAffinity.d.ts
2574
+ declare const isNodeAffinity: (editor: SlateEditor, node: TElement | TText, affinity: "directional" | "hard" | "outward") => boolean;
2575
+ declare const isNodesAffinity: (editor: SlateEditor, edgeNodes: EdgeNodes, affinity: "directional" | "hard" | "outward") => boolean | null;
2576
+ //#endregion
2577
+ //#region src/lib/plugins/affinity/transforms/setAffinitySelection.d.ts
2578
+ declare const setAffinitySelection: (editor: SlateEditor, edgeNodes: EdgeNodes, affinity: "backward" | "forward") => void;
2579
+ //#endregion
2580
+ //#region src/lib/plugins/debug/DebugPlugin.d.ts
2581
+ type DebugErrorType = (string & {}) | 'DEFAULT' | 'OPTION_UNDEFINED' | 'OVERRIDE_MISSING' | 'PLUGIN_DEPENDENCY_MISSING' | 'PLUGIN_MISSING' | 'USE_CREATE_PLUGIN' | 'USE_ELEMENT_CONTEXT';
2582
+ type LogLevel = 'error' | 'info' | 'log' | 'warn';
2583
+ declare class PlateError extends Error {
2584
+ type: DebugErrorType;
2585
+ constructor(message: string, type?: DebugErrorType);
2586
+ }
2587
+ declare const DebugPlugin: SlatePlugin<PluginConfig<"debug", {
2588
+ isProduction: boolean;
2589
+ logger: Partial<Record<LogLevel, (message: string, type?: DebugErrorType, details?: any) => void>>;
2590
+ logLevel: LogLevel;
2591
+ throwErrors: boolean;
2592
+ }, {
2593
+ debug: {
2594
+ error: (message: string | unknown, type?: DebugErrorType, details?: any) => void;
2595
+ info: (message: string, type?: DebugErrorType, details?: any) => void;
2596
+ log: (message: string, type?: DebugErrorType, details?: any) => void;
2597
+ warn: (message: string, type?: DebugErrorType, details?: any) => void;
2598
+ };
2599
+ }, {}, {}>>;
2600
+ //#endregion
2601
+ //#region src/lib/plugins/node-id/NodeIdPlugin.d.ts
2602
+ type NodeIdOptions = {
2603
+ /**
2604
+ * By default, when a node inserted using editor.tf.insertNode(s) has an id,
2605
+ * it will be used instead of the id generator, except if it already exists in
2606
+ * the document. Set this option to true to disable this behavior.
2607
+ */
2608
+ disableInsertOverrides?: boolean;
2609
+ /**
2610
+ * Filter inline `Element` nodes.
2611
+ *
2612
+ * @default true
2613
+ */
2614
+ filterInline?: boolean;
2615
+ /**
2616
+ * Filter `Text` nodes.
2617
+ *
2618
+ * @default true
2619
+ */
2620
+ filterText?: boolean;
2621
+ /**
2622
+ * Node key to store the id.
2623
+ *
2624
+ * @default 'id'
2625
+ */
2626
+ idKey?: string;
2627
+ /**
2628
+ * Normalize initial value. If false, normalize only the first and last node
2629
+ * are missing id. To disable this behavior, use `NodeIdPlugin.configure({
2630
+ * normalizeInitialValue: null })`.
2631
+ *
2632
+ * @default false
2633
+ */
2634
+ normalizeInitialValue?: boolean;
2635
+ /**
2636
+ * Reuse ids on undo/redo and copy/pasting if not existing in the document.
2637
+ * This is disabled by default to avoid duplicate ids across documents.
2638
+ *
2639
+ * @default false
2640
+ */
2641
+ reuseId?: boolean;
2642
+ /**
2643
+ * A function that generates and returns a unique ID.
2644
+ *
2645
+ * @default () => nanoid(10)
2646
+ */
2647
+ idCreator?: () => any;
2648
+ } & QueryNodeOptions;
2649
+ type NormalizeNodeIdOptions = Pick<NodeIdOptions, 'allow' | 'exclude' | 'filter' | 'filterInline' | 'filterText' | 'idCreator' | 'idKey'>;
2650
+ /**
2651
+ * Normalize node IDs in a value without using editor operations. This is a pure
2652
+ * function that returns a new normalized value.
2653
+ */
2654
+ declare const normalizeNodeId: <V extends Value>(value: V, options?: NormalizeNodeIdOptions) => V;
2655
+ type NodeIdConfig = PluginConfig<'nodeId', NodeIdOptions, {}, {
2656
+ nodeId: {
2657
+ normalize: () => void;
2658
+ };
2659
+ }>;
2660
+ /** @see {@link withNodeId} */
2661
+ declare const NodeIdPlugin: SlatePlugin<PluginConfig<"nodeId", {
2662
+ /**
2663
+ * By default, when a node inserted using editor.tf.insertNode(s) has an id,
2664
+ * it will be used instead of the id generator, except if it already exists in
2665
+ * the document. Set this option to true to disable this behavior.
2666
+ */
2667
+ disableInsertOverrides?: boolean;
2668
+ /**
2669
+ * Filter inline `Element` nodes.
2670
+ *
2671
+ * @default true
2672
+ */
2673
+ filterInline?: boolean;
2674
+ /**
2675
+ * Filter `Text` nodes.
2676
+ *
2677
+ * @default true
2678
+ */
2679
+ filterText?: boolean;
2680
+ /**
2681
+ * Node key to store the id.
2682
+ *
2683
+ * @default 'id'
2684
+ */
2685
+ idKey?: string;
2686
+ /**
2687
+ * Normalize initial value. If false, normalize only the first and last node
2688
+ * are missing id. To disable this behavior, use `NodeIdPlugin.configure({
2689
+ * normalizeInitialValue: null })`.
2690
+ *
2691
+ * @default false
2692
+ */
2693
+ normalizeInitialValue?: boolean;
2694
+ /**
2695
+ * Reuse ids on undo/redo and copy/pasting if not existing in the document.
2696
+ * This is disabled by default to avoid duplicate ids across documents.
2697
+ *
2698
+ * @default false
2699
+ */
2700
+ reuseId?: boolean;
2701
+ /**
2702
+ * A function that generates and returns a unique ID.
2703
+ *
2704
+ * @default () => nanoid(10)
2705
+ */
2706
+ idCreator?: () => any;
2707
+ } & QueryNodeOptions, {}, {
2708
+ nodeId: {
2709
+ normalize: () => void;
2710
+ };
2711
+ } & Record<"nodeId", {
2712
+ normalize(): void;
2713
+ }>, {}>>;
2714
+ //#endregion
2715
+ //#region src/lib/plugins/chunking/ChunkingPlugin.d.ts
2716
+ type ChunkingConfig = PluginConfig<'chunking', {
2717
+ /**
2718
+ * The number of blocks per chunk.
2719
+ *
2720
+ * @default 1000
2721
+ */
2722
+ chunkSize?: number;
2723
+ /**
2724
+ * Whether to render each chunk as a DOM element with `content-visibility:
2725
+ * auto`, which optimizes DOM painting. When set to `false`, no DOM element
2726
+ * will be rendered for each chunk.
2727
+ *
2728
+ * @default true
2729
+ */
2730
+ contentVisibilityAuto?: boolean;
2731
+ /**
2732
+ * Determine which ancestors should have chunking applied to their children.
2733
+ * Only blocks containing other blocks can have chunking applied.
2734
+ *
2735
+ * @default NodeApi.isEditor
2736
+ */
2737
+ query?: (ancestor: Ancestor) => boolean;
2738
+ }>;
2739
+ declare const ChunkingPlugin: SlatePlugin<ChunkingConfig>;
2740
+ //#endregion
2741
+ //#region src/lib/plugins/getCorePlugins.d.ts
2742
+ type CorePlugin = ReturnType<typeof getCorePlugins>[number];
2743
+ type GetCorePluginsOptions = {
2744
+ /** Enable mark/element affinity. */
2745
+ affinity?: boolean;
2746
+ /** Configure Slate's chunking optimization. */
2747
+ chunking?: ChunkingConfig['options'] | boolean;
2748
+ /** Specifies the maximum number of characters allowed in the editor. */
2749
+ maxLength?: number;
2750
+ /** Configure the node id plugin. */
2751
+ nodeId?: NodeIdConfig['options'] | boolean;
2752
+ /** Override the core plugins using the same key. */
2753
+ plugins?: AnyPluginConfig[];
2754
+ };
2755
+ declare const getCorePlugins: ({
2756
+ affinity,
2757
+ chunking,
2758
+ maxLength,
2759
+ nodeId,
2760
+ plugins
2761
+ }: GetCorePluginsOptions) => (SlatePlugin<DebugConfig> | SlatePlugin<PluginConfig<"slateExtension", {
2762
+ onNodeChange: (options: {
2763
+ editor: SlateEditor;
2764
+ node: Descendant$1;
2765
+ operation: NodeOperation$1;
2766
+ prevNode: Descendant$1;
2767
+ }) => void;
2768
+ onTextChange: (options: {
2769
+ editor: SlateEditor;
2770
+ node: Descendant$1;
2771
+ operation: TextOperation$1;
2772
+ prevText: string;
2773
+ text: string;
2774
+ }) => void;
2775
+ }, {}, {
2776
+ init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
2777
+ insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
2778
+ resetBlock: ((args_0?: {
2779
+ at?: Path$2;
2780
+ } | undefined) => true | undefined) & ((args_0?: {
2781
+ at?: Path$2;
2782
+ } | undefined) => true | undefined);
2783
+ setValue: ((value?: string | Value$1 | undefined) => void) & ((value?: string | Value$1 | undefined) => void);
2784
+ apply: <N$1 extends TElement$1 | TText$1>(operation: Operation$1<N$1>) => void;
2785
+ }, {}>> | SlatePlugin<PluginConfig<"dom", {
2786
+ scrollMode?: ScrollMode;
2787
+ scrollOperations?: AutoScrollOperationsMap;
2788
+ scrollOptions?: ScrollIntoViewOptions$1;
2789
+ }, {
2790
+ isScrolling: () => boolean;
2791
+ }, {
2792
+ withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
2793
+ }, {}>> | SlatePlugin<PluginConfig<"history", {}, {}, {}, {}>> | SlatePlugin<PluginConfig<"override", {}, {}, {}, {}>> | SlatePlugin<PluginConfig<"parser", {}, {}, {}, {}>> | SlatePlugin<LengthConfig> | SlatePlugin<PluginConfig<"html", {}, Record<"html", {
2794
+ deserialize: (args_0: {
2795
+ element: HTMLElement | string;
2796
+ collapseWhiteSpace?: boolean;
2797
+ defaultElementPlugin?: WithRequiredKey;
2798
+ }) => Descendant$1[];
2799
+ }>, {}, {}>> | SlatePlugin<PluginConfig<"ast", {}, {}, {}, {}>> | SlatePlugin<PluginConfig<"nodeId", {
2800
+ disableInsertOverrides?: boolean;
2801
+ filterInline?: boolean;
2802
+ filterText?: boolean;
2803
+ idKey?: string;
2804
+ normalizeInitialValue?: boolean;
2805
+ reuseId?: boolean;
2806
+ idCreator?: () => any;
2807
+ } & QueryNodeOptions$1, {}, {
2808
+ nodeId: {
2809
+ normalize: () => void;
2810
+ };
2811
+ } & Record<"nodeId", {
2812
+ normalize(): void;
2813
+ }>, {}>> | SlatePlugin<AffinityConfig> | SlatePlugin<PluginConfig<"p", {}, {}, {}, {}>> | SlatePlugin<ChunkingConfig>)[];
2814
+ type CorePluginTransforms = SlateExtensionConfig['transforms'];
2815
+ type CorePluginApi = SlateExtensionConfig['api'];
2816
+ type DebugConfig = PluginConfig<'debug', {
2817
+ isProduction: boolean;
2818
+ logger: Partial<Record<LogLevel, LogFunction>>;
2819
+ logLevel: LogLevel;
2820
+ throwErrors: boolean;
2821
+ }, {
2822
+ debug: {
2823
+ error: (message: string | unknown, type?: DebugErrorType, details?: any) => void;
2824
+ info: (message: string, type?: DebugErrorType, details?: any) => void;
2825
+ log: (message: string, type?: DebugErrorType, details?: any) => void;
2826
+ warn: (message: string, type?: DebugErrorType, details?: any) => void;
2827
+ };
2828
+ }>;
2829
+ type LengthConfig = PluginConfig<'length', {
2830
+ maxLength: number;
2831
+ }>;
2832
+ type LogFunction = (message: string, type?: DebugErrorType, details?: any) => void;
2833
+ //#endregion
2834
+ //#region src/lib/plugins/chunking/withChunking.d.ts
2835
+ declare const withChunking: OverrideEditor<ChunkingConfig>;
2836
+ //#endregion
2837
+ //#region src/lib/plugins/html/HtmlPlugin.d.ts
2838
+ /**
2839
+ * Enables support for deserializing inserted content from HTML format to Slate
2840
+ * format and serializing Slate content to HTML format.
2841
+ */
2842
+ declare const HtmlPlugin: SlatePlugin<PluginConfig<"html", {}, Record<"html", {
2843
+ deserialize: (args_0: {
2844
+ element: HTMLElement | string;
2845
+ collapseWhiteSpace?: boolean;
2846
+ defaultElementPlugin?: WithRequiredKey;
2847
+ }) => Descendant$1[];
2848
+ }>, {}, {}>>;
2849
+ //#endregion
2850
+ //#region src/lib/plugins/html/constants.d.ts
2851
+ declare const CARRIAGE_RETURN = "\r";
2852
+ declare const LINE_FEED = "\n";
2853
+ declare const NO_BREAK_SPACE = "\u00A0";
2854
+ declare const SPACE = " ";
2855
+ declare const TAB = "\t";
2856
+ declare const ZERO_WIDTH_SPACE = "\u200B";
2857
+ //#endregion
2858
+ //#region src/lib/plugins/html/types.d.ts
2859
+ type DeserializeHtmlChildren = ChildNode | Descendant | string | null;
2860
+ /** De */
2861
+ type DeserializeHtmlNodeReturnType = Descendant | Descendant[] | DeserializeHtmlChildren[] | string | null;
2862
+ //#endregion
2863
+ //#region src/lib/plugins/html/utils/cleanHtmlBrElements.d.ts
2864
+ /** Replace BR elements with line feeds. */
2865
+ declare const cleanHtmlBrElements: (rootNode: Node) => void;
2866
+ //#endregion
2867
+ //#region src/lib/plugins/html/utils/cleanHtmlCrLf.d.ts
2868
+ /** Replace \r\n and \r with \n */
2869
+ declare const cleanHtmlCrLf: (html: string) => string;
2870
+ //#endregion
2871
+ //#region src/lib/plugins/html/utils/cleanHtmlEmptyElements.d.ts
2872
+ /** Remove empty elements from rootNode. Allowed empty elements: BR, IMG. */
2873
+ declare const cleanHtmlEmptyElements: (rootNode: Node) => void;
2874
+ //#endregion
2875
+ //#region src/lib/plugins/html/utils/cleanHtmlFontElements.d.ts
2876
+ /**
2877
+ * Replace FONT elements with SPAN elements if there is textContent (remove
2878
+ * otherwise).
2879
+ */
2880
+ declare const cleanHtmlFontElements: (rootNode: Node) => void;
2881
+ //#endregion
2882
+ //#region src/lib/plugins/html/utils/cleanHtmlLinkElements.d.ts
2883
+ /** Remove fragment hrefs and spans without inner text. */
2884
+ declare const cleanHtmlLinkElements: (rootNode: Node) => void;
2885
+ //#endregion
2886
+ //#region src/lib/plugins/html/utils/cleanHtmlTextNodes.d.ts
2887
+ declare const cleanHtmlTextNodes: (rootNode: Node) => void;
2888
+ //#endregion
2889
+ //#region src/lib/plugins/html/utils/copyBlockMarksToSpanChild.d.ts
2890
+ /**
2891
+ * Set HTML blocks mark styles to a new child span element if any. This allows
2892
+ * Plate to use block marks.
2893
+ */
2894
+ declare const copyBlockMarksToSpanChild: (rootNode: Node) => void;
2895
+ //#endregion
2896
+ //#region src/lib/plugins/html/utils/deserializeHtml.d.ts
2897
+ /** Deserialize HTML element to a valid document fragment. */
2898
+ declare const deserializeHtml: (editor: SlateEditor, {
2899
+ collapseWhiteSpace: shouldCollapseWhiteSpace,
2900
+ defaultElementPlugin,
2901
+ element
2902
+ }: {
2903
+ element: HTMLElement | string;
2904
+ collapseWhiteSpace?: boolean;
2905
+ defaultElementPlugin?: WithRequiredKey;
2906
+ }) => Descendant[];
2907
+ //#endregion
2908
+ //#region src/lib/plugins/html/utils/deserializeHtmlElement.d.ts
2909
+ /** Deserialize HTML element to fragment. */
2910
+ declare const deserializeHtmlElement: (editor: SlateEditor, element: HTMLElement) => DeserializeHtmlNodeReturnType;
2911
+ //#endregion
2912
+ //#region src/lib/plugins/html/utils/deserializeHtmlNode.d.ts
2913
+ /** Deserialize HTML element or child node. */
2914
+ declare const deserializeHtmlNode: (editor: SlateEditor) => (node: ChildNode | HTMLElement) => DeserializeHtmlNodeReturnType;
2915
+ //#endregion
2916
+ //#region src/lib/plugins/html/utils/deserializeHtmlNodeChildren.d.ts
2917
+ declare const deserializeHtmlNodeChildren: (editor: SlateEditor, node: ChildNode | HTMLElement, isSlateParent?: boolean) => DeserializeHtmlChildren[];
2918
+ //#endregion
2919
+ //#region src/lib/plugins/html/utils/findHtmlElement.d.ts
2920
+ /**
2921
+ * Find the first HTML element that matches the given selector.
2922
+ *
2923
+ * @param rootNode
2924
+ * @param predicate
2925
+ */
2926
+ declare const findHtmlElement: (rootNode: Node, predicate: (node: HTMLElement) => boolean) => null;
2927
+ declare const someHtmlElement: (rootNode: Node, predicate: (node: HTMLElement) => boolean) => boolean;
2928
+ //#endregion
2929
+ //#region src/lib/plugins/html/utils/getDataNodeProps.d.ts
2930
+ declare const getDataNodeProps: ({
2931
+ editor,
2932
+ element,
2933
+ plugin
2934
+ }: {
2935
+ editor: SlateEditor;
2936
+ element: HTMLElement;
2937
+ plugin: AnyEditorPlugin;
2938
+ }) => Record<string, any> | undefined;
2939
+ //#endregion
2940
+ //#region src/lib/plugins/html/utils/getHtmlComments.d.ts
2941
+ declare const getHtmlComments: (node: Node) => string[];
2942
+ //#endregion
2943
+ //#region src/lib/plugins/html/utils/htmlBodyToFragment.d.ts
2944
+ /** Deserialize HTML body element to Fragment. */
2945
+ declare const htmlBodyToFragment: (editor: SlateEditor, element: HTMLElement) => Descendant[] | undefined;
2946
+ //#endregion
2947
+ //#region src/lib/plugins/html/utils/htmlBrToNewLine.d.ts
2948
+ /** Deserialize HTML to break line. */
2949
+ declare const htmlBrToNewLine: (node: ChildNode | HTMLElement) => "\n" | undefined;
2950
+ //#endregion
2951
+ //#region src/lib/plugins/html/utils/htmlElementToElement.d.ts
2952
+ /** Deserialize HTML to Element. */
2953
+ declare const htmlElementToElement: (editor: SlateEditor, element: HTMLElement, isSlate?: boolean) => Descendant | undefined;
2954
+ //#endregion
2955
+ //#region src/lib/plugins/html/utils/htmlElementToLeaf.d.ts
2956
+ /**
2957
+ * Deserialize HTML to Descendant[] with marks on Text. Build the leaf from the
2958
+ * leaf deserializers of each plugin.
2959
+ */
2960
+ declare const htmlElementToLeaf: (editor: SlateEditor, element: HTMLElement) => Descendant[];
2961
+ //#endregion
2962
+ //#region src/lib/plugins/html/utils/htmlStringToDOMNode.d.ts
2963
+ /** Convert HTML string into HTML element. */
2964
+ declare const htmlStringToDOMNode: (rawHtml: string) => HTMLBodyElement;
2965
+ //#endregion
2966
+ //#region src/lib/plugins/html/utils/htmlTextNodeToString.d.ts
2967
+ declare const htmlTextNodeToString: (node: ChildNode | HTMLElement) => string | undefined;
2968
+ //#endregion
2969
+ //#region src/lib/plugins/html/utils/inlineTagNames.d.ts
2970
+ /**
2971
+ * # Methodology
2972
+ *
2973
+ * ## Step 1. Get the list of all standard tag names
2974
+ *
2975
+ * Go to https://developer.mozilla.org/en-US/docs/Web/HTML/Element and run the
2976
+ * following in the console to generate a JSON array of tag names:
2977
+ *
2978
+ * ```js
2979
+ * JSON.stringify(
2980
+ * Array.from(document.querySelectorAll('article table td:first-child'))
2981
+ * .map((td) => {
2982
+ * const body = document.createElement('body');
2983
+ * body.innerHTML = td.textContent;
2984
+ * return body.firstChild?.tagName;
2985
+ * })
2986
+ * .filter((tagName) => tagName)
2987
+ * );
2988
+ * ```
2989
+ *
2990
+ * Output (as of 2023-11-06):
2991
+ *
2992
+ * ```json
2993
+ * '["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"]'
2994
+ * ```
2995
+ *
2996
+ * ## Step 2. For each tag name, determine the default browser style
2997
+ *
2998
+ * Open an empty HTML file in the browser and run the following in the console:
2999
+ *
3000
+ * ```js
3001
+ * const tagNames = JSON.parse(<JSON string from step 1>);
3002
+ *
3003
+ * JSON.stringify(
3004
+ * tagNames.filter((tagName) => {
3005
+ * const element = document.createElement(tagName);
3006
+ * document.body.appendChild(element);
3007
+ * const display = window.getComputedStyle(element).display;
3008
+ * element.remove();
3009
+ * return display.startsWith('inline');
3010
+ * })
3011
+ * );
3012
+ * ```
3013
+ *
3014
+ * Place the result in the array below (accurate as of 2023-11-06).
3015
+ */
3016
+ declare const inlineTagNames: Set<string>;
3017
+ //#endregion
3018
+ //#region src/lib/plugins/html/utils/isHtmlBlockElement.d.ts
3019
+ declare const isHtmlBlockElement: (node: Node) => boolean;
3020
+ //#endregion
3021
+ //#region src/lib/plugins/html/utils/isHtmlComment.d.ts
3022
+ declare const isHtmlComment: (node: Node) => node is Comment;
3023
+ //#endregion
3024
+ //#region src/lib/plugins/html/utils/isHtmlElement.d.ts
3025
+ declare const isHtmlElement: (node: Node) => node is Element;
3026
+ //#endregion
3027
+ //#region src/lib/plugins/html/utils/isHtmlFragmentHref.d.ts
3028
+ /** If href starts with '#'. */
3029
+ declare const isHtmlFragmentHref: (href: string) => boolean;
3030
+ //#endregion
3031
+ //#region src/lib/plugins/html/utils/isHtmlInlineElement.d.ts
3032
+ declare const isHtmlInlineElement: (node: Node) => boolean;
3033
+ //#endregion
3034
+ //#region src/lib/plugins/html/utils/isHtmlTable.d.ts
3035
+ declare const isHtmlTable: (element: Element) => boolean;
3036
+ //#endregion
3037
+ //#region src/lib/plugins/html/utils/isHtmlText.d.ts
3038
+ declare const isHtmlText: (node: Node) => node is Text;
3039
+ //#endregion
3040
+ //#region src/lib/plugins/html/utils/isOlSymbol.d.ts
3041
+ declare const isOlSymbol: (symbol: string) => boolean;
3042
+ //#endregion
3043
+ //#region src/lib/plugins/html/utils/parseHtmlDocument.d.ts
3044
+ declare const parseHtmlDocument: (html: string) => Document;
3045
+ //#endregion
3046
+ //#region src/lib/plugins/html/utils/parseHtmlElement.d.ts
3047
+ declare const parseHtmlElement: (html: string) => HTMLElement;
3048
+ //#endregion
3049
+ //#region src/lib/plugins/html/utils/pipeDeserializeHtmlElement.d.ts
3050
+ declare const pipeDeserializeHtmlElement: (editor: SlateEditor, element: HTMLElement) => (Nullable<HtmlDeserializer> & {
3051
+ node: AnyObject;
3052
+ }) | undefined;
3053
+ //#endregion
3054
+ //#region src/lib/plugins/html/utils/pipeDeserializeHtmlLeaf.d.ts
3055
+ declare const pipeDeserializeHtmlLeaf: (editor: SlateEditor, element: HTMLElement) => AnyObject;
3056
+ //#endregion
3057
+ //#region src/lib/plugins/html/utils/pluginDeserializeHtml.d.ts
3058
+ /** Get a deserializer by type, node names, class names and styles. */
3059
+ declare const pluginDeserializeHtml: (editor: SlateEditor, plugin: AnyEditorPlugin, {
3060
+ deserializeLeaf,
3061
+ element: el
3062
+ }: {
3063
+ element: HTMLElement;
3064
+ deserializeLeaf?: boolean;
3065
+ }) => (Nullable<HtmlDeserializer> & {
3066
+ node: AnyObject;
3067
+ }) | undefined;
3068
+ //#endregion
3069
+ //#region src/lib/plugins/html/utils/postCleanHtml.d.ts
3070
+ /** Trim the html and remove zero width spaces, then wrap it with a body element. */
3071
+ declare const postCleanHtml: (html: string) => string;
3072
+ //#endregion
3073
+ //#region src/lib/plugins/html/utils/preCleanHtml.d.ts
3074
+ /** Remove HTML surroundings and clean HTML from CR/LF */
3075
+ declare const preCleanHtml: (html: string) => string;
3076
+ //#endregion
3077
+ //#region src/lib/plugins/html/utils/removeHtmlNodesBetweenComments.d.ts
3078
+ /** Removes HTML nodes between HTML comments. */
3079
+ declare const removeHtmlNodesBetweenComments: (rootNode: Node, start: string, end: string) => void;
3080
+ //#endregion
3081
+ //#region src/lib/plugins/html/utils/removeHtmlSurroundings.d.ts
3082
+ /** Remove string before <html and after </html> */
3083
+ declare const removeHtmlSurroundings: (html: string) => string;
3084
+ //#endregion
3085
+ //#region src/lib/plugins/html/utils/replaceTagName.d.ts
3086
+ /**
3087
+ * Replace `element` tag name by `tagName`. Attributes, innerHTML and parent
3088
+ * relationship is kept.
3089
+ */
3090
+ declare const replaceTagName: (element: Element, tagName: string) => Element;
3091
+ //#endregion
3092
+ //#region src/lib/plugins/html/utils/traverseHtmlComments.d.ts
3093
+ type Callback$3 = (node: Comment) => boolean;
3094
+ /** Traverse HTML comments. */
3095
+ declare const traverseHtmlComments: (rootNode: Node, callback: Callback$3) => void;
3096
+ //#endregion
3097
+ //#region src/lib/plugins/html/utils/traverseHtmlElements.d.ts
3098
+ type Callback$2 = (node: Element) => boolean;
3099
+ /**
3100
+ * Traverse the HTML elements of the given HTML node.
3101
+ *
3102
+ * @param rootNode The root HTML node to traverse.
3103
+ * @param callback The callback to call for each HTML element.
3104
+ */
3105
+ declare const traverseHtmlElements: (rootNode: Node, callback: Callback$2) => void;
3106
+ //#endregion
3107
+ //#region src/lib/plugins/html/utils/traverseHtmlNode.d.ts
3108
+ type Callback$1 = (node: Node) => boolean;
3109
+ /**
3110
+ * Depth-first pre-order tree traverse the given HTML node and calls the given
3111
+ * callback for each node. see:
3112
+ * https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR)
3113
+ *
3114
+ * @param callback Returns a boolean indicating whether traversal should be
3115
+ * continued
3116
+ */
3117
+ declare const traverseHtmlNode: (node: Node, callback: Callback$1) => void;
3118
+ //#endregion
3119
+ //#region src/lib/plugins/html/utils/traverseHtmlTexts.d.ts
3120
+ type Callback = (node: Text) => boolean;
3121
+ declare const traverseHtmlTexts: (rootNode: Node, callback: Callback) => void;
3122
+ //#endregion
3123
+ //#region src/lib/plugins/html/utils/unwrapHtmlElement.d.ts
3124
+ /** Unwrap the given HTML element. */
3125
+ declare const unwrapHtmlElement: (element: Element) => void;
3126
+ //#endregion
3127
+ //#region src/lib/plugins/html/utils/collapse-white-space/types.d.ts
3128
+ type CollapseWhiteSpaceState = {
3129
+ inlineFormattingContext: {
3130
+ atStart: boolean;
3131
+ lastHasTrailingWhiteSpace: boolean;
3132
+ } | null;
3133
+ whiteSpaceRule: WhiteSpaceRule;
3134
+ };
3135
+ type TrimEndRule = 'collapse' | 'single-newline';
3136
+ type TrimStartRule = 'all' | 'collapse';
3137
+ type WhiteSpaceRule = 'normal' | 'pre' | 'pre-line';
3138
+ //#endregion
3139
+ //#region src/lib/plugins/html/utils/collapse-white-space/collapseString.d.ts
3140
+ declare const collapseString: (text: string, {
3141
+ shouldCollapseWhiteSpace,
3142
+ trimEnd,
3143
+ trimStart,
3144
+ whiteSpaceIncludesNewlines
3145
+ }?: {
3146
+ shouldCollapseWhiteSpace?: boolean;
3147
+ trimEnd?: TrimEndRule;
3148
+ trimStart?: TrimStartRule;
3149
+ whiteSpaceIncludesNewlines?: boolean;
3150
+ }) => string;
3151
+ //#endregion
3152
+ //#region src/lib/plugins/html/utils/collapse-white-space/collapseWhiteSpace.d.ts
3153
+ declare const collapseWhiteSpace: (element: HTMLElement) => HTMLElement;
3154
+ //#endregion
3155
+ //#region src/lib/plugins/html/utils/collapse-white-space/collapseWhiteSpaceChildren.d.ts
3156
+ declare const collapseWhiteSpaceChildren: (node: Node, state: CollapseWhiteSpaceState) => void;
3157
+ //#endregion
3158
+ //#region src/lib/plugins/html/utils/collapse-white-space/collapseWhiteSpaceElement.d.ts
3159
+ /**
3160
+ * Note: We do not want to start an inline formatting context until we encounter
3161
+ * a text node.
3162
+ */
3163
+ declare const collapseWhiteSpaceElement: (element: HTMLElement, state: CollapseWhiteSpaceState) => void;
3164
+ //#endregion
3165
+ //#region src/lib/plugins/html/utils/collapse-white-space/collapseWhiteSpaceNode.d.ts
3166
+ declare const collapseWhiteSpaceNode: (node: Node, state: CollapseWhiteSpaceState) => void;
3167
+ //#endregion
3168
+ //#region src/lib/plugins/html/utils/collapse-white-space/collapseWhiteSpaceText.d.ts
3169
+ declare const collapseWhiteSpaceText: (text: Text, state: CollapseWhiteSpaceState) => void;
3170
+ //#endregion
3171
+ //#region src/lib/plugins/html/utils/collapse-white-space/inferWhiteSpaceRule.d.ts
3172
+ declare const inferWhiteSpaceRule: (element: HTMLElement) => WhiteSpaceRule | null;
3173
+ //#endregion
3174
+ //#region src/lib/plugins/html/utils/collapse-white-space/isLastNonEmptyTextOfInlineFormattingContext.d.ts
3175
+ declare const isLastNonEmptyTextOfInlineFormattingContext: (initialText: Text) => boolean;
3176
+ //#endregion
3177
+ //#region src/lib/plugins/html/utils/collapse-white-space/stateTransforms.d.ts
3178
+ declare const upsertInlineFormattingContext: (state: CollapseWhiteSpaceState) => void;
3179
+ declare const endInlineFormattingContext: (state: CollapseWhiteSpaceState) => void;
3180
+ //#endregion
3181
+ //#region src/lib/plugins/length/LengthPlugin.d.ts
3182
+ declare const LengthPlugin: SlatePlugin<LengthConfig>;
3183
+ //#endregion
3184
+ //#region src/lib/plugins/node-id/withNodeId.d.ts
3185
+ /** Enables support for inserting nodes with an id key. */
3186
+ declare const withNodeId: OverrideEditor<NodeIdConfig>;
3187
+ //#endregion
3188
+ //#region src/lib/plugins/override/OverridePlugin.d.ts
3189
+ /**
3190
+ * Merge and register all the inline types and void types from the plugins and
3191
+ * options, using `editor.api.isInline`, `editor.api.markableVoid` and
3192
+ * `editor.api.isVoid`
3193
+ */
3194
+ declare const withOverrides: OverrideEditor;
3195
+ /** Override the editor api and transforms based on the plugins. */
3196
+ declare const OverridePlugin: SlatePlugin<PluginConfig<"override", {}, {}, {}, {}>>;
3197
+ //#endregion
3198
+ //#region src/lib/plugins/override/withBreakRules.d.ts
3199
+ declare const withBreakRules: OverrideEditor;
3200
+ //#endregion
3201
+ //#region src/lib/plugins/override/withDeleteRules.d.ts
3202
+ declare const withDeleteRules: OverrideEditor;
3203
+ //#endregion
3204
+ //#region src/lib/plugins/override/withMergeRules.d.ts
3205
+ declare const withMergeRules: OverrideEditor;
3206
+ //#endregion
3207
+ //#region src/lib/plugins/override/withNormalizeRules.d.ts
3208
+ declare const withNormalizeRules: OverrideEditor;
3209
+ //#endregion
3210
+ //#region src/lib/plugins/paragraph/BaseParagraphPlugin.d.ts
3211
+ type ParagraphConfig = PluginConfig<'p'>;
3212
+ declare const BaseParagraphPlugin: SlatePlugin<PluginConfig<"p", {}, {}, {}, {}>>;
3213
+ //#endregion
3214
+ //#region src/lib/plugin/BasePlugin.d.ts
3215
+ type AnyPluginConfig = {
3216
+ key: any;
3217
+ api: any;
3218
+ options: any;
3219
+ selectors: any;
3220
+ transforms: any;
3221
+ };
3222
+ type BaseDeserializer = AnyObject & {
3223
+ /**
3224
+ * Deserialize an element. Overrides plugin.isElement.
3225
+ *
3226
+ * @default plugin.isElement
3227
+ */
3228
+ isElement?: boolean;
3229
+ /**
3230
+ * Deserialize a leaf. Overrides plugin.isLeaf.
3231
+ *
3232
+ * @default plugin.isLeaf
3233
+ */
3234
+ isLeaf?: boolean;
3235
+ };
3236
+ type BaseHtmlDeserializer = BaseDeserializer & {
3237
+ /** List of HTML attribute names to store their values in `node.attributes`. */
3238
+ attributeNames?: string[];
3239
+ rules?: {
3240
+ /**
3241
+ * Deserialize an element:
3242
+ *
3243
+ * - If this option (string) is in the element attribute names.
3244
+ * - If this option (object) values match the element attributes.
3245
+ */
3246
+ validAttribute?: Record<string, string[] | string> | string;
3247
+ /** Valid element `className`. */
3248
+ validClassName?: string;
3249
+ /** Valid element `nodeName`. Set '*' to allow any node name. */
3250
+ validNodeName?: string[] | string;
3251
+ /**
3252
+ * Valid element style values. Can be a list of string (only one match is
3253
+ * needed).
3254
+ */
3255
+ validStyle?: Partial<Record<keyof CSSStyleDeclaration, string[] | string | undefined>>;
3256
+ }[];
3257
+ /** Whether or not to include deserialized children on this node */
3258
+ withoutChildren?: boolean;
3259
+ };
3260
+ type BaseInjectProps = {
3261
+ /**
3262
+ * Object whose keys are node values and values are classNames which will be
3263
+ * extended.
3264
+ */
3265
+ classNames?: AnyObject;
3266
+ /**
3267
+ * Default node value. The node key would be unset if the node value =
3268
+ * defaultNodeValue.
3269
+ */
3270
+ defaultNodeValue?: any;
3271
+ /** Node key to map to the styles. */
3272
+ nodeKey?: string;
3273
+ /**
3274
+ * Style key to override.
3275
+ *
3276
+ * @default nodeKey
3277
+ */
3278
+ styleKey?: keyof CSSStyleDeclaration;
3279
+ /** List of supported node values. */
3280
+ validNodeValues?: any[];
3281
+ };
3282
+ type BasePlugin<C extends AnyPluginConfig = PluginConfig> = {
3283
+ /** Unique identifier for this plugin. */
3284
+ key: C['key'];
3285
+ /** API methods provided by this plugin. */
3286
+ api: InferApi<C>;
3287
+ /**
3288
+ * An array of plugin keys that this plugin depends on. These plugins will be
3289
+ * loaded before this plugin.
3290
+ */
3291
+ dependencies: string[];
3292
+ inject: Nullable<{
3293
+ /** Plugin keys of elements to exclude the children from */
3294
+ excludeBelowPlugins?: string[];
3295
+ /** Plugin keys of elements to exclude */
3296
+ excludePlugins?: string[];
3297
+ /** Whether to filter blocks */
3298
+ isBlock?: boolean;
3299
+ /** Whether to filter elements */
3300
+ isElement?: boolean;
3301
+ /** Whether to filter leaves */
3302
+ isLeaf?: boolean;
3303
+ /** Filter nodes with path above this level. */
3304
+ maxLevel?: number;
3305
+ /**
3306
+ * Plugin keys used by {@link InjectNodeProps} and the targetPluginToInject
3307
+ * function. For plugin injection by key, use the inject.plugins property.
3308
+ *
3309
+ * @default [ParagraphPlugin.key]
3310
+ */
3311
+ targetPlugins?: string[];
3312
+ }>;
3313
+ /** Node-specific configuration for this plugin. */
3314
+ node: BasePluginNode<C>;
3315
+ /** Extended properties used by any plugin as options. */
3316
+ options: InferOptions<C>;
3317
+ /** Store for managing plugin options. */
3318
+ optionsStore: TStateApi<C['options'], [['zustand/mutative-x', never]], {}, C['selectors']>;
3319
+ override: {
3320
+ /** Enable or disable plugins */
3321
+ enabled?: Partial<Record<string, boolean>>;
3322
+ };
3323
+ /**
3324
+ * Defines the order in which plugins are registered and executed.
3325
+ *
3326
+ * Plugins with higher priority values are registered and executed before
3327
+ * those with lower values. This affects two main aspects:
3328
+ *
3329
+ * 1. Plugin Order: Plugins with higher priority will be added to the editor
3330
+ * earlier.
3331
+ * 2. Execution Order: For operations that involve multiple plugins (e.g., editor
3332
+ * methods), plugins with higher priority will be processed first.
3333
+ *
3334
+ * @default 100
3335
+ */
3336
+ priority: number;
3337
+ render: Nullable<{
3338
+ /**
3339
+ * Renders a component above the `Editable` component but within the `Slate`
3340
+ * wrapper. Useful for adding UI elements that should appear above the
3341
+ * editable area.
3342
+ */
3343
+ aboveEditable?: React.FC<{
3344
+ children: React.ReactNode;
3345
+ }>;
3346
+ /**
3347
+ * Renders a component above the `Slate` wrapper. This is the outermost
3348
+ * render position in the editor structure.
3349
+ */
3350
+ aboveSlate?: React.FC<{
3351
+ children: React.ReactNode;
3352
+ }>;
3353
+ /**
3354
+ * Specifies the HTML tag name to use when rendering the node component.
3355
+ * Only used when no custom `component` is provided for the plugin.
3356
+ *
3357
+ * @default 'div' for elements, 'span' for leaves
3358
+ */
3359
+ as?: keyof HTMLElementTagNameMap;
3360
+ /**
3361
+ * Renders a component below leaf nodes when `isLeaf: true` and
3362
+ * `isDecoration: false`. Use `render.node` instead when `isDecoration:
3363
+ * true`.
3364
+ */
3365
+ leaf?: NodeComponent;
3366
+ /**
3367
+ * Renders a component for:
3368
+ *
3369
+ * - Elements nodes if `isElement: true`
3370
+ * - Below text nodes if `isLeaf: true` and `isDecoration: false`
3371
+ * - Below leaf if `isLeaf: true` and `isDecoration: true`
3372
+ */
3373
+ node?: NodeComponent;
3374
+ }>;
3375
+ rules: {
3376
+ /**
3377
+ * Defines actions on insert break based on block state.
3378
+ *
3379
+ * - `'default'`: Default behavior
3380
+ * - `'exit'`: Exit the current block
3381
+ * - `'reset'`: Reset block to default paragraph type
3382
+ * - `'lineBreak'`: Insert newline character
3383
+ * - `'deleteExit'`: Delete backward then exit
3384
+ */
3385
+ break?: BreakRules;
3386
+ /**
3387
+ * Defines actions on delete based on block state.
3388
+ *
3389
+ * - `'default'`: Default behavior
3390
+ * - `'reset'`: Reset block to default paragraph type
3391
+ */
3392
+ delete?: DeleteRules;
3393
+ /** Defines the behavior of merging nodes. */
3394
+ merge?: MergeRules;
3395
+ /** Defines the behavior of normalizing nodes. */
3396
+ normalize?: NormalizeRules;
3397
+ /** Defines the behavior of selection. */
3398
+ selection?: SelectionRules;
3399
+ };
3400
+ /** Selectors for the plugin. */
3401
+ selectors: InferSelectors<C>;
3402
+ /** Transforms (state-modifying operations) that can be applied to the editor. */
3403
+ transforms: InferTransforms<C>;
3404
+ /**
3405
+ * Configures edit-only behavior for various plugin functionalities.
3406
+ *
3407
+ * - If `true` (boolean):
3408
+ *
3409
+ * - `render`, `handlers`, and `inject.nodeProps` are active only when the
3410
+ * editor is NOT read-only.
3411
+ * - If an object ({@link EditOnlyConfig}): Allows fine-grained control:
3412
+ *
3413
+ * - `render`: Edit-only by default (true if not specified). Set to `false` to
3414
+ * always be active.
3415
+ * - `handlers`: Edit-only by default (true if not specified). Set to `false` to
3416
+ * always be active.
3417
+ * - `inject` (for `inject.nodeProps`): Edit-only by default (true if not
3418
+ * specified). Set to `false` to always be active.
3419
+ * - `normalizeInitialValue`: NOT edit-only by default (false if not specified).
3420
+ * Set to `true` to make it edit-only.
3421
+ */
3422
+ editOnly?: EditOnlyConfig | boolean;
3423
+ /**
3424
+ * Enables or disables the plugin. Used by Plate to determine if the plugin
3425
+ * should be used.
3426
+ */
3427
+ enabled?: boolean;
3428
+ };
3429
+ type BasePluginContext<C extends AnyPluginConfig = PluginConfig> = {
3430
+ api: C['api'] & EditorApi & CorePluginApi;
3431
+ setOptions: (options: ((state: Draft<Partial<InferOptions<C>>>) => void) | Partial<InferOptions<C>>) => void;
3432
+ tf: C['transforms'] & EditorTransforms & CorePluginTransforms;
3433
+ type: string;
3434
+ getOption: <K$1 extends keyof InferOptions<C> | keyof InferSelectors<C> | 'state'>(key: K$1, ...args: K$1 extends keyof InferSelectors<C> ? Parameters<InferSelectors<C>[K$1]> : unknown[]) => K$1 extends 'state' ? InferOptions<C> : K$1 extends keyof InferSelectors<C> ? ReturnType<InferSelectors<C>[K$1]> : K$1 extends keyof InferOptions<C> ? InferOptions<C>[K$1] : never;
3435
+ getOptions: () => InferOptions<C>;
3436
+ setOption: <K$1 extends keyof InferOptions<C>>(optionKey: K$1, value: InferOptions<C>[K$1]) => void;
3437
+ };
3438
+ type BasePluginNode<C extends AnyPluginConfig = PluginConfig> = {
3439
+ /**
3440
+ * Specifies the type identifier for this plugin's nodes.
3441
+ *
3442
+ * For elements (when {@link isElement} is `true`):
3443
+ *
3444
+ * - The {@link NodeComponent} will be used for any node where `node.type ===
3445
+ * type`.
3446
+ *
3447
+ * For leaves/marks (when {@link isLeaf} is `true`):
3448
+ *
3449
+ * - The {@link NodeComponent} will be used for any leaf where `node[type] ===
3450
+ * true`.
3451
+ *
3452
+ * This property is crucial for Plate to correctly match nodes to their
3453
+ * respective plugins.
3454
+ *
3455
+ * @default plugin.key
3456
+ */
3457
+ type: string;
3458
+ component?: NodeComponent | null;
3459
+ /**
3460
+ * Controls which (if any) attribute names in the `attributes` property of an
3461
+ * element will be passed as `nodeProps` to the {@link NodeComponent}, and
3462
+ * subsequently rendered as DOM attributes.
3463
+ *
3464
+ * WARNING: If used improperly, this property WILL make your application
3465
+ * vulnerable to cross-site scripting (XSS) or information exposure attacks.
3466
+ *
3467
+ * For example, if the `href` attribute is allowed and the component passes
3468
+ * `nodeProps` to an `<a>` element, then attackers can direct users to open a
3469
+ * document containing a malicious link element:
3470
+ *
3471
+ * { type: 'link', url: 'https://safesite.com/', attributes: { href:
3472
+ * 'javascript:alert("xss")' }, children: [{ text: 'Click me' }], }
3473
+ *
3474
+ * The same is true of the `src` attribute when passed to certain HTML
3475
+ * elements, such as `<iframe>`.
3476
+ *
3477
+ * If the `style` attribute (or another attribute that can load URLs, such as
3478
+ * `background`) is allowed, then attackers can direct users to open a
3479
+ * document that will send a HTTP request to an arbitrary URL. This can leak
3480
+ * the victim's IP address or confirm to the attacker that the victim opened
3481
+ * the document.
3482
+ *
3483
+ * Before allowing any attribute name, ensure that you thoroughly research and
3484
+ * assess any potential risks associated with it.
3485
+ *
3486
+ * @default [ ]
3487
+ */
3488
+ dangerouslyAllowAttributes?: string[];
3489
+ /**
3490
+ * Indicates if this plugin's elements are primarily containers for other
3491
+ * content. Container elements are typically unwrapped when querying
3492
+ * fragments.
3493
+ *
3494
+ * Examples: table, tr, td, column, column_group
3495
+ *
3496
+ * @default false
3497
+ */
3498
+ isContainer?: boolean;
3499
+ /**
3500
+ * Indicates if this plugin's nodes can be rendered as decorated leaf. Set to
3501
+ * false to render node component only once per text node.
3502
+ *
3503
+ * @default true
3504
+ */
3505
+ isDecoration?: boolean;
3506
+ /**
3507
+ * Indicates if this plugin's nodes should be rendered as elements. Used by
3508
+ * Plate for {@link NodeComponent} rendering as elements.
3509
+ */
3510
+ isElement?: boolean;
3511
+ /**
3512
+ * Indicates if this plugin's elements should be treated as inline. Used by
3513
+ * the inlineVoid core plugin.
3514
+ */
3515
+ isInline?: boolean;
3516
+ /**
3517
+ * Indicates if this plugin's nodes should be rendered as leaves. Used by
3518
+ * Plate for {@link NodeComponent} rendering as leaves.
3519
+ */
3520
+ isLeaf?: boolean;
3521
+ /**
3522
+ * Indicates if this plugin's void elements should be markable. Used by the
3523
+ * inlineVoid core plugin.
3524
+ */
3525
+ isMarkableVoid?: boolean;
3526
+ /**
3527
+ * Whether the node is selectable.
3528
+ *
3529
+ * @default true
3530
+ */
3531
+ isSelectable?: boolean;
3532
+ /**
3533
+ * Indicates whether this element enforces strict sibling type constraints.
3534
+ * Set to true `true` when the element only allows specific siblings (e.g.,
3535
+ * `td` can only have `td` siblings, `column` can only have `column` siblings)
3536
+ * and prevents standard text blocks like paragraphs from being inserted as
3537
+ * siblings.
3538
+ */
3539
+ isStrictSiblings?: boolean;
3540
+ /**
3541
+ * Property used by `inlineVoid` core plugin to set elements of this `type` as
3542
+ * void.
3543
+ */
3544
+ isVoid?: boolean;
3545
+ /**
3546
+ * Function that returns an object of data attributes to be added to the
3547
+ * element.
3548
+ */
3549
+ toDataAttributes?: (options: BasePluginContext<C> & {
3550
+ node: TElement;
3551
+ }) => AnyObject | undefined;
3552
+ };
3553
+ type BaseSerializer = AnyObject;
3554
+ type BaseTransformOptions = GetInjectNodePropsOptions & {
3555
+ nodeValue?: any;
3556
+ value?: any;
3557
+ };
3558
+ type BreakRules = {
3559
+ /** Action when Enter is pressed in an empty block. */
3560
+ empty?: 'default' | 'deleteExit' | 'exit' | 'reset';
3561
+ /**
3562
+ * Action when Enter is pressed at the end of an empty line. This is typically
3563
+ * used with `default: 'lineBreak'`.
3564
+ *
3565
+ * Example:
3566
+ *
3567
+ * ```tsx
3568
+ * <blockquote>
3569
+ * This is some text\n
3570
+ * |
3571
+ * </blockquote>
3572
+ * ```
3573
+ */
3574
+ emptyLineEnd?: 'default' | 'deleteExit' | 'exit';
3575
+ /** Default action when Enter is pressed. Defaults to splitting the block. */
3576
+ default?: 'default' | 'deleteExit' | 'exit' | 'lineBreak';
3577
+ /** If true, the new block after splitting will be reset to the default type. */
3578
+ splitReset?: boolean;
3579
+ };
3580
+ type MergeRules = {
3581
+ /** Whether to remove the node when it's empty. */
3582
+ removeEmpty?: boolean;
3583
+ };
3584
+ type NormalizeRules = {
3585
+ /** Whether to remove nodes with empty text. */
3586
+ removeEmpty?: boolean;
3587
+ };
3588
+ type DeleteRules = {
3589
+ /**
3590
+ * Action when Backspace is pressed at the start of the block. This applies
3591
+ * whether the block is empty or not.
3592
+ *
3593
+ * Example:
3594
+ *
3595
+ * ```tsx
3596
+ * <blockquote>
3597
+ * |Text
3598
+ * </blockquote>
3599
+ * ```
3600
+ */
3601
+ start?: 'default' | 'reset';
3602
+ /** Action when Backspace is pressed and the block is empty. */
3603
+ empty?: 'default' | 'reset';
3604
+ };
3605
+ type SelectionRules = {
3606
+ /**
3607
+ * Defines the selection behavior at the boundaries of nodes.
3608
+ *
3609
+ * - `directional`: Selection affinity is determined by the direction of cursor
3610
+ * movement. Maintains inward or outward affinity based on approach.
3611
+ * - `outward`: Forces outward affinity. Typing at the edge of a mark will not
3612
+ * apply the mark to new text.
3613
+ * - `hard`: Creates a 'hard' edge that requires two key presses to move across.
3614
+ * Uses offset-based navigation.
3615
+ * - `default`: Uses Slate's default behavior.
3616
+ */
3617
+ affinity?: 'default' | 'directional' | 'hard' | 'outward';
3618
+ };
3619
+ type MatchRules = 'break.default' | 'break.empty' | 'break.emptyLineEnd' | 'break.splitReset' | 'delete.empty' | 'delete.start' | 'merge.removeEmpty' | 'normalize.removeEmpty' | 'selection.affinity';
3620
+ type EditOnlyConfig = {
3621
+ /**
3622
+ * If true, `handlers` are only active when the editor is not read-only.
3623
+ *
3624
+ * @default true (when `editOnly` is an object or `true` boolean)
3625
+ */
3626
+ handlers?: boolean;
3627
+ /**
3628
+ * If true, `inject.nodeProps` is only active when the editor is not
3629
+ * read-only.
3630
+ *
3631
+ * @default true (when `editOnly` is an object or `true` boolean)
3632
+ */
3633
+ inject?: boolean;
3634
+ /**
3635
+ * If true, `normalizeInitialValue` is only called when the editor is not
3636
+ * read-only.
3637
+ *
3638
+ * @default false (This is an exception. It's not edit-only by default, even if `editOnly` is true or an object, unless explicitly set to true here).
3639
+ */
3640
+ normalizeInitialValue?: boolean;
3641
+ /**
3642
+ * If true, `render` functions are only active when the editor is not
3643
+ * read-only.
3644
+ *
3645
+ * @default true (when `editOnly` is an object or `true` boolean)
3646
+ */
3647
+ render?: boolean;
3648
+ };
3649
+ type ExtendConfig<C extends PluginConfig, EO = {}, EA = {}, ET = {}, ES = {}> = {
3650
+ key: C['key'];
3651
+ api: C['api'] & EA;
3652
+ options: C['options'] & EO;
3653
+ selectors: C['selectors'] & ES;
3654
+ transforms: C['transforms'] & ET;
3655
+ };
3656
+ type GetInjectNodePropsOptions = {
3657
+ /** Existing className. */
3658
+ className?: string;
3659
+ /** Style value or className key. */
3660
+ element?: TElement;
3661
+ /** Existing style. */
3662
+ style?: CSSStyleDeclaration;
3663
+ /** Style value or className key. */
3664
+ text?: TText;
3665
+ };
3666
+ type GetInjectNodePropsReturnType = AnyObject & {
3667
+ className?: string;
3668
+ style?: CSSStyleDeclaration;
3669
+ };
3670
+ type InferKey<P> = P extends PluginConfig ? P['key'] : never;
3671
+ type InferApi<P> = P extends PluginConfig ? P['api'] : never;
3672
+ type InferOptions<P> = P extends PluginConfig ? P['options'] : never;
3673
+ type InferSelectors<P> = P extends PluginConfig ? P['selectors'] : never;
3674
+ type InferTransforms<P> = P extends PluginConfig ? P['transforms'] : never;
3675
+ /**
3676
+ * Renders a component for Slate Nodes (elements if `isElement: true` or leaves
3677
+ * if `isLeaf: true`) that match this plugin's type. This is the primary render
3678
+ * method for plugin-specific node content.
3679
+ *
3680
+ * @default DefaultElement for elements, DefaultLeaf for leaves
3681
+ */
3682
+ type NodeComponent<T = any> = React.FC<T>;
3683
+ type NodeComponents = Record<string, NodeComponent>;
3684
+ type ParserOptions = {
3685
+ data: string;
3686
+ dataTransfer: DataTransfer;
3687
+ mimeType: string;
3688
+ };
3689
+ type PluginConfig<K$1 extends string = any, O = {}, A = {}, T = {}, S = {}> = {
3690
+ key: K$1;
3691
+ api: A;
3692
+ options: O;
3693
+ selectors: S;
3694
+ transforms: T;
3695
+ };
3696
+ type WithAnyKey<C extends AnyPluginConfig = PluginConfig> = PluginConfig<any, InferOptions<C>, InferApi<C>, InferTransforms<C>, InferSelectors<C>>;
3697
+ type WithRequiredKey<P = {}> = (P extends {
3698
+ key: string;
3699
+ } ? P : never) | {
3700
+ key: string;
3701
+ };
3702
+ //#endregion
3703
+ //#region src/lib/editor/SlateEditor.d.ts
3704
+ type BaseEditor = EditorBase & {
3705
+ /** DOM state */
3706
+ dom: {
3707
+ /** Whether the editor is composing text. */
3708
+ composing: boolean;
3709
+ /** The current keyboard event. */
3710
+ currentKeyboardEvent: KeyboardEventLike | null;
3711
+ /** Whether the editor is focused. */
3712
+ focused: boolean;
3713
+ /** The previous selection. */
3714
+ prevSelection: TRange | null;
3715
+ /** Whether the editor is read-only. */
3716
+ readOnly: boolean;
3717
+ };
3718
+ meta: EditorBase['meta'] & {
3719
+ /**
3720
+ * A key that can be used to uniquely identify the editor. For RSC usage,
3721
+ * use `uid` instead.
3722
+ */
3723
+ key: any;
3724
+ /** A record of plugin components. */
3725
+ components: NodeComponents;
3726
+ /**
3727
+ * Current user ID for collaborative features (e.g., Yjs). Used to identify
3728
+ * the creator of elements like combobox inputs.
3729
+ */
3730
+ userId?: string | null;
3731
+ /** Whether the editor is a fallback editor. */
3732
+ isFallback: boolean;
3733
+ /** Plugin cache by feature. */
3734
+ pluginCache: {
3735
+ decorate: string[];
3736
+ handlers: {
3737
+ onChange: string[];
3738
+ onNodeChange: string[];
3739
+ onTextChange: string[];
3740
+ };
3741
+ inject: {
3742
+ nodeProps: string[];
3743
+ };
3744
+ node: {
3745
+ isContainer: string[];
3746
+ isLeaf: string[];
3747
+ isText: string[];
3748
+ leafProps: string[];
3749
+ textProps: string[];
3750
+ /** Node types to plugin keys. */
3751
+ types: Record<string, string>;
3752
+ };
3753
+ normalizeInitialValue: string[];
3754
+ render: {
3755
+ aboveEditable: string[];
3756
+ aboveNodes: string[];
3757
+ aboveSlate: string[];
3758
+ afterContainer: string[];
3759
+ afterEditable: string[];
3760
+ beforeContainer: string[];
3761
+ beforeEditable: string[];
3762
+ belowNodes: string[];
3763
+ belowRootNodes: string[];
3764
+ };
3765
+ rules: {
3766
+ match: string[];
3767
+ };
3768
+ useHooks: string[];
3769
+ };
3770
+ /** All plugins. */
3771
+ pluginList: any[];
3772
+ /**
3773
+ * A stable unique identifier that remains constant from Plate RSC to client
3774
+ * hydration.
3775
+ */
3776
+ uid?: string;
3777
+ };
3778
+ plugins: Record<string, any>;
3779
+ setOptions: <C extends AnyPluginConfig>(plugin: WithRequiredKey<C>, options: ((state: Draft<Partial<InferOptions<C>>>) => void) | Partial<InferOptions<C>>) => void;
3780
+ getInjectProps: <C extends AnyPluginConfig = PluginConfig>(plugin: WithRequiredKey<C>) => InjectNodeProps<C>;
3781
+ getOption: <C extends AnyPluginConfig, StateType extends InferOptions<C>, TSelectors extends InferSelectors<C>, K$1 extends keyof StateType | keyof TSelectors | 'state'>(plugin: WithRequiredKey<C>, key: K$1, ...args: K$1 extends keyof TSelectors ? Parameters<TSelectors[K$1]> : []) => K$1 extends 'state' ? StateType : K$1 extends keyof TSelectors ? ReturnType<TSelectors[K$1]> : K$1 extends keyof StateType ? StateType[K$1] : never;
3782
+ getOptions: <C extends AnyPluginConfig = PluginConfig>(plugin: WithRequiredKey<C>) => InferOptions<C>;
3783
+ getOptionsStore: <C extends AnyPluginConfig>(plugin: WithRequiredKey<C>) => TStateApi<InferOptions<C>, [['zustand/mutative-x', never]], {}, InferSelectors<C>>;
3784
+ getPlugin: <C extends AnyPluginConfig = PluginConfig>(plugin: WithRequiredKey<C>) => C extends {
3785
+ node: any;
3786
+ } ? C : EditorPlugin<C>;
3787
+ getType: (pluginKey: string) => string;
3788
+ setOption: <C extends AnyPluginConfig, K$1 extends keyof InferOptions<C>>(plugin: WithRequiredKey<C>, optionKey: K$1, value: InferOptions<C>[K$1]) => void;
3789
+ };
3790
+ type InferPlugins<T extends AnyPluginConfig[]> = T[number];
3791
+ type KeyofPlugins<T extends AnyPluginConfig> = (string & {}) | InferKey<CorePlugin | T>;
3792
+ type KeyofNodePlugins<T extends AnyPluginConfig> = (string & {}) | InferKey<T | typeof BaseParagraphPlugin>;
3793
+ type SlateEditor = BaseEditor & {
3794
+ api: EditorApi & UnionToIntersection<InferApi<CorePlugin>>;
3795
+ meta: BaseEditor['meta'] & {
3796
+ /** An array of plugins that are currently being used by the editor. */
3797
+ pluginList: AnyEditorPlugin[];
3798
+ shortcuts: any;
3799
+ };
3800
+ plugins: Record<string, AnyEditorPlugin>;
3801
+ tf: EditorTransforms & UnionToIntersection<InferTransforms<CorePlugin>>;
3802
+ transforms: EditorTransforms & UnionToIntersection<InferTransforms<CorePlugin>>;
3803
+ getApi: <C extends AnyPluginConfig = PluginConfig>(plugin?: WithRequiredKey<C>) => SlateEditor['api'] & InferApi<C>;
3804
+ getPlugin: <C extends AnyPluginConfig = PluginConfig>(plugin: WithRequiredKey<C>) => C extends {
3805
+ node: any;
3806
+ } ? C : EditorPlugin<C>;
3807
+ getTransforms: <C extends AnyPluginConfig = PluginConfig>(plugin?: WithRequiredKey<C>) => SlateEditor['tf'] & InferTransforms<C>;
3808
+ };
3809
+ type TSlateEditor<V extends Value = Value, P extends AnyPluginConfig = CorePlugin> = SlateEditor & {
3810
+ api: EditorApi<V> & UnionToIntersection<InferApi<CorePlugin | P>>;
3811
+ children: V;
3812
+ meta: BaseEditor['meta'] & {
3813
+ pluginList: P[];
3814
+ shortcuts: any;
3815
+ };
3816
+ plugins: { [K in P['key']]: Extract<P, {
3817
+ key: K;
3818
+ }> };
3819
+ tf: EditorTransforms<V> & UnionToIntersection<InferTransforms<CorePlugin | P>>;
3820
+ transforms: EditorTransforms<V> & UnionToIntersection<InferTransforms<CorePlugin | P>>;
3821
+ getApi: <C extends AnyPluginConfig = PluginConfig>(plugin?: WithRequiredKey<C>) => TSlateEditor<V>['api'] & InferApi<C>;
3822
+ getTransforms: <C extends AnyPluginConfig = PluginConfig>(plugin?: WithRequiredKey<C>) => TSlateEditor<V>['tf'] & InferTransforms<C>;
3823
+ };
3824
+ //#endregion
3825
+ //#region src/internal/plugin/resolvePlugins.d.ts
3826
+ /**
3827
+ * Initialize and configure the editor's plugin system. This function sets up
3828
+ * the editor's plugins, resolving core and custom plugins, and applying any
3829
+ * overrides specified in the plugins.
3830
+ */
3831
+ type PluginStoreFactory = typeof createVanillaStore;
3832
+ //#endregion
3833
+ //#region src/lib/editor/withSlate.d.ts
3834
+ type BaseWithSlateOptions<P extends AnyPluginConfig = CorePlugin> = {
3835
+ /**
3836
+ * Unique identifier for the editor instance.
3837
+ *
3838
+ * @default nanoid()
3839
+ */
3840
+ id?: string;
3841
+ /**
3842
+ * Current user ID for collaborative features (e.g., Yjs). Used to identify
3843
+ * the creator of elements like combobox inputs.
3844
+ */
3845
+ userId?: string | null;
3846
+ /**
3847
+ * Determines which mark/element to apply at boundaries between different
3848
+ * marks, based on cursor movement using the left/right arrow keys.
3849
+ *
3850
+ * Example: <text bold>Bold</text><cursor><text italic>Italic</text>
3851
+ *
3852
+ * If the cursor moved here from the left (via → key), typing applies
3853
+ * **bold**.
3854
+ *
3855
+ * If the cursor moved here from the right (via ← key), typing applies
3856
+ * _italic_.
3857
+ *
3858
+ * Without mark affinity, the preceding mark (**bold**) is always applied
3859
+ * regardless of direction.
3860
+ *
3861
+ * @default true
3862
+ */
3863
+ affinity?: boolean;
3864
+ /**
3865
+ * Select the editor after initialization.
3866
+ *
3867
+ * @default false
3868
+ *
3869
+ * - `true` | 'end': Select the end of the editor
3870
+ * - `false`: Do not select anything
3871
+ * - `'start'`: Select the start of the editor
3872
+ */
3873
+ autoSelect?: boolean | 'end' | 'start';
3874
+ /**
3875
+ * Configure Slate's chunking optimization, which reduces latency while
3876
+ * typing. Set to `false` to disable.
3877
+ *
3878
+ * @default true
3879
+ * @see https://docs.slatejs.org/walkthroughs/09-performance
3880
+ */
3881
+ chunking?: ChunkingConfig['options'] | boolean;
3882
+ /** Specifies the component for each plugin key. */
3883
+ components?: NodeComponents;
3884
+ /** Specifies the component for each plugin key. */
3885
+ /**
3886
+ * Specifies the maximum number of characters allowed in the editor. When the
3887
+ * limit is reached, further input will be prevented.
3888
+ */
3889
+ maxLength?: number;
3890
+ /**
3891
+ * Configuration for automatic node ID generation and management.
3892
+ *
3893
+ * Unless set to `false`, the editor automatically adds unique IDs to nodes
3894
+ * through the core NodeIdPlugin:
3895
+ *
3896
+ * - Normalizes the initial value for missing IDs
3897
+ * - Adds IDs to new nodes during insertion
3898
+ * - Preserves or reuses IDs on undo/redo and copy/paste operations
3899
+ * - Handles ID conflicts and duplicates
3900
+ *
3901
+ * @default { idKey: 'id', filterInline: true, filterText: true, idCreator: () => nanoid(10) }
3902
+ */
3903
+ nodeId?: NodeIdConfig['options'] | boolean;
3904
+ /**
3905
+ * Factory used to create the per-plugin options store
3906
+ *
3907
+ * @default createVanillaStore from zustand-x/vanilla
3908
+ */
3909
+ optionsStoreFactory?: PluginStoreFactory;
3910
+ /**
3911
+ * Array of plugins to be loaded into the editor. Plugins extend the editor's
3912
+ * functionality and define custom behavior.
3913
+ */
3914
+ plugins?: P[];
3915
+ /**
3916
+ * Editor read-only initial state. For dynamic read-only control, use the
3917
+ * `Plate.readOnly` prop instead.
3918
+ *
3919
+ * @default false
3920
+ */
3921
+ readOnly?: boolean;
3922
+ /**
3923
+ * Initial selection state for the editor. Defines where the cursor should be
3924
+ * positioned when the editor loads.
3925
+ */
3926
+ selection?: TSelection;
3927
+ /**
3928
+ * When `true`, normalizes the initial `value` passed to the editor. This is
3929
+ * useful when adding normalization rules to already existing content or when
3930
+ * the initial value might not conform to the current schema.
3931
+ *
3932
+ * Note: Normalization may take time for large documents.
3933
+ *
3934
+ * @default false
3935
+ */
3936
+ shouldNormalizeEditor?: boolean;
3937
+ /**
3938
+ * When `true`, skips the initial value, selection, and normalization logic.
3939
+ * Useful when the editor state is managed externally (e.g., with Yjs
3940
+ * collaboration) or when you want to manually control the initialization
3941
+ * process.
3942
+ *
3943
+ * @default false
3944
+ */
3945
+ skipInitialization?: boolean;
3946
+ };
3947
+ type WithSlateOptions<V extends Value = Value, P extends AnyPluginConfig = CorePlugin> = BaseWithSlateOptions<P> & Pick<Partial<AnySlatePlugin>, 'api' | 'decorate' | 'extendEditor' | 'inject' | 'normalizeInitialValue' | 'options' | 'override' | 'transforms'> & {
3948
+ /**
3949
+ * Initial content for the editor.
3950
+ *
3951
+ * Can be:
3952
+ *
3953
+ * - A static value (array of nodes)
3954
+ * - An HTML string that will be deserialized
3955
+ * - A function that returns a value or Promise<value>
3956
+ * - `null` for an empty editor
3957
+ *
3958
+ * @default [{ type: 'p'; children: [{ text: '' }] }]
3959
+ */
3960
+ value?: ((editor: SlateEditor) => Promise<V> | V) | V | string | null;
3961
+ /** Function to configure the root plugin */
3962
+ rootPlugin?: (plugin: AnySlatePlugin) => AnySlatePlugin;
3963
+ /**
3964
+ * Callback called when the editor is ready (after initialization
3965
+ * completes).
3966
+ */
3967
+ onReady?: (ctx: {
3968
+ editor: SlateEditor;
3969
+ isAsync: boolean;
3970
+ value: V;
3971
+ }) => void;
3972
+ };
3973
+ /**
3974
+ * Applies Plate enhancements to an editor instance (non-React version).
3975
+ *
3976
+ * @remarks
3977
+ * This function supports server-side usage as it doesn't include React-specific
3978
+ * features like component rendering or hooks integration.
3979
+ * @see {@link createSlateEditor} for a higher-level non-React editor creation function.
3980
+ * @see {@link createPlateEditor} for a React-specific version of editor creation.
3981
+ * @see {@link usePlateEditor} for a memoized React version.
3982
+ * @see {@link withPlate} for the React-specific enhancement function.
3983
+ */
3984
+ declare const withSlate: <V extends Value = Value, P extends AnyPluginConfig = CorePlugin>(e: Editor, {
3985
+ id,
3986
+ affinity,
3987
+ autoSelect,
3988
+ chunking,
3989
+ maxLength,
3990
+ nodeId,
3991
+ optionsStoreFactory,
3992
+ plugins,
3993
+ readOnly,
3994
+ rootPlugin,
3995
+ selection,
3996
+ shouldNormalizeEditor,
3997
+ skipInitialization,
3998
+ userId,
3999
+ value,
4000
+ onReady,
4001
+ ...pluginConfig
4002
+ }?: WithSlateOptions<V, P>) => TSlateEditor<V, InferPlugins<P[]>>;
4003
+ type CreateSlateEditorOptions<V extends Value = Value, P extends AnyPluginConfig = CorePlugin> = WithSlateOptions<V, P> & {
4004
+ /**
4005
+ * Initial editor to be extended with `withSlate`.
4006
+ *
4007
+ * @default createEditor()
4008
+ */
4009
+ editor?: Editor;
4010
+ };
4011
+ /**
4012
+ * Creates a Slate editor (non-React version).
4013
+ *
4014
+ * This function creates a fully configured Plate editor instance that can be
4015
+ * used in non-React environments or server-side contexts. It applies all the
4016
+ * specified plugins and configurations to create a functional editor.
4017
+ *
4018
+ * Examples:
4019
+ *
4020
+ * ```ts
4021
+ * const editor = createSlateEditor({
4022
+ * plugins: [ParagraphPlugin, HeadingPlugin],
4023
+ * value: [{ type: 'p', children: [{ text: 'Hello world!' }] }],
4024
+ * });
4025
+ *
4026
+ * // Editor with custom configuration
4027
+ * const editor = createSlateEditor({
4028
+ * plugins: [ParagraphPlugin],
4029
+ * maxLength: 1000,
4030
+ * nodeId: { idCreator: () => uuidv4() },
4031
+ * autoSelect: 'end',
4032
+ * });
4033
+ *
4034
+ * // Server-side editor
4035
+ * const editor = createSlateEditor({
4036
+ * plugins: [ParagraphPlugin],
4037
+ * value: '<p>HTML content</p>',
4038
+ * skipInitialization: true,
4039
+ * });
4040
+ * ```
4041
+ *
4042
+ * @see {@link createPlateEditor} for a React-specific version of editor creation.
4043
+ * @see {@link usePlateEditor} for a memoized React version.
4044
+ * @see {@link withSlate} for the underlying function that applies Slate enhancements to an editor.
4045
+ */
4046
+ declare const createSlateEditor: <V extends Value = Value, P extends AnyPluginConfig = CorePlugin>({
4047
+ editor,
4048
+ ...options
4049
+ }?: CreateSlateEditorOptions<V, P>) => TSlateEditor<V, P>;
4050
+ //#endregion
4051
+ //#region src/lib/types/RenderChunkProps.d.ts
4052
+ type RenderChunkFn = (props: RenderChunkProps) => React$1.ReactElement<any>;
4053
+ type RenderChunkProps = {
4054
+ attributes: {
4055
+ 'data-slate-chunk': true;
4056
+ };
4057
+ children: any;
4058
+ highest: boolean;
4059
+ lowest: boolean;
4060
+ };
4061
+ //#endregion
4062
+ //#region src/lib/types/RenderElementProps.d.ts
4063
+ type RenderElementFn = (props: RenderElementProps) => React$1.ReactElement<any>;
4064
+ type RenderElementProps<N$1 extends TElement = TElement> = {
4065
+ attributes: {
4066
+ 'data-slate-node': 'element';
4067
+ ref: any;
4068
+ className?: string;
4069
+ 'data-slate-inline'?: true;
4070
+ 'data-slate-void'?: true;
4071
+ dir?: 'rtl';
4072
+ style?: React$1.CSSProperties;
4073
+ };
4074
+ children: any;
4075
+ element: N$1;
4076
+ };
4077
+ //#endregion
4078
+ //#region src/lib/types/RenderLeafProps.d.ts
4079
+ type RenderLeafFn = (props: RenderLeafProps) => React.ReactElement<any>;
4080
+ type RenderLeafProps<N$1 extends TText = TText> = {
4081
+ attributes: {
4082
+ className?: string;
4083
+ 'data-slate-leaf'?: true;
4084
+ style?: React.CSSProperties;
4085
+ };
4086
+ children: any;
4087
+ leaf: N$1;
4088
+ text: N$1;
4089
+ /**
4090
+ * The position of the leaf within the Text node, only present when the text
4091
+ * node is split by decorations.
4092
+ */
4093
+ leafPosition?: LeafPosition;
4094
+ };
4095
+ //#endregion
4096
+ //#region src/lib/types/RenderTextProps.d.ts
4097
+ type RenderTextFn = (props: RenderTextProps) => React$1.ReactElement<any>;
4098
+ type RenderTextProps<N$1 extends TText = TText> = {
4099
+ /** The text node being rendered. */
4100
+ text: N$1;
4101
+ /** The children (leaves) rendered within this text node. */
4102
+ children: any;
4103
+ /**
4104
+ * HTML attributes to be spread onto the rendered container element. Includes
4105
+ * `data-slate-node="text"` and `ref`.
4106
+ */
4107
+ attributes: {
4108
+ 'data-slate-node': 'text';
4109
+ ref: any;
4110
+ className?: string;
4111
+ style?: React$1.CSSProperties;
4112
+ };
4113
+ };
4114
+ //#endregion
4115
+ //#region src/lib/types/EditableProps.d.ts
4116
+ /** `EditableProps` are passed to the <Editable> component. */
4117
+ type EditableProps = {
4118
+ as?: React.ElementType;
4119
+ disableDefaultStyles?: boolean;
4120
+ placeholder?: string;
4121
+ readOnly?: boolean;
4122
+ renderChunk?: RenderChunkFn;
4123
+ renderElement?: RenderElementFn;
4124
+ renderLeaf?: RenderLeafFn;
4125
+ renderText?: RenderTextFn;
4126
+ role?: string;
4127
+ style?: React.CSSProperties;
4128
+ decorate?: (entry: NodeEntry) => TRange[];
4129
+ renderPlaceholder?: (props: {
4130
+ attributes: {
4131
+ contentEditable: boolean;
4132
+ 'data-slate-placeholder': boolean;
4133
+ ref: React.RefCallback<any>;
4134
+ style: React.CSSProperties;
4135
+ dir?: 'rtl';
4136
+ };
4137
+ children: any;
4138
+ }) => JSX.Element;
4139
+ scrollSelectionIntoView?: (editor: Editor, domRange: DOMRange) => void;
4140
+ onDOMBeforeInput?: (event: InputEvent) => void;
4141
+ } & React.TextareaHTMLAttributes<HTMLDivElement>;
4142
+ //#endregion
4143
+ //#region src/lib/utils/applyDeepToNodes.d.ts
4144
+ type ApplyDeepToNodesOptions<N$1 extends TNode> = {
4145
+ apply: (node: NodeOf<N$1>, source: (() => Record<string, any>) | Record<string, any>) => void;
4146
+ node: N$1;
4147
+ source: (() => Record<string, any>) | Record<string, any>;
4148
+ path?: Path;
4149
+ query?: QueryNodeOptions;
4150
+ };
4151
+ /** Recursively apply an operation to children nodes with a query. */
4152
+ declare const applyDeepToNodes: <N$1 extends TNode>({
4153
+ apply,
4154
+ node,
4155
+ path,
4156
+ query,
4157
+ source
4158
+ }: ApplyDeepToNodesOptions<N$1>) => void;
4159
+ //#endregion
4160
+ //#region src/lib/utils/checkUtils.d.ts
4161
+ declare const isSlateVoid: (element: HTMLElement) => boolean;
4162
+ declare const isSlateElement: (element: HTMLElement) => boolean;
4163
+ declare const isSlateText: (element: HTMLElement) => boolean;
4164
+ declare const isSlateString: (element: HTMLElement) => boolean;
4165
+ declare const isSlateLeaf: (element: HTMLElement) => boolean;
4166
+ declare const isSlateEditor: (element: HTMLElement) => boolean;
4167
+ declare const isSlateNode: (element: HTMLElement) => boolean;
4168
+ declare const isSlatePluginElement: (element: HTMLElement, pluginKey: string) => boolean;
4169
+ declare const isSlatePluginNode: (element: HTMLElement, pluginKey: string) => boolean;
4170
+ declare const getSlateElements: (element: HTMLElement) => HTMLElement[];
4171
+ //#endregion
4172
+ //#region src/lib/utils/defaultsDeepToNodes.d.ts
4173
+ /** Recursively merge a source object to children nodes with a query. */
4174
+ declare const defaultsDeepToNodes: <N$1 extends TNode>(options: Omit<ApplyDeepToNodesOptions<N$1>, "apply">) => void;
4175
+ //#endregion
4176
+ //#region src/lib/utils/getInjectMatch.d.ts
4177
+ declare const getInjectMatch: <E extends SlateEditor>(editor: E, plugin: EditorPlugin) => (node: TNode, path: Path) => boolean;
4178
+ //#endregion
4179
+ //#region src/lib/utils/getInjectedPlugins.d.ts
4180
+ /**
4181
+ * Get all plugins having a defined `inject.plugins[plugin.key]`. It includes
4182
+ * `plugin` itself.
4183
+ */
4184
+ declare const getInjectedPlugins: (editor: SlateEditor, plugin: AnyEditorPlugin) => Partial<AnyEditorPlugin>[];
4185
+ //#endregion
4186
+ //#region src/lib/utils/getNodeDataAttributeKeys.d.ts
4187
+ declare const getNodeDataAttributeKeys: (node: TElement | TText) => string[];
4188
+ declare const keyToDataAttribute: (key: string) => string;
4189
+ //#endregion
4190
+ //#region src/lib/utils/getPluginNodeProps.d.ts
4191
+ declare const getPluginNodeProps: ({
4192
+ attributes: nodeAttributes,
4193
+ node,
4194
+ plugin,
4195
+ props
4196
+ }: {
4197
+ props: SlateRenderNodeProps;
4198
+ attributes?: AnyObject;
4199
+ node?: TElement | TText;
4200
+ plugin?: AnyEditorPlugin;
4201
+ }) => any;
4202
+ //#endregion
4203
+ //#region src/lib/utils/getSlateClass.d.ts
4204
+ /** Get slate class name: slate-<type> */
4205
+ declare const getSlateClass: (type?: string) => string;
4206
+ //#endregion
4207
+ //#region src/lib/utils/hotkeys.d.ts
4208
+ /** Create a platform-aware hotkey checker. */
4209
+ declare const createHotkey: (key: string) => (event: KeyboardEventLike) => boolean;
4210
+ declare const Hotkeys: {
4211
+ isBold: (event: KeyboardEventLike) => boolean;
4212
+ isCompose: (event: KeyboardEventLike) => boolean;
4213
+ isDeleteBackward: (event: KeyboardEventLike) => boolean;
4214
+ isDeleteForward: (event: KeyboardEventLike) => boolean;
4215
+ isDeleteLineBackward: (event: KeyboardEventLike) => boolean;
4216
+ isDeleteLineForward: (event: KeyboardEventLike) => boolean;
4217
+ isDeleteWordBackward: (event: KeyboardEventLike) => boolean;
4218
+ isDeleteWordForward: (event: KeyboardEventLike) => boolean;
4219
+ isEscape: (event: KeyboardEventLike) => boolean;
4220
+ isExtendBackward: (event: KeyboardEventLike) => boolean;
4221
+ isExtendDownward: (event: KeyboardEventLike) => boolean;
4222
+ isExtendForward: (event: KeyboardEventLike) => boolean;
4223
+ isExtendLineBackward: (event: KeyboardEventLike) => boolean;
4224
+ isExtendLineForward: (event: KeyboardEventLike) => boolean;
4225
+ isExtendUpward: (event: KeyboardEventLike) => boolean;
4226
+ isItalic: (event: KeyboardEventLike) => boolean;
4227
+ isMoveBackward: (event: KeyboardEventLike) => boolean;
4228
+ isMoveDownward: (event: KeyboardEventLike) => boolean;
4229
+ isMoveForward: (event: KeyboardEventLike) => boolean;
4230
+ isMoveLineBackward: (event: KeyboardEventLike) => boolean;
4231
+ isMoveLineForward: (event: KeyboardEventLike) => boolean;
4232
+ isMoveUpward: (event: KeyboardEventLike) => boolean;
4233
+ isMoveWordBackward: (event: KeyboardEventLike) => boolean;
4234
+ isMoveWordForward: (event: KeyboardEventLike) => boolean;
4235
+ isRedo: (event: KeyboardEventLike) => boolean;
4236
+ isSelectAll: (event: KeyboardEventLike) => boolean;
4237
+ isSoftBreak: (event: KeyboardEventLike) => boolean;
4238
+ isSplitBlock: (event: KeyboardEventLike) => boolean;
4239
+ isTab: (editor: Editor, event: React.KeyboardEvent, {
4240
+ composing
4241
+ }?: {
4242
+ /** Ignore the event if composing. */
4243
+ composing?: boolean;
4244
+ }) => boolean;
4245
+ isTransposeCharacter: (event: KeyboardEventLike) => boolean;
4246
+ isUndo: (event: KeyboardEventLike) => boolean;
4247
+ isUntab: (editor: Editor, event: React.KeyboardEvent, {
4248
+ composing
4249
+ }?: {
4250
+ /** Ignore the event if composing. */
4251
+ composing?: boolean;
4252
+ }) => boolean;
4253
+ };
4254
+ //#endregion
4255
+ //#region src/lib/utils/isType.d.ts
4256
+ /** Does the node match the type provided. */
4257
+ declare const isType: (editor: SlateEditor, node: any, key?: string[] | string) => boolean;
4258
+ //#endregion
4259
+ //#region src/lib/utils/mergeDeepToNodes.d.ts
4260
+ /** Recursively merge a source object to children nodes with a query. */
4261
+ declare const mergeDeepToNodes: <N$1 extends TNode>(options: Omit<ApplyDeepToNodesOptions<N$1>, "apply">) => void;
4262
+ //#endregion
4263
+ //#region src/lib/utils/normalizeDescendantsToDocumentFragment.d.ts
4264
+ /** Normalize the descendants to a valid document fragment. */
4265
+ declare const normalizeDescendantsToDocumentFragment: (editor: SlateEditor, {
4266
+ defaultElementPlugin,
4267
+ descendants
4268
+ }: {
4269
+ descendants: Descendant[];
4270
+ defaultElementPlugin?: WithRequiredKey;
4271
+ }) => Descendant[];
4272
+ //#endregion
4273
+ //#region src/lib/utils/omitPluginContext.d.ts
4274
+ declare const omitPluginContext: <T extends SlatePluginContext<AnySlatePlugin>>(ctx: T) => Omit<T, "api" | "editor" | "getOptions" | "getOption" | "tf" | "type" | "setOptions" | "setOption" | "plugin">;
4275
+ //#endregion
4276
+ //#region src/lib/utils/overridePluginsByKey.d.ts
4277
+ /**
4278
+ * Recursive deep merge of each plugin from `override.plugins` into plugin with
4279
+ * same key (plugin > plugin.plugins).
4280
+ */
4281
+ declare const overridePluginsByKey: (plugin: AnySlatePlugin, overrideByKey?: Record<string, Partial<AnySlatePlugin>>, nested?: boolean) => AnySlatePlugin;
4282
+ //#endregion
4283
+ //#region src/lib/utils/pipeInsertDataQuery.d.ts
4284
+ /** Is the plugin disabled by another plugin. */
4285
+ declare const pipeInsertDataQuery: (editor: SlateEditor, plugins: Partial<AnyEditorPlugin>[], options: ParserOptions) => boolean;
4286
+ //#endregion
4287
+ //#region src/lib/utils/pipeOnNodeChange.d.ts
4288
+ declare const pipeOnNodeChange: (editor: SlateEditor, node: Descendant, prevNode: Descendant, operation: NodeOperation) => boolean;
4289
+ //#endregion
4290
+ //#region src/lib/utils/pipeOnTextChange.d.ts
4291
+ declare const pipeOnTextChange: (editor: SlateEditor, node: Descendant, text: string, prevText: string, operation: TextOperation) => boolean;
4292
+ //#endregion
4293
+ export { TSlateEditor as $, ResetOptions as $i, HtmlPlugin as $n, getEditorPlugin as $r, WhiteSpaceRule as $t, applyDeepToNodes as A, PlateStatic as Aa, SlatePluginMethods as Ai, getHtmlComments as An, DOMPlugin as Ar, BaseParagraphPlugin as At, ZustandStoreApi as B, pluginRenderElementStatic as Ba, getSelectedDomFragment as Bi, cleanHtmlLinkElements as Bn, insertExitBreak as Br, endInlineFormattingContext as Bt, isSlateNode as C, SlateRenderLeafProps as Ca, RenderStaticNodeWrapper as Ci, inlineTagNames as Cn, getEdgeNodes as Cr, NodeComponents as Ct, isSlateText as D, serializeHtml as Da, SlatePlugin as Di, htmlElementToElement as Dn, ElementAffinity as Dr, SelectionRules as Dt, isSlateString as E, SerializeHtmlOptions as Ea, Serializer as Ei, htmlElementToLeaf as En, AffinityPlugin as Er, PluginConfig as Et, RenderLeafProps as F, SlateRenderLeaf as Fa, stripSlateDataAttributes as Fi, deserializeHtmlNode as Fn, SlateExtensionConfig as Fr, withBreakRules as Ft, WithSlateOptions as G, createStaticString as Gi, DeserializeHtmlChildren as Gn, withPlateHistory as Gr, collapseWhiteSpaceNode as Gt, nanoid$1 as H, AstPlugin as Ha, getRenderNodeStaticProps as Hi, cleanHtmlEmptyElements as Hn, init as Hr, isLastNonEmptyTextOfInlineFormattingContext as Ht, RenderElementFn as I, pipeRenderLeafStatic as Ia, stripHtmlClassNames as Ii, deserializeHtmlElement as In, SlateExtensionPlugin as Ir, OverridePlugin as It, BaseEditor as J, Descendant$1 as Ji, LINE_FEED as Jn, getPluginKey as Jr, collapseWhiteSpace as Jt, createSlateEditor as K, getStaticPlugins as Ki, DeserializeHtmlNodeReturnType as Kn, getContainerTypes as Kr, collapseWhiteSpaceElement as Kt, RenderElementProps as L, pluginRenderLeafStatic as La, pipeDecorate as Li, deserializeHtml as Ln, setValue as Lr, withOverrides as Lt, RenderTextFn as M, SlateRenderText as Ma, SlateShortcut as Mi, findHtmlElement as Mn, ScrollMode as Mr, withNormalizeRules as Mt, RenderTextProps as N, pipeRenderTextStatic as Na, TextStaticProps as Ni, someHtmlElement as Nn, WithAutoScrollOptions as Nr, withMergeRules as Nt, isSlateVoid as O, ElementStatic as Oa, SlatePluginConfig$1 as Oi, htmlBrToNewLine as On, AUTO_SCROLL as Or, WithAnyKey as Ot, RenderLeafFn as P, pluginRenderTextStatic as Pa, TransformOptions as Pi, deserializeHtmlNodeChildren as Pn, withScrolling as Pr, withDeleteRules as Pt, SlateEditor as Q, Path$2 as Qi, ZERO_WIDTH_SPACE as Qn, getSlatePlugin as Qr, TrimStartRule as Qt, RenderChunkFn as R, pipeRenderElementStatic as Ra, isSelectOutside as Ri, copyBlockMarksToSpanChild as Rn, resetBlock as Rr, withNodeId as Rt, isSlateLeaf as S, SlateRenderElementProps as Sa, PartialEditorPlugin as Si, isHtmlBlockElement as Sn, getMarkBoundaryAffinity as Sr, NodeComponent as St, isSlatePluginNode as T, SlateRenderTextProps as Ta, RenderStaticNodeWrapperProps as Ti, htmlStringToDOMNode as Tn, AffinityConfig as Tr, ParserOptions as Tt, BaseWithSlateOptions as U, getNodeDataAttributes as Ui, cleanHtmlCrLf as Un, ParserPlugin as Ur, inferWhiteSpaceRule as Ut, createZustandStore$1 as V, HandlerReturnType as Va, getSelectedDomBlocks as Vi, cleanHtmlFontElements as Vn, InitOptions as Vr, upsertInlineFormattingContext as Vt, CreateSlateEditorOptions as W, getPluginDataAttributes as Wi, cleanHtmlBrElements as Wn, HistoryPlugin as Wr, collapseWhiteSpaceText as Wt, KeyofNodePlugins as X, NodeOperation$1 as Xi, SPACE as Xn, getPluginType as Xr, CollapseWhiteSpaceState as Xt, InferPlugins as Y, NodeEntry$2 as Yi, NO_BREAK_SPACE as Yn, getPluginKeys as Yr, collapseString as Yt, KeyofPlugins as Z, Operation$1 as Zi, TAB as Zn, getPluginTypes as Zr, TrimEndRule as Zt, getInjectMatch as _, StyledSlateElementProps as _a, NodeStaticWrapperComponentProps as _i, isHtmlTable as _n, LogLevel as _r, InferOptions as _t, omitPluginContext as a, TextOperation$1 as aa, Deserializer as ai, replaceTagName as an, GetCorePluginsOptions as ar, BasePluginContext as at, isSlateEditor as b, useNodeAttributes as ba, OverrideEditor as bi, isHtmlElement as bn, isNodeAffinity as br, MatchRules as bt, isType as c, getEditorDOMFromHtmlString as ca, ExtendEditorApi as ci, preCleanHtml as cn, ChunkingConfig as cr, BaseTransformOptions as ct, isHotkey as d, SlateHTMLProps as da, HtmlSerializer as di, pipeDeserializeHtmlLeaf as dn, NodeIdOptions as dr, EditOnlyConfig as dt, ScrollIntoViewOptions$1 as ea, createSlatePlugin as ei, unwrapHtmlElement as en, withChunking as er, AnyPluginConfig as et, getSlateClass as f, SlateLeaf as fa, InferConfig as fi, pipeDeserializeHtmlElement as fn, NodeIdPlugin as fr, ExtendConfig as ft, getInjectedPlugins as g, SlateTextProps as ga, NodeStaticWrapperComponent as gi, isHtmlText as gn, DebugPlugin as gr, InferKey as gt, keyToDataAttribute as h, SlateText as ha, NodeStaticProps as hi, isOlSymbol as hn, DebugErrorType as hr, InferApi as ht, overridePluginsByKey as i, TText$1 as ia, Decorate as ii, traverseHtmlComments as in, DebugConfig as ir, BasePlugin as it, EditableProps as j, PlateStaticProps as ja, SlatePlugins as ji, getDataNodeProps as jn, DomConfig as jr, ParagraphConfig as jt, ApplyDeepToNodesOptions as k, LeafStatic as ka, SlatePluginContext as ki, htmlBodyToFragment as kn, AutoScrollOperationsMap as kr, WithRequiredKey as kt, Hotkeys as l, SlateElement as la, ExtendEditorTransforms as li, postCleanHtml as ln, ChunkingPlugin as lr, BreakRules as lt, getNodeDataAttributeKeys as m, SlateNodeProps as ma, LeafStaticProps as mi, parseHtmlDocument as mn, normalizeNodeId as mr, GetInjectNodePropsReturnType as mt, pipeOnNodeChange as n, TRange$1 as na, AnyEditorPlugin as ni, traverseHtmlNode as nn, CorePluginApi as nr, BaseHtmlDeserializer as nt, normalizeDescendantsToDocumentFragment as o, Value$1 as oa, EditorPlugin as oi, removeHtmlSurroundings as on, LengthConfig as or, BasePluginNode as ot, getPluginNodeProps as p, SlateLeafProps as pa, InjectNodeProps as pi, parseHtmlElement as pn, NormalizeNodeIdOptions as pr, GetInjectNodePropsOptions as pt, withSlate as q, ViewPlugin as qi, CARRIAGE_RETURN as qn, getPluginByType as qr, collapseWhiteSpaceChildren as qt, pipeInsertDataQuery as r, TSelection$1 as ra, AnySlatePlugin as ri, traverseHtmlElements as rn, CorePluginTransforms as rr, BaseInjectProps as rt, mergeDeepToNodes as s, createStaticEditor as sa, ExtendEditor as si, removeHtmlNodesBetweenComments as sn, getCorePlugins as sr, BaseSerializer as st, pipeOnTextChange as t, TElement$1 as ta, createTSlatePlugin as ti, traverseHtmlTexts as tn, CorePlugin as tr, BaseDeserializer as tt, createHotkey as u, SlateElementProps as ua, HtmlDeserializer as ui, pluginDeserializeHtml as un, NodeIdConfig as ur, DeleteRules as ut, defaultsDeepToNodes as v, StyledSlateLeafProps as va, NodeStaticWrapperComponentReturnType as vi, isHtmlInlineElement as vn, PlateError as vr, InferSelectors as vt, isSlatePluginElement as w, SlateRenderNodeProps as wa, RenderStaticNodeWrapperFunction as wi, htmlTextNodeToString as wn, EdgeNodes as wr, NormalizeRules as wt, isSlateElement as x, BoxStaticProps as xa, Parser as xi, isHtmlComment as xn, isNodesAffinity as xr, MergeRules as xt, getSlateElements as y, StyledSlateTextProps as ya, NormalizeInitialValue as yi, isHtmlFragmentHref as yn, setAffinitySelection as yr, InferTransforms as yt, RenderChunkProps as z, SlateRenderElement as za, getSelectedDomNode as zi, cleanHtmlTextNodes as zn, InsertExitBreakOptions as zr, LengthPlugin as zt };
4294
+ //# sourceMappingURL=index-NTp--CEF.d.ts.map