@lofcz/platejs-core 52.3.4 → 53.0.0
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.
- package/dist/hotkeys-DI1HPO2Q.js +1 -2
- package/dist/{index-NTp--CEF.d.ts → index-C-LKDYK-.d.ts} +606 -1849
- package/dist/index.d.ts +2 -2
- package/dist/index.js +134 -3
- package/dist/react/index.d.ts +211 -196
- package/dist/react/index.js +49 -7
- package/dist/static/index.d.ts +1 -1
- package/dist/static/index.js +2 -2
- package/dist/{static-CVN6JhaR.js → static-HrbPXDQ1.js} +28 -16
- package/dist/{withSlate-1B0SfAWG.js → withSlate-DsAgt7dN.js} +940 -103
- package/package.json +7 -7
- package/dist/hotkeys-DI1HPO2Q.js.map +0 -1
- package/dist/index-NTp--CEF.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/index.js.map +0 -1
- package/dist/static-CVN6JhaR.js.map +0 -1
- package/dist/withSlate-1B0SfAWG.js.map +0 -1
|
@@ -1,19 +1,13 @@
|
|
|
1
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";
|
|
2
|
+
import { Ancestor, DOMRange, DecoratedRange, Descendant, Editor, EditorAboveOptions, EditorApi, EditorBase, EditorTransforms, InsertTextOptions, LeafPosition, NodeEntry, NodeOf, NodeOperation, Operation, Path, PathRef, Point, QueryNodeOptions, ScrollIntoViewOptions, TElement, TNode, TRange, TSelection, TText, TextOperation, Value } from "@platejs/slate";
|
|
3
3
|
import { nanoid as nanoid$1 } from "nanoid";
|
|
4
|
-
import { AnyObject, Deep2Partial, Modify, Nullable, OmitFirst,
|
|
4
|
+
import { AnyObject, Deep2Partial, Modify, Nullable, OmitFirst, UnionToIntersection, UnknownObject } from "@udecode/utils";
|
|
5
5
|
import { createVanillaStore, createVanillaStore as createZustandStore$1 } from "zustand-x/vanilla";
|
|
6
6
|
import { KeyboardEventLike, isHotkey } from "is-hotkey";
|
|
7
|
-
import
|
|
8
|
-
import { EditorPathOptions, EditorPointOptions, NodeEntry as NodeEntry$1, Selection } from "slate";
|
|
7
|
+
import { NodeEntry as NodeEntry$1 } from "slate";
|
|
9
8
|
import React$1, { JSX } from "react";
|
|
10
9
|
import { TStateApi, TStateApi as ZustandStoreApi } from "zustand-x";
|
|
11
10
|
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
11
|
|
|
18
12
|
//#region src/lib/plugins/AstPlugin.d.ts
|
|
19
13
|
/**
|
|
@@ -62,22 +56,26 @@ declare function BaseElementStatic({
|
|
|
62
56
|
decorate,
|
|
63
57
|
decorations,
|
|
64
58
|
editor,
|
|
65
|
-
element
|
|
59
|
+
element,
|
|
60
|
+
path
|
|
66
61
|
}: {
|
|
67
62
|
decorate: EditableProps['decorate'];
|
|
68
63
|
decorations: DecoratedRange[];
|
|
69
64
|
editor: SlateEditor;
|
|
70
65
|
element: TElement;
|
|
66
|
+
path: Path;
|
|
71
67
|
style?: React$1.CSSProperties;
|
|
72
68
|
}): React$1.JSX.Element;
|
|
73
69
|
declare const ElementStatic: React$1.MemoExoticComponent<typeof BaseElementStatic>;
|
|
74
70
|
declare function BaseLeafStatic({
|
|
75
71
|
decorations,
|
|
76
72
|
editor,
|
|
73
|
+
path,
|
|
77
74
|
text
|
|
78
75
|
}: {
|
|
79
76
|
decorations: DecoratedRange[];
|
|
80
77
|
editor: SlateEditor;
|
|
78
|
+
path: Path;
|
|
81
79
|
text: TText;
|
|
82
80
|
}): React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>> | undefined;
|
|
83
81
|
declare const LeafStatic: React$1.MemoExoticComponent<typeof BaseLeafStatic>;
|
|
@@ -132,1791 +130,79 @@ type SlateRenderTextProps<N$1 extends TText = TText, C extends AnyPluginConfig =
|
|
|
132
130
|
//#endregion
|
|
133
131
|
//#region src/static/components/slate-nodes.d.ts
|
|
134
132
|
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;
|
|
133
|
+
type SlateElementProps<N$1 extends TElement = TElement, C extends AnyPluginConfig = PluginConfig> = SlateNodeProps<C> & RenderElementProps<N$1> & {
|
|
134
|
+
attributes: UnknownObject;
|
|
135
|
+
path: Path;
|
|
136
|
+
} & DeprecatedNodeProps;
|
|
137
|
+
type DeprecatedNodeProps = {
|
|
1744
138
|
/**
|
|
1745
|
-
*
|
|
1746
|
-
*
|
|
139
|
+
* @deprecated Optional class to be merged with `attributes.className`.
|
|
140
|
+
* @default undefined
|
|
1747
141
|
*/
|
|
1748
|
-
|
|
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;
|
|
142
|
+
className?: string;
|
|
1760
143
|
/**
|
|
1761
|
-
*
|
|
1762
|
-
*
|
|
144
|
+
* @deprecated Optional style to be merged with `attributes.style`
|
|
145
|
+
* @default undefined
|
|
1763
146
|
*/
|
|
1764
|
-
|
|
1765
|
-
} & SetNodesOptions;
|
|
1766
|
-
type ToggleMarkOptions = {
|
|
1767
|
-
/** Mark keys to remove when adding the mark. */
|
|
1768
|
-
remove?: string[] | string;
|
|
147
|
+
style?: React$1.CSSProperties;
|
|
1769
148
|
};
|
|
1770
|
-
type
|
|
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> = {
|
|
149
|
+
type SlateNodeProps<C extends AnyPluginConfig = PluginConfig> = SlatePluginContext<C> & {
|
|
1779
150
|
/**
|
|
1780
|
-
*
|
|
151
|
+
* Optional ref to be merged with `attributes.ref`
|
|
1781
152
|
*
|
|
1782
|
-
*
|
|
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.
|
|
153
|
+
* @default undefined
|
|
1859
154
|
*/
|
|
1860
|
-
|
|
155
|
+
ref?: any;
|
|
156
|
+
};
|
|
157
|
+
type SlateHTMLProps<C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = 'div'> = SlateNodeProps<C> & {
|
|
158
|
+
/** HTML attributes to pass to the underlying HTML element */
|
|
159
|
+
attributes: React$1.PropsWithoutRef<React$1.JSX.IntrinsicElements[T]> & UnknownObject;
|
|
160
|
+
as?: T;
|
|
161
|
+
/** Class to be merged with `attributes.className` */
|
|
162
|
+
className?: string;
|
|
163
|
+
/** Style to be merged with `attributes.style` */
|
|
164
|
+
style?: React$1.CSSProperties;
|
|
165
|
+
};
|
|
166
|
+
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>;
|
|
167
|
+
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;
|
|
168
|
+
type SlateTextProps<N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig> = SlateNodeProps<C> & RenderTextProps<N$1> & DeprecatedNodeProps & {
|
|
169
|
+
attributes: UnknownObject;
|
|
1861
170
|
};
|
|
1862
|
-
type
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
171
|
+
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>;
|
|
172
|
+
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;
|
|
173
|
+
type SlateLeafProps<N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig> = SlateNodeProps<C> & RenderLeafProps<N$1> & DeprecatedNodeProps & {
|
|
174
|
+
attributes: UnknownObject;
|
|
175
|
+
inset?: boolean;
|
|
1867
176
|
};
|
|
177
|
+
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>;
|
|
178
|
+
declare const SlateLeaf: <N$1 extends TText = TText, C extends AnyPluginConfig = PluginConfig, T extends keyof HTMLElementTagNameMap = "span">({
|
|
179
|
+
className,
|
|
180
|
+
...props
|
|
181
|
+
}: StyledSlateLeafProps<N$1, C, T>) => React$1.ReactElement;
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/static/deserialize/htmlStringToEditorDOM.d.ts
|
|
1868
184
|
/**
|
|
1869
|
-
*
|
|
1870
|
-
*
|
|
185
|
+
* Convert HTML string exported from Plate into HTML element.
|
|
186
|
+
*
|
|
187
|
+
* @param html - The HTML string to convert exported from Plate.
|
|
188
|
+
* @returns The Editor element without head and body.
|
|
1871
189
|
*/
|
|
1872
|
-
|
|
1873
|
-
operations: Operation$1[];
|
|
1874
|
-
selectionBefore: TRange$1 | null;
|
|
1875
|
-
};
|
|
190
|
+
declare const getEditorDOMFromHtmlString: (html: string) => HTMLElement;
|
|
1876
191
|
//#endregion
|
|
1877
|
-
//#region src/
|
|
1878
|
-
type
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
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
|
|
192
|
+
//#region src/static/editor/withStatic.d.ts
|
|
193
|
+
type CreateStaticEditorOptions<V extends Value = Value, P extends AnyPluginConfig = CorePlugin> = CreateSlateEditorOptions<V, P> & {};
|
|
194
|
+
declare const createStaticEditor: <V extends Value = Value, P extends AnyPluginConfig = CorePlugin>({
|
|
195
|
+
editor,
|
|
196
|
+
...options
|
|
197
|
+
}?: CreateStaticEditorOptions<V, P>) => TSlateEditor<V, P>;
|
|
1912
198
|
//#endregion
|
|
1913
199
|
//#region src/static/plugins/ViewPlugin.d.ts
|
|
1914
200
|
declare const ViewPlugin: SlatePlugin<PluginConfig<"dom", {
|
|
1915
201
|
scrollMode?: ScrollMode;
|
|
1916
202
|
scrollOperations?: AutoScrollOperationsMap;
|
|
1917
|
-
scrollOptions?: ScrollIntoViewOptions
|
|
203
|
+
scrollOptions?: _platejs_slate1.ScrollIntoViewOptions;
|
|
1918
204
|
}, {
|
|
1919
|
-
getFragment: () => Descendant
|
|
205
|
+
getFragment: () => _platejs_slate1.Descendant[];
|
|
1920
206
|
isScrolling: () => boolean;
|
|
1921
207
|
}, {
|
|
1922
208
|
withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
|
|
@@ -1926,9 +212,9 @@ declare const ViewPlugin: SlatePlugin<PluginConfig<"dom", {
|
|
|
1926
212
|
declare const getStaticPlugins: () => SlatePlugin<PluginConfig<"dom", {
|
|
1927
213
|
scrollMode?: ScrollMode;
|
|
1928
214
|
scrollOperations?: AutoScrollOperationsMap;
|
|
1929
|
-
scrollOptions?: ScrollIntoViewOptions
|
|
215
|
+
scrollOptions?: _platejs_slate1.ScrollIntoViewOptions;
|
|
1930
216
|
}, {
|
|
1931
|
-
getFragment: () => Descendant
|
|
217
|
+
getFragment: () => _platejs_slate1.Descendant[];
|
|
1932
218
|
isScrolling: () => boolean;
|
|
1933
219
|
}, {
|
|
1934
220
|
withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
|
|
@@ -1962,6 +248,7 @@ declare const getRenderNodeStaticProps: ({
|
|
|
1962
248
|
attributes: nodeAttributes,
|
|
1963
249
|
editor,
|
|
1964
250
|
node,
|
|
251
|
+
path,
|
|
1965
252
|
plugin,
|
|
1966
253
|
props
|
|
1967
254
|
}: {
|
|
@@ -1969,6 +256,8 @@ declare const getRenderNodeStaticProps: ({
|
|
|
1969
256
|
props: SlateRenderNodeProps;
|
|
1970
257
|
attributes?: AnyObject;
|
|
1971
258
|
node?: TElement | TText;
|
|
259
|
+
/** Pre-computed path to avoid expensive findPath traversal */
|
|
260
|
+
path?: Path;
|
|
1972
261
|
plugin?: AnyEditorPlugin;
|
|
1973
262
|
}) => SlateRenderNodeProps;
|
|
1974
263
|
//#endregion
|
|
@@ -2012,6 +301,197 @@ declare const stripHtmlClassNames: (html: string, {
|
|
|
2012
301
|
//#region src/static/utils/stripSlateDataAttributes.d.ts
|
|
2013
302
|
declare const stripSlateDataAttributes: (rawHtml: string) => string;
|
|
2014
303
|
//#endregion
|
|
304
|
+
//#region src/lib/plugins/input-rules/types.d.ts
|
|
305
|
+
type InputRuleTarget = 'insertBreak' | 'insertData' | 'insertText';
|
|
306
|
+
type BivariantCallback$1<TArgs extends unknown[], TResult> = {
|
|
307
|
+
bivarianceHack: (...args: TArgs) => TResult;
|
|
308
|
+
}['bivarianceHack'];
|
|
309
|
+
type SelectionInputRuleContext<TEditor extends SlateEditor = SlateEditor> = {
|
|
310
|
+
editor: TEditor;
|
|
311
|
+
getBlockEntry: () => NodeEntry | undefined;
|
|
312
|
+
getBlockStartRange: () => TRange | undefined;
|
|
313
|
+
getBlockStartText: () => string | undefined;
|
|
314
|
+
getBlockTextBeforeSelection: () => string;
|
|
315
|
+
getCharAfter: () => string | undefined;
|
|
316
|
+
getCharBefore: () => string | undefined;
|
|
317
|
+
isCollapsed: boolean;
|
|
318
|
+
pluginKey: string;
|
|
319
|
+
};
|
|
320
|
+
type InsertBreakInputRuleContext<TEditor extends SlateEditor = SlateEditor> = SelectionInputRuleContext<TEditor> & {
|
|
321
|
+
cause: 'insertBreak';
|
|
322
|
+
insertBreak: () => void;
|
|
323
|
+
};
|
|
324
|
+
type InsertDataInputRuleContext<TEditor extends SlateEditor = SlateEditor> = SelectionInputRuleContext<TEditor> & {
|
|
325
|
+
cause: 'insertData';
|
|
326
|
+
data: DataTransfer;
|
|
327
|
+
insertData: (data: DataTransfer) => void;
|
|
328
|
+
text: string | null;
|
|
329
|
+
};
|
|
330
|
+
type InsertTextInputRuleContext<TEditor extends SlateEditor = SlateEditor> = SelectionInputRuleContext<TEditor> & {
|
|
331
|
+
cause: 'insertText';
|
|
332
|
+
insertText: (text: string, options?: InsertTextOptions) => void;
|
|
333
|
+
options?: InsertTextOptions;
|
|
334
|
+
text: string;
|
|
335
|
+
};
|
|
336
|
+
type BaseInputRule<TContext extends SelectionInputRuleContext = SelectionInputRuleContext> = {
|
|
337
|
+
enabled?: BivariantCallback$1<[context: TContext], boolean>;
|
|
338
|
+
priority?: number;
|
|
339
|
+
};
|
|
340
|
+
type MarkInputRuleConfig = BaseInputRule<InsertTextInputRuleContext> & {
|
|
341
|
+
end?: string;
|
|
342
|
+
mark?: string;
|
|
343
|
+
marks?: string[];
|
|
344
|
+
start: string;
|
|
345
|
+
trim?: 'allow' | 'reject';
|
|
346
|
+
trigger: string;
|
|
347
|
+
};
|
|
348
|
+
type BlockStartInputRuleMatch = {
|
|
349
|
+
range: TRange;
|
|
350
|
+
text: string;
|
|
351
|
+
};
|
|
352
|
+
type MatchBlockStartOptions<TMatch extends object = {}, TContext extends SelectionInputRuleContext = SelectionInputRuleContext> = {
|
|
353
|
+
match: RegExp | string | ((context: TContext) => RegExp | string | undefined);
|
|
354
|
+
resolveMatch?: (args: {
|
|
355
|
+
match: RegExpMatchArray | string;
|
|
356
|
+
range: TRange;
|
|
357
|
+
text: string;
|
|
358
|
+
}) => TMatch | undefined;
|
|
359
|
+
};
|
|
360
|
+
type BlockStartInputRuleConfig<TMatch extends object = {}> = BaseInputRule<InsertTextInputRuleContext> & {
|
|
361
|
+
apply?: (context: InsertTextInputRuleContext, match: BlockStartInputRuleMatch & TMatch) => boolean | void;
|
|
362
|
+
mode?: 'set' | 'toggle' | 'wrap';
|
|
363
|
+
node?: string;
|
|
364
|
+
removeMatchedText?: boolean;
|
|
365
|
+
trigger: string;
|
|
366
|
+
} & MatchBlockStartOptions<TMatch, InsertTextInputRuleContext>;
|
|
367
|
+
type BlockFenceInputRuleMatch = BlockStartInputRuleMatch & {
|
|
368
|
+
path: Path;
|
|
369
|
+
};
|
|
370
|
+
type MatchBlockFenceOptions<TMatch = BlockFenceInputRuleMatch> = {
|
|
371
|
+
block?: string;
|
|
372
|
+
fence: string;
|
|
373
|
+
resolveMatch?: (args: {
|
|
374
|
+
fence: string;
|
|
375
|
+
path: Path;
|
|
376
|
+
range: TRange;
|
|
377
|
+
text: string;
|
|
378
|
+
}) => TMatch | undefined;
|
|
379
|
+
};
|
|
380
|
+
type BlockFenceInputRuleConfig<TMatch = BlockFenceInputRuleMatch> = BaseInputRule<SelectionInputRuleContext> & MatchBlockFenceOptions<TMatch> & {
|
|
381
|
+
apply: (context: SelectionInputRuleContext, match: TMatch) => boolean | void;
|
|
382
|
+
on: 'break' | 'match';
|
|
383
|
+
};
|
|
384
|
+
type DelimitedInlineInputRuleMatch = {
|
|
385
|
+
content: string;
|
|
386
|
+
deleteRange: TRange;
|
|
387
|
+
};
|
|
388
|
+
type MatchDelimitedInlineOptions = {
|
|
389
|
+
boundaryRe?: RegExp;
|
|
390
|
+
close?: string;
|
|
391
|
+
followRe?: RegExp;
|
|
392
|
+
open: string;
|
|
393
|
+
rejectRepeatedOpen?: boolean;
|
|
394
|
+
requireClosingDelimiter?: boolean;
|
|
395
|
+
trim?: 'allow' | 'reject';
|
|
396
|
+
};
|
|
397
|
+
type TextSubstitutionPattern = {
|
|
398
|
+
format: readonly [string, string] | string;
|
|
399
|
+
match: readonly string[] | string;
|
|
400
|
+
trigger?: readonly string[] | string;
|
|
401
|
+
};
|
|
402
|
+
type TextSubstitutionMatch = {
|
|
403
|
+
end: string;
|
|
404
|
+
pattern: TextSubstitutionPattern;
|
|
405
|
+
points: {
|
|
406
|
+
afterStartMatchPoint: Point | undefined;
|
|
407
|
+
beforeEndMatchPoint: Point;
|
|
408
|
+
beforeStartMatchPoint: Point | undefined;
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
type TextSubstitutionInputRuleConfig = BaseInputRule<InsertTextInputRuleContext> & {
|
|
412
|
+
patterns: TextSubstitutionPattern[];
|
|
413
|
+
};
|
|
414
|
+
type InputRuleBuilder = {
|
|
415
|
+
blockFence: <TMatch = BlockFenceInputRuleMatch>(config: BlockFenceInputRuleConfig<TMatch>) => AnyInputRule<TMatch>;
|
|
416
|
+
blockStart: <TMatch extends object = {}>(config: BlockStartInputRuleConfig<TMatch>) => InsertTextInputRule<BlockStartInputRuleMatch & TMatch>;
|
|
417
|
+
insertBreak: <TMatch = true>(rule: InsertBreakInputRule<TMatch>) => InsertBreakInputRule<TMatch>;
|
|
418
|
+
insertData: <TMatch = true>(rule: InsertDataInputRule<TMatch>) => InsertDataInputRule<TMatch>;
|
|
419
|
+
insertText: <TMatch = true>(rule: InsertTextInputRule<TMatch>) => InsertTextInputRule<TMatch>;
|
|
420
|
+
mark: (config: MarkInputRuleConfig) => InsertTextInputRule<{
|
|
421
|
+
afterStartMatchPoint: Point;
|
|
422
|
+
beforeEndMatchPoint: Point;
|
|
423
|
+
beforeStartMatchPoint: Point;
|
|
424
|
+
end: string | undefined;
|
|
425
|
+
}>;
|
|
426
|
+
};
|
|
427
|
+
type InputRulesFactoryContext = {
|
|
428
|
+
rule: InputRuleBuilder;
|
|
429
|
+
};
|
|
430
|
+
type InsertBreakInputRule<TMatch = true, TEditor extends SlateEditor = SlateEditor> = BaseInputRule<InsertBreakInputRuleContext<TEditor>> & {
|
|
431
|
+
apply: BivariantCallback$1<[context: InsertBreakInputRuleContext<TEditor>, match: TMatch], boolean | void>;
|
|
432
|
+
resolve?: BivariantCallback$1<[context: InsertBreakInputRuleContext<TEditor>], TMatch | undefined>;
|
|
433
|
+
target: 'insertBreak';
|
|
434
|
+
};
|
|
435
|
+
type InsertDataInputRule<TMatch = true, TEditor extends SlateEditor = SlateEditor> = BaseInputRule<InsertDataInputRuleContext<TEditor>> & {
|
|
436
|
+
apply: BivariantCallback$1<[context: InsertDataInputRuleContext<TEditor>, match: TMatch], boolean | void>;
|
|
437
|
+
mimeTypes?: string[];
|
|
438
|
+
resolve?: BivariantCallback$1<[context: InsertDataInputRuleContext<TEditor>], TMatch | undefined>;
|
|
439
|
+
target: 'insertData';
|
|
440
|
+
};
|
|
441
|
+
type InsertTextInputRule<TMatch = true, TEditor extends SlateEditor = SlateEditor> = BaseInputRule<InsertTextInputRuleContext<TEditor>> & {
|
|
442
|
+
apply: BivariantCallback$1<[context: InsertTextInputRuleContext<TEditor>, match: TMatch], boolean | void>;
|
|
443
|
+
resolve?: BivariantCallback$1<[context: InsertTextInputRuleContext<TEditor>], TMatch | undefined>;
|
|
444
|
+
target: 'insertText';
|
|
445
|
+
trigger: readonly string[] | string;
|
|
446
|
+
};
|
|
447
|
+
type AnyInputRule<TMatch = unknown, TEditor extends SlateEditor = SlateEditor> = InsertBreakInputRule<TMatch, TEditor> | InsertDataInputRule<TMatch, TEditor> | InsertTextInputRule<TMatch, TEditor>;
|
|
448
|
+
type StoredInsertBreakInputRule = BaseInputRule<InsertBreakInputRuleContext> & {
|
|
449
|
+
apply: BivariantCallback$1<[context: InsertBreakInputRuleContext, match: unknown], boolean | void>;
|
|
450
|
+
resolve?: BivariantCallback$1<[context: InsertBreakInputRuleContext], unknown>;
|
|
451
|
+
target: 'insertBreak';
|
|
452
|
+
};
|
|
453
|
+
type StoredInsertDataInputRule = BaseInputRule<InsertDataInputRuleContext> & {
|
|
454
|
+
apply: BivariantCallback$1<[context: InsertDataInputRuleContext, match: unknown], boolean | void>;
|
|
455
|
+
mimeTypes?: string[];
|
|
456
|
+
resolve?: BivariantCallback$1<[context: InsertDataInputRuleContext], unknown>;
|
|
457
|
+
target: 'insertData';
|
|
458
|
+
};
|
|
459
|
+
type StoredInsertTextInputRule = BaseInputRule<InsertTextInputRuleContext> & {
|
|
460
|
+
apply: BivariantCallback$1<[context: InsertTextInputRuleContext, match: unknown], boolean | void>;
|
|
461
|
+
resolve?: BivariantCallback$1<[context: InsertTextInputRuleContext], unknown>;
|
|
462
|
+
target: 'insertText';
|
|
463
|
+
trigger: readonly string[] | string;
|
|
464
|
+
};
|
|
465
|
+
type StoredInputRule = StoredInsertBreakInputRule | StoredInsertDataInputRule | StoredInsertTextInputRule;
|
|
466
|
+
type InputRulesDefinition = InputRulesConfig | ((ctx: InputRulesFactoryContext) => InputRulesConfig);
|
|
467
|
+
type InputRulesConfig = AnyInputRule<any, SlateEditor>[];
|
|
468
|
+
type ResolvedInputRule = StoredInputRule & {
|
|
469
|
+
id: string;
|
|
470
|
+
pluginKey: string;
|
|
471
|
+
priority: number;
|
|
472
|
+
ruleIndex: number;
|
|
473
|
+
pluginIndex: number;
|
|
474
|
+
};
|
|
475
|
+
type ResolvedInputRulesMeta = {
|
|
476
|
+
insertBreak: Extract<ResolvedInputRule, {
|
|
477
|
+
target: 'insertBreak';
|
|
478
|
+
}>[];
|
|
479
|
+
insertData: Extract<ResolvedInputRule, {
|
|
480
|
+
target: 'insertData';
|
|
481
|
+
}>[];
|
|
482
|
+
insertText: {
|
|
483
|
+
all: Extract<ResolvedInputRule, {
|
|
484
|
+
target: 'insertText';
|
|
485
|
+
}>[];
|
|
486
|
+
byTrigger: Record<string, Extract<ResolvedInputRule, {
|
|
487
|
+
target: 'insertText';
|
|
488
|
+
}>[]>;
|
|
489
|
+
};
|
|
490
|
+
plugins: Record<string, {
|
|
491
|
+
rules: ResolvedInputRule[];
|
|
492
|
+
}>;
|
|
493
|
+
};
|
|
494
|
+
//#endregion
|
|
2015
495
|
//#region src/lib/plugin/SlatePlugin.d.ts
|
|
2016
496
|
type AnyEditorPlugin = EditorPlugin<AnyPluginConfig>;
|
|
2017
497
|
type AnySlatePlugin = SlatePlugin<AnyPluginConfig>;
|
|
@@ -2242,6 +722,7 @@ type SlatePlugin<C extends AnyPluginConfig = PluginConfig> = BasePlugin<C> & Nul
|
|
|
2242
722
|
* method, an API method, or use a custom handler function.
|
|
2243
723
|
*/
|
|
2244
724
|
shortcuts: Partial<Record<(string & {}) | Exclude<keyof InferApi<C>[C['key']], keyof InferTransforms<C>[C['key']]> | keyof InferTransforms<C>[C['key']], SlateShortcut | null>>;
|
|
725
|
+
inputRules: InputRulesDefinition | InputRulesConfig;
|
|
2245
726
|
};
|
|
2246
727
|
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
728
|
api: EA;
|
|
@@ -2396,6 +877,50 @@ declare const HistoryPlugin: SlatePlugin<PluginConfig<"history", {}, {}, {}, {}>
|
|
|
2396
877
|
//#region src/lib/plugins/ParserPlugin.d.ts
|
|
2397
878
|
declare const ParserPlugin: SlatePlugin<PluginConfig<"parser", {}, {}, {}, {}>>;
|
|
2398
879
|
//#endregion
|
|
880
|
+
//#region src/lib/plugins/dom/withScrolling.d.ts
|
|
881
|
+
type WithAutoScrollOptions = {
|
|
882
|
+
mode?: ScrollMode;
|
|
883
|
+
operations?: AutoScrollOperationsMap;
|
|
884
|
+
scrollOptions?: ScrollIntoViewOptions;
|
|
885
|
+
};
|
|
886
|
+
declare const withScrolling: (editor: SlateEditor, fn: () => void, options?: WithAutoScrollOptions) => void;
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region src/lib/plugins/dom/DOMPlugin.d.ts
|
|
889
|
+
declare const AUTO_SCROLL: WeakMap<SlateEditor, boolean>;
|
|
890
|
+
type AutoScrollOperationsMap = Partial<Record<Operation['type'], boolean>>;
|
|
891
|
+
type DomConfig = PluginConfig<'dom', {
|
|
892
|
+
/** Choose the first or last matching operation as the scroll target */
|
|
893
|
+
scrollMode?: ScrollMode;
|
|
894
|
+
/**
|
|
895
|
+
* Operations map; false to disable an operation, true or undefined to
|
|
896
|
+
* enable
|
|
897
|
+
*/
|
|
898
|
+
scrollOperations?: AutoScrollOperationsMap;
|
|
899
|
+
/** Options passed to scrollIntoView */
|
|
900
|
+
scrollOptions?: ScrollIntoViewOptions;
|
|
901
|
+
}>;
|
|
902
|
+
/** Mode for picking target op when multiple enabled */
|
|
903
|
+
type ScrollMode = 'first' | 'last';
|
|
904
|
+
/**
|
|
905
|
+
* Placeholder plugin for DOM interaction, that could be replaced with
|
|
906
|
+
* ReactPlugin.
|
|
907
|
+
*/
|
|
908
|
+
declare const DOMPlugin: SlatePlugin<PluginConfig<"dom", {
|
|
909
|
+
/** Choose the first or last matching operation as the scroll target */
|
|
910
|
+
scrollMode?: ScrollMode;
|
|
911
|
+
/**
|
|
912
|
+
* Operations map; false to disable an operation, true or undefined to
|
|
913
|
+
* enable
|
|
914
|
+
*/
|
|
915
|
+
scrollOperations?: AutoScrollOperationsMap;
|
|
916
|
+
/** Options passed to scrollIntoView */
|
|
917
|
+
scrollOptions?: ScrollIntoViewOptions;
|
|
918
|
+
}, {
|
|
919
|
+
isScrolling: () => boolean;
|
|
920
|
+
}, {
|
|
921
|
+
withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
|
|
922
|
+
}, {}>>;
|
|
923
|
+
//#endregion
|
|
2399
924
|
//#region src/lib/plugins/slate-extension/transforms/init.d.ts
|
|
2400
925
|
type InitOptions = {
|
|
2401
926
|
autoSelect?: boolean | 'end' | 'start';
|
|
@@ -2440,10 +965,27 @@ declare const insertExitBreak: (editor: SlateEditor, {
|
|
|
2440
965
|
reverse
|
|
2441
966
|
}?: InsertExitBreakOptions) => true | undefined;
|
|
2442
967
|
//#endregion
|
|
968
|
+
//#region src/lib/plugins/slate-extension/transforms/liftBlock.d.ts
|
|
969
|
+
type LiftBlockOptions = {
|
|
970
|
+
at?: EditorAboveOptions['at'];
|
|
971
|
+
match?: EditorAboveOptions['match'];
|
|
972
|
+
};
|
|
973
|
+
/**
|
|
974
|
+
* Lift the current block out of the nearest matching ancestor container.
|
|
975
|
+
*
|
|
976
|
+
* This unwraps only the current block and splits the ancestor around it when
|
|
977
|
+
* needed, so one keypress changes one structural level instead of exploding the
|
|
978
|
+
* whole container.
|
|
979
|
+
*/
|
|
980
|
+
declare const liftBlock: (editor: SlateEditor, {
|
|
981
|
+
at,
|
|
982
|
+
match
|
|
983
|
+
}?: LiftBlockOptions) => true | undefined;
|
|
984
|
+
//#endregion
|
|
2443
985
|
//#region src/lib/plugins/slate-extension/transforms/resetBlock.d.ts
|
|
2444
986
|
/**
|
|
2445
|
-
* Reset the current block to a paragraph, removing all properties except
|
|
2446
|
-
* type.
|
|
987
|
+
* Reset the current block to a paragraph, removing all properties except the
|
|
988
|
+
* configured node id key and type.
|
|
2447
989
|
*/
|
|
2448
990
|
declare const resetBlock: (editor: SlateEditor, {
|
|
2449
991
|
at
|
|
@@ -2469,9 +1011,12 @@ type SlateExtensionConfig = PluginConfig<'slateExtension', {
|
|
|
2469
1011
|
prevText: string;
|
|
2470
1012
|
text: string;
|
|
2471
1013
|
}) => void;
|
|
2472
|
-
}, {
|
|
1014
|
+
}, {
|
|
1015
|
+
redecorate: () => void;
|
|
1016
|
+
}, {
|
|
2473
1017
|
init: OmitFirst<typeof init>;
|
|
2474
1018
|
insertExitBreak: OmitFirst<typeof insertExitBreak>;
|
|
1019
|
+
liftBlock: OmitFirst<typeof liftBlock>;
|
|
2475
1020
|
resetBlock: OmitFirst<typeof resetBlock>;
|
|
2476
1021
|
setValue: OmitFirst<typeof setValue>;
|
|
2477
1022
|
}>;
|
|
@@ -2490,9 +1035,12 @@ declare const SlateExtensionPlugin: SlatePlugin<PluginConfig<"slateExtension", {
|
|
|
2490
1035
|
prevText: string;
|
|
2491
1036
|
text: string;
|
|
2492
1037
|
}) => void;
|
|
2493
|
-
}, {
|
|
1038
|
+
}, {
|
|
1039
|
+
redecorate: () => void;
|
|
1040
|
+
}, {
|
|
2494
1041
|
init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
|
|
2495
1042
|
insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
|
|
1043
|
+
liftBlock: ((args_0?: LiftBlockOptions | undefined) => true | undefined) & ((args_0?: LiftBlockOptions | undefined) => true | undefined);
|
|
2496
1044
|
resetBlock: ((args_0?: {
|
|
2497
1045
|
at?: _platejs_slate1.Path;
|
|
2498
1046
|
} | undefined) => true | undefined) & ((args_0?: {
|
|
@@ -2502,50 +1050,94 @@ declare const SlateExtensionPlugin: SlatePlugin<PluginConfig<"slateExtension", {
|
|
|
2502
1050
|
apply: <N$1 extends _platejs_slate1.TElement | TText>(operation: _platejs_slate1.Operation<N$1>) => void;
|
|
2503
1051
|
}, {}>>;
|
|
2504
1052
|
//#endregion
|
|
2505
|
-
//#region src/lib/plugins/
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
scrollOptions?: ScrollIntoViewOptions;
|
|
1053
|
+
//#region src/lib/plugins/navigation-feedback/types.d.ts
|
|
1054
|
+
declare const NAVIGATION_FEEDBACK_KEY = "navigationFeedback";
|
|
1055
|
+
declare const NavigationFeedbackPluginKey: {
|
|
1056
|
+
readonly key: "navigationFeedback";
|
|
2510
1057
|
};
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
type
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
1058
|
+
type NavigationFeedbackTarget = {
|
|
1059
|
+
path: Path;
|
|
1060
|
+
type: 'node';
|
|
1061
|
+
};
|
|
1062
|
+
type NavigationFeedbackActiveTarget = NavigationFeedbackTarget & {
|
|
1063
|
+
cycle: 0 | 1;
|
|
1064
|
+
duration: number;
|
|
1065
|
+
pulse: number;
|
|
1066
|
+
variant: string;
|
|
1067
|
+
};
|
|
1068
|
+
type NavigationFeedbackStoredTarget = Omit<NavigationFeedbackActiveTarget, 'path'> & {
|
|
1069
|
+
pathRef: PathRef;
|
|
1070
|
+
};
|
|
1071
|
+
type NavigationFlashTargetOptions = {
|
|
1072
|
+
duration?: number;
|
|
1073
|
+
target: NavigationFeedbackTarget;
|
|
1074
|
+
variant?: string;
|
|
1075
|
+
};
|
|
1076
|
+
type NavigationNavigateOptions = {
|
|
1077
|
+
flash?: false | {
|
|
1078
|
+
duration?: number;
|
|
1079
|
+
variant?: string;
|
|
1080
|
+
};
|
|
1081
|
+
focus?: boolean;
|
|
1082
|
+
scroll?: boolean;
|
|
1083
|
+
scrollTarget?: Point;
|
|
1084
|
+
select?: Point | TRange;
|
|
1085
|
+
target: NavigationFeedbackTarget;
|
|
1086
|
+
};
|
|
1087
|
+
type NavigationFeedbackConfig = PluginConfig<typeof NAVIGATION_FEEDBACK_KEY, {
|
|
1088
|
+
activeTarget: NavigationFeedbackStoredTarget | null;
|
|
1089
|
+
duration: number;
|
|
1090
|
+
}, {
|
|
1091
|
+
navigation: {
|
|
1092
|
+
activeTarget: () => NavigationFeedbackActiveTarget | null;
|
|
1093
|
+
clear: () => void;
|
|
1094
|
+
isTarget: (path: Path) => boolean;
|
|
1095
|
+
};
|
|
1096
|
+
}, {
|
|
1097
|
+
navigation: {
|
|
1098
|
+
clear: () => void;
|
|
1099
|
+
flashTarget: (options: NavigationFlashTargetOptions) => boolean;
|
|
1100
|
+
navigate: (options: NavigationNavigateOptions) => boolean;
|
|
1101
|
+
};
|
|
2526
1102
|
}>;
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
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;
|
|
1103
|
+
//#endregion
|
|
1104
|
+
//#region src/lib/plugins/navigation-feedback/NavigationFeedbackPlugin.d.ts
|
|
1105
|
+
declare const NavigationFeedbackPlugin: SlatePlugin<PluginConfig<"navigationFeedback", {
|
|
1106
|
+
activeTarget: NavigationFeedbackStoredTarget | null;
|
|
1107
|
+
duration: number;
|
|
2543
1108
|
}, {
|
|
2544
|
-
|
|
1109
|
+
navigation: {
|
|
1110
|
+
activeTarget: () => NavigationFeedbackActiveTarget | null;
|
|
1111
|
+
clear: () => void;
|
|
1112
|
+
isTarget: (path: _platejs_slate1.Path) => boolean;
|
|
1113
|
+
};
|
|
2545
1114
|
}, {
|
|
2546
|
-
|
|
1115
|
+
navigation: {
|
|
1116
|
+
clear: () => void;
|
|
1117
|
+
flashTarget: (options: NavigationFlashTargetOptions) => boolean;
|
|
1118
|
+
navigate: (options: NavigationNavigateOptions) => boolean;
|
|
1119
|
+
};
|
|
2547
1120
|
}, {}>>;
|
|
2548
1121
|
//#endregion
|
|
1122
|
+
//#region src/lib/plugins/navigation-feedback/transforms/flashTarget.d.ts
|
|
1123
|
+
declare const resolveNavigationFeedbackTarget: (target?: NavigationFeedbackStoredTarget | null) => NavigationFeedbackActiveTarget | null;
|
|
1124
|
+
declare const clearNavigationFeedbackTarget: (editor: SlateEditor, pulse?: number) => boolean;
|
|
1125
|
+
declare const flashTarget: (editor: SlateEditor, {
|
|
1126
|
+
duration,
|
|
1127
|
+
target,
|
|
1128
|
+
variant
|
|
1129
|
+
}: NavigationFlashTargetOptions) => boolean;
|
|
1130
|
+
//#endregion
|
|
1131
|
+
//#region src/lib/plugins/navigation-feedback/transforms/navigate.d.ts
|
|
1132
|
+
declare const navigate: (editor: SlateEditor, {
|
|
1133
|
+
flash,
|
|
1134
|
+
focus,
|
|
1135
|
+
scroll,
|
|
1136
|
+
scrollTarget,
|
|
1137
|
+
select,
|
|
1138
|
+
target
|
|
1139
|
+
}: NavigationNavigateOptions) => boolean;
|
|
1140
|
+
//#endregion
|
|
2549
1141
|
//#region src/lib/plugins/affinity/AffinityPlugin.d.ts
|
|
2550
1142
|
type ElementAffinity = {
|
|
2551
1143
|
affinity: 'backward' | 'forward';
|
|
@@ -2747,6 +1339,8 @@ type GetCorePluginsOptions = {
|
|
|
2747
1339
|
chunking?: ChunkingConfig['options'] | boolean;
|
|
2748
1340
|
/** Specifies the maximum number of characters allowed in the editor. */
|
|
2749
1341
|
maxLength?: number;
|
|
1342
|
+
/** Configure the navigation feedback plugin. */
|
|
1343
|
+
navigationFeedback?: NavigationFeedbackConfig['options'] | boolean;
|
|
2750
1344
|
/** Configure the node id plugin. */
|
|
2751
1345
|
nodeId?: NodeIdConfig['options'] | boolean;
|
|
2752
1346
|
/** Override the core plugins using the same key. */
|
|
@@ -2756,46 +1350,65 @@ declare const getCorePlugins: ({
|
|
|
2756
1350
|
affinity,
|
|
2757
1351
|
chunking,
|
|
2758
1352
|
maxLength,
|
|
1353
|
+
navigationFeedback,
|
|
2759
1354
|
nodeId,
|
|
2760
1355
|
plugins
|
|
2761
|
-
}: GetCorePluginsOptions) => (SlatePlugin<
|
|
1356
|
+
}: GetCorePluginsOptions) => (SlatePlugin<PluginConfig<"dom", {
|
|
1357
|
+
scrollMode?: ScrollMode;
|
|
1358
|
+
scrollOperations?: AutoScrollOperationsMap;
|
|
1359
|
+
scrollOptions?: _platejs_slate1.ScrollIntoViewOptions;
|
|
1360
|
+
}, {
|
|
1361
|
+
isScrolling: () => boolean;
|
|
1362
|
+
}, {
|
|
1363
|
+
withScrolling: (fn: () => void, options?: WithAutoScrollOptions | undefined) => void;
|
|
1364
|
+
}, {}>> | SlatePlugin<DebugConfig> | SlatePlugin<PluginConfig<"slateExtension", {
|
|
2762
1365
|
onNodeChange: (options: {
|
|
2763
1366
|
editor: SlateEditor;
|
|
2764
|
-
node: Descendant
|
|
2765
|
-
operation: NodeOperation
|
|
2766
|
-
prevNode: Descendant
|
|
1367
|
+
node: _platejs_slate1.Descendant;
|
|
1368
|
+
operation: _platejs_slate1.NodeOperation;
|
|
1369
|
+
prevNode: _platejs_slate1.Descendant;
|
|
2767
1370
|
}) => void;
|
|
2768
1371
|
onTextChange: (options: {
|
|
2769
1372
|
editor: SlateEditor;
|
|
2770
|
-
node: Descendant
|
|
2771
|
-
operation: TextOperation
|
|
1373
|
+
node: _platejs_slate1.Descendant;
|
|
1374
|
+
operation: _platejs_slate1.TextOperation;
|
|
2772
1375
|
prevText: string;
|
|
2773
1376
|
text: string;
|
|
2774
1377
|
}) => void;
|
|
2775
|
-
}, {
|
|
1378
|
+
}, {
|
|
1379
|
+
redecorate: () => void;
|
|
1380
|
+
}, {
|
|
2776
1381
|
init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
|
|
2777
1382
|
insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
|
|
1383
|
+
liftBlock: ((args_0?: LiftBlockOptions | undefined) => true | undefined) & ((args_0?: LiftBlockOptions | undefined) => true | undefined);
|
|
2778
1384
|
resetBlock: ((args_0?: {
|
|
2779
|
-
at?: Path
|
|
1385
|
+
at?: _platejs_slate1.Path;
|
|
2780
1386
|
} | undefined) => true | undefined) & ((args_0?: {
|
|
2781
|
-
at?: Path
|
|
1387
|
+
at?: _platejs_slate1.Path;
|
|
2782
1388
|
} | undefined) => true | undefined);
|
|
2783
|
-
setValue: ((value?: string | Value
|
|
2784
|
-
apply: <N$1 extends TElement
|
|
2785
|
-
}, {}>> | SlatePlugin<PluginConfig<"
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
scrollOptions?: ScrollIntoViewOptions$1;
|
|
1389
|
+
setValue: ((value?: string | _platejs_slate1.Value | undefined) => void) & ((value?: string | _platejs_slate1.Value | undefined) => void);
|
|
1390
|
+
apply: <N$1 extends _platejs_slate1.TElement | _platejs_slate1.TText>(operation: _platejs_slate1.Operation<N$1>) => void;
|
|
1391
|
+
}, {}>> | SlatePlugin<PluginConfig<"navigationFeedback", {
|
|
1392
|
+
activeTarget: NavigationFeedbackStoredTarget | null;
|
|
1393
|
+
duration: number;
|
|
2789
1394
|
}, {
|
|
2790
|
-
|
|
1395
|
+
navigation: {
|
|
1396
|
+
activeTarget: () => NavigationFeedbackActiveTarget | null;
|
|
1397
|
+
clear: () => void;
|
|
1398
|
+
isTarget: (path: _platejs_slate1.Path) => boolean;
|
|
1399
|
+
};
|
|
2791
1400
|
}, {
|
|
2792
|
-
|
|
2793
|
-
|
|
1401
|
+
navigation: {
|
|
1402
|
+
clear: () => void;
|
|
1403
|
+
flashTarget: (options: NavigationFlashTargetOptions) => boolean;
|
|
1404
|
+
navigate: (options: NavigationNavigateOptions) => boolean;
|
|
1405
|
+
};
|
|
1406
|
+
}, {}>> | SlatePlugin<PluginConfig<"history", {}, {}, {}, {}>> | SlatePlugin<PluginConfig> | SlatePlugin<PluginConfig<"override", {}, {}, {}, {}>> | SlatePlugin<PluginConfig<"parser", {}, {}, {}, {}>> | SlatePlugin<LengthConfig> | SlatePlugin<PluginConfig<"html", {}, Record<"html", {
|
|
2794
1407
|
deserialize: (args_0: {
|
|
2795
1408
|
element: HTMLElement | string;
|
|
2796
1409
|
collapseWhiteSpace?: boolean;
|
|
2797
1410
|
defaultElementPlugin?: WithRequiredKey;
|
|
2798
|
-
}) => Descendant
|
|
1411
|
+
}) => _platejs_slate1.Descendant[];
|
|
2799
1412
|
}>, {}, {}>> | SlatePlugin<PluginConfig<"ast", {}, {}, {}, {}>> | SlatePlugin<PluginConfig<"nodeId", {
|
|
2800
1413
|
disableInsertOverrides?: boolean;
|
|
2801
1414
|
filterInline?: boolean;
|
|
@@ -2804,15 +1417,15 @@ declare const getCorePlugins: ({
|
|
|
2804
1417
|
normalizeInitialValue?: boolean;
|
|
2805
1418
|
reuseId?: boolean;
|
|
2806
1419
|
idCreator?: () => any;
|
|
2807
|
-
} & QueryNodeOptions
|
|
1420
|
+
} & _platejs_slate1.QueryNodeOptions, {}, {
|
|
2808
1421
|
nodeId: {
|
|
2809
1422
|
normalize: () => void;
|
|
2810
1423
|
};
|
|
2811
1424
|
} & Record<"nodeId", {
|
|
2812
1425
|
normalize(): void;
|
|
2813
1426
|
}>, {}>> | SlatePlugin<AffinityConfig> | SlatePlugin<PluginConfig<"p", {}, {}, {}, {}>> | SlatePlugin<ChunkingConfig>)[];
|
|
2814
|
-
type CorePluginTransforms = SlateExtensionConfig['transforms'];
|
|
2815
|
-
type CorePluginApi = SlateExtensionConfig['api'];
|
|
1427
|
+
type CorePluginTransforms = SlateExtensionConfig['transforms'] & NavigationFeedbackConfig['transforms'];
|
|
1428
|
+
type CorePluginApi = SlateExtensionConfig['api'] & NavigationFeedbackConfig['api'];
|
|
2816
1429
|
type DebugConfig = PluginConfig<'debug', {
|
|
2817
1430
|
isProduction: boolean;
|
|
2818
1431
|
logger: Partial<Record<LogLevel, LogFunction>>;
|
|
@@ -2844,7 +1457,7 @@ declare const HtmlPlugin: SlatePlugin<PluginConfig<"html", {}, Record<"html", {
|
|
|
2844
1457
|
element: HTMLElement | string;
|
|
2845
1458
|
collapseWhiteSpace?: boolean;
|
|
2846
1459
|
defaultElementPlugin?: WithRequiredKey;
|
|
2847
|
-
}) => Descendant
|
|
1460
|
+
}) => _platejs_slate1.Descendant[];
|
|
2848
1461
|
}>, {}, {}>>;
|
|
2849
1462
|
//#endregion
|
|
2850
1463
|
//#region src/lib/plugins/html/constants.d.ts
|
|
@@ -3178,9 +1791,134 @@ declare const isLastNonEmptyTextOfInlineFormattingContext: (initialText: Text) =
|
|
|
3178
1791
|
declare const upsertInlineFormattingContext: (state: CollapseWhiteSpaceState) => void;
|
|
3179
1792
|
declare const endInlineFormattingContext: (state: CollapseWhiteSpaceState) => void;
|
|
3180
1793
|
//#endregion
|
|
1794
|
+
//#region src/lib/plugins/input-rules/createInputRules.d.ts
|
|
1795
|
+
declare const createMarkInputRule: (config: MarkInputRuleConfig) => ReturnType<InputRuleBuilder["mark"]>;
|
|
1796
|
+
declare const matchBlockStart: <TMatch extends object = {}, TContext extends SelectionInputRuleContext = SelectionInputRuleContext>(context: TContext, config: MatchBlockStartOptions<TMatch, TContext>) => (BlockStartInputRuleMatch & TMatch) | undefined;
|
|
1797
|
+
declare const createBlockStartInputRule: <TMatch extends object = {}>(config: BlockStartInputRuleConfig<TMatch>) => InsertTextInputRule<BlockStartInputRuleMatch & TMatch, SlateEditor>;
|
|
1798
|
+
declare const matchBlockFence: <TMatch = BlockFenceInputRuleMatch, TContext extends SelectionInputRuleContext = SelectionInputRuleContext>(context: TContext, config: MatchBlockFenceOptions<TMatch>) => TMatch | undefined;
|
|
1799
|
+
declare function createBlockFenceInputRule<TMatch = BlockFenceInputRuleMatch>(config: BlockFenceInputRuleConfig<TMatch>): InsertBreakInputRule<TMatch, SlateEditor> | InsertTextInputRule<TMatch, SlateEditor>;
|
|
1800
|
+
declare const matchDelimitedInline: (context: SelectionInputRuleContext, {
|
|
1801
|
+
boundaryRe,
|
|
1802
|
+
close,
|
|
1803
|
+
followRe,
|
|
1804
|
+
open,
|
|
1805
|
+
requireClosingDelimiter,
|
|
1806
|
+
rejectRepeatedOpen,
|
|
1807
|
+
trim
|
|
1808
|
+
}: MatchDelimitedInlineOptions) => DelimitedInlineInputRuleMatch | undefined;
|
|
1809
|
+
declare const createTextSubstitutionInputRule: ({
|
|
1810
|
+
enabled,
|
|
1811
|
+
patterns,
|
|
1812
|
+
priority
|
|
1813
|
+
}: TextSubstitutionInputRuleConfig) => InsertTextInputRule<TextSubstitutionMatch, SlateEditor>;
|
|
1814
|
+
//#endregion
|
|
1815
|
+
//#region src/lib/plugins/input-rules/createRuleFactory.d.ts
|
|
1816
|
+
type FactoryValue<TInput, TValue> = TValue | ((input: TInput) => TValue);
|
|
1817
|
+
type Simplify<T> = { [K in keyof T]: T[K] } & {};
|
|
1818
|
+
type BivariantCallback<T extends (...args: never[]) => unknown> = {
|
|
1819
|
+
bivarianceHack: T;
|
|
1820
|
+
}['bivarianceHack'];
|
|
1821
|
+
type RuntimeOptions<TContext> = {
|
|
1822
|
+
enabled?: (context: TContext) => boolean;
|
|
1823
|
+
priority?: number;
|
|
1824
|
+
};
|
|
1825
|
+
type FactoryInput<TContext, TDefaults extends object, TRequired extends object> = TContext & TDefaults & TRequired;
|
|
1826
|
+
type PublicOptions<TContext, TDefaults extends object, TRequired extends object> = Simplify<Partial<TDefaults> & TRequired & RuntimeOptions<TContext>>;
|
|
1827
|
+
type CreateRuleFactoryReturn<TContext, TDefaults extends object, TRequired extends object> = keyof TRequired extends never ? (options?: PublicOptions<TContext, TDefaults, TRequired>) => AnyInputRule<unknown> : (options: PublicOptions<TContext, TDefaults, TRequired>) => AnyInputRule<unknown>;
|
|
1828
|
+
type RuleFactoryConfigBuilder<TContext, TDefaults extends object, TRequired extends object, TConfig> = (options: PublicOptions<TContext, TDefaults, TRequired>) => TConfig;
|
|
1829
|
+
type MarkRuleFactoryConfig<TDefaults extends object, TRequired extends object> = {
|
|
1830
|
+
type: 'mark';
|
|
1831
|
+
end?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string | undefined>;
|
|
1832
|
+
mark?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string | undefined>;
|
|
1833
|
+
marks?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string[] | undefined>;
|
|
1834
|
+
start: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string>;
|
|
1835
|
+
trim?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, MarkInputRuleConfig['trim']>;
|
|
1836
|
+
trigger: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string>;
|
|
1837
|
+
enabled?: (input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1838
|
+
priority?: number;
|
|
1839
|
+
};
|
|
1840
|
+
type BlockStartRuleFactoryConfig<TDefaults extends object, TRequired extends object, TMatch extends object = {}> = {
|
|
1841
|
+
type: 'blockStart';
|
|
1842
|
+
apply?: BivariantCallback<(input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, match: BlockStartInputRuleMatch & TMatch) => boolean | void>;
|
|
1843
|
+
match: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, RegExp | string | undefined>;
|
|
1844
|
+
mode?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, BlockStartInputRuleConfig<TMatch>['mode']>;
|
|
1845
|
+
node?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string | undefined>;
|
|
1846
|
+
removeMatchedText?: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, boolean | undefined>;
|
|
1847
|
+
resolveMatch?: (args: {
|
|
1848
|
+
match: RegExpMatchArray | string;
|
|
1849
|
+
range: BlockStartInputRuleMatch['range'];
|
|
1850
|
+
text: string;
|
|
1851
|
+
}, input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>) => TMatch | undefined;
|
|
1852
|
+
trigger: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, string>;
|
|
1853
|
+
enabled?: (input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1854
|
+
priority?: number;
|
|
1855
|
+
};
|
|
1856
|
+
type BlockFenceRuleFactoryConfig<TDefaults extends object, TRequired extends object, TMatch> = {
|
|
1857
|
+
type: 'blockFence';
|
|
1858
|
+
apply: BivariantCallback<(input: FactoryInput<SelectionInputRuleContext, TDefaults, TRequired>, match: TMatch) => boolean | void>;
|
|
1859
|
+
block?: FactoryValue<FactoryInput<SelectionInputRuleContext, TDefaults, TRequired>, string | undefined>;
|
|
1860
|
+
fence: FactoryValue<FactoryInput<SelectionInputRuleContext, TDefaults, TRequired>, string>;
|
|
1861
|
+
on?: FactoryValue<FactoryInput<SelectionInputRuleContext, TDefaults, TRequired>, BlockFenceInputRuleConfig<TMatch>['on']>;
|
|
1862
|
+
resolveMatch?: (args: {
|
|
1863
|
+
fence: string;
|
|
1864
|
+
path: BlockFenceInputRuleMatch['path'];
|
|
1865
|
+
range: BlockFenceInputRuleMatch['range'];
|
|
1866
|
+
text: string;
|
|
1867
|
+
}, input: FactoryInput<SelectionInputRuleContext, TDefaults, TRequired>) => TMatch | undefined;
|
|
1868
|
+
enabled?: (input: FactoryInput<SelectionInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1869
|
+
priority?: number;
|
|
1870
|
+
};
|
|
1871
|
+
type InsertTextRuleFactoryConfig<TDefaults extends object, TRequired extends object, TMatch> = {
|
|
1872
|
+
type: 'insertText';
|
|
1873
|
+
apply: BivariantCallback<(input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, match: TMatch) => boolean | void>;
|
|
1874
|
+
resolve?: (input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>) => TMatch | undefined;
|
|
1875
|
+
trigger: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, InsertTextInputRule<TMatch>['trigger']>;
|
|
1876
|
+
enabled?: (input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1877
|
+
priority?: number;
|
|
1878
|
+
};
|
|
1879
|
+
type InsertBreakRuleFactoryConfig<TDefaults extends object, TRequired extends object, TMatch> = {
|
|
1880
|
+
type: 'insertBreak';
|
|
1881
|
+
apply: BivariantCallback<(input: FactoryInput<InsertBreakInputRuleContext, TDefaults, TRequired>, match: TMatch) => boolean | void>;
|
|
1882
|
+
resolve?: (input: FactoryInput<InsertBreakInputRuleContext, TDefaults, TRequired>) => TMatch | undefined;
|
|
1883
|
+
enabled?: (input: FactoryInput<InsertBreakInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1884
|
+
priority?: number;
|
|
1885
|
+
};
|
|
1886
|
+
type InsertDataRuleFactoryConfig<TDefaults extends object, TRequired extends object, TMatch> = {
|
|
1887
|
+
type: 'insertData';
|
|
1888
|
+
apply: BivariantCallback<(input: FactoryInput<InsertDataInputRuleContext, TDefaults, TRequired>, match: TMatch) => boolean | void>;
|
|
1889
|
+
mimeTypes?: FactoryValue<FactoryInput<InsertDataInputRuleContext, TDefaults, TRequired>, string[] | undefined>;
|
|
1890
|
+
resolve?: (input: FactoryInput<InsertDataInputRuleContext, TDefaults, TRequired>) => TMatch | undefined;
|
|
1891
|
+
enabled?: (input: FactoryInput<InsertDataInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1892
|
+
priority?: number;
|
|
1893
|
+
};
|
|
1894
|
+
type TextSubstitutionRuleFactoryConfig<TDefaults extends object, TRequired extends object> = {
|
|
1895
|
+
type: 'textSubstitution';
|
|
1896
|
+
patterns: FactoryValue<FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>, TextSubstitutionInputRuleConfig['patterns']>;
|
|
1897
|
+
enabled?: (input: FactoryInput<InsertTextInputRuleContext, TDefaults, TRequired>) => boolean;
|
|
1898
|
+
priority?: number;
|
|
1899
|
+
};
|
|
1900
|
+
type AnyRuleFactoryConfig<TDefaults extends object = Record<string, unknown>, TRequired extends object = Record<string, unknown>, TMatch = unknown> = MarkRuleFactoryConfig<TDefaults, TRequired> | BlockStartRuleFactoryConfig<TDefaults, TRequired, TMatch extends object ? TMatch : {}> | BlockFenceRuleFactoryConfig<TDefaults, TRequired, TMatch> | InsertTextRuleFactoryConfig<TDefaults, TRequired, TMatch> | InsertBreakRuleFactoryConfig<TDefaults, TRequired, TMatch> | InsertDataRuleFactoryConfig<TDefaults, TRequired, TMatch> | TextSubstitutionRuleFactoryConfig<TDefaults, TRequired>;
|
|
1901
|
+
type AnyRuleFactoryConfigLoose<TDefaults extends object = Record<string, unknown>, TRequired extends object = Record<string, unknown>> = MarkRuleFactoryConfig<TDefaults, TRequired> | BlockStartRuleFactoryConfig<TDefaults, TRequired, {}> | BlockFenceRuleFactoryConfig<TDefaults, TRequired, unknown> | InsertTextRuleFactoryConfig<TDefaults, TRequired, unknown> | InsertBreakRuleFactoryConfig<TDefaults, TRequired, unknown> | InsertDataRuleFactoryConfig<TDefaults, TRequired, unknown> | TextSubstitutionRuleFactoryConfig<TDefaults, TRequired>;
|
|
1902
|
+
type ContextFromFactoryConfig<TConfig> = TConfig extends MarkRuleFactoryConfig<any, any> | BlockStartRuleFactoryConfig<any, any, any> | InsertTextRuleFactoryConfig<any, any, any> | TextSubstitutionRuleFactoryConfig<any, any> ? InsertTextInputRuleContext : TConfig extends BlockFenceRuleFactoryConfig<any, any, any> ? SelectionInputRuleContext : TConfig extends InsertBreakRuleFactoryConfig<any, any, any> ? InsertBreakInputRuleContext : InsertDataInputRuleContext;
|
|
1903
|
+
declare function createRuleFactory<TRequired extends object = {}, TDefaults extends object = {}, TMatch = unknown, TConfig extends AnyRuleFactoryConfig<TDefaults, TRequired, TMatch> = AnyRuleFactoryConfig<TDefaults, TRequired, TMatch>>(config: TConfig & TDefaults): CreateRuleFactoryReturn<ContextFromFactoryConfig<TConfig>, TDefaults, TRequired>;
|
|
1904
|
+
declare function createRuleFactory<TRequired extends object = {}, TDefaults extends object = {}>(configBuilder: RuleFactoryConfigBuilder<SelectionInputRuleContext | InsertTextInputRuleContext | InsertBreakInputRuleContext | InsertDataInputRuleContext, TDefaults, TRequired, AnyRuleFactoryConfigLoose<TDefaults, TRequired>>): CreateRuleFactoryReturn<SelectionInputRuleContext | InsertTextInputRuleContext | InsertBreakInputRuleContext | InsertDataInputRuleContext, TDefaults, TRequired>;
|
|
1905
|
+
//#endregion
|
|
1906
|
+
//#region src/lib/plugins/input-rules/defineInputRule.d.ts
|
|
1907
|
+
declare function defineInputRule<TMatch = true, TEditor extends SlateEditor = SlateEditor>(rule: InsertBreakInputRule<TMatch, TEditor>): InsertBreakInputRule<TMatch, TEditor>;
|
|
1908
|
+
declare function defineInputRule<TMatch = true, TEditor extends SlateEditor = SlateEditor>(rule: InsertDataInputRule<TMatch, TEditor>): InsertDataInputRule<TMatch, TEditor>;
|
|
1909
|
+
declare function defineInputRule<TMatch = true, TEditor extends SlateEditor = SlateEditor>(rule: InsertTextInputRule<TMatch, TEditor>): InsertTextInputRule<TMatch, TEditor>;
|
|
1910
|
+
declare function defineInputRule<TRule extends AnyInputRule>(rule: TRule): TRule;
|
|
1911
|
+
//#endregion
|
|
3181
1912
|
//#region src/lib/plugins/length/LengthPlugin.d.ts
|
|
3182
1913
|
declare const LengthPlugin: SlatePlugin<LengthConfig>;
|
|
3183
1914
|
//#endregion
|
|
1915
|
+
//#region src/lib/plugins/node-id/normalizeStaticValue.d.ts
|
|
1916
|
+
declare const STATIC_VALUE_CREATED_AT = 1704067200000;
|
|
1917
|
+
type NormalizeStaticValueOptions = NormalizeNodeIdOptions & {
|
|
1918
|
+
createdAt?: number;
|
|
1919
|
+
};
|
|
1920
|
+
declare const normalizeStaticValue: <V extends Value>(value: V, options?: NormalizeStaticValueOptions) => V;
|
|
1921
|
+
//#endregion
|
|
3184
1922
|
//#region src/lib/plugins/node-id/withNodeId.d.ts
|
|
3185
1923
|
/** Enables support for inserting nodes with an id key. */
|
|
3186
1924
|
declare const withNodeId: OverrideEditor<NodeIdConfig>;
|
|
@@ -3378,6 +2116,7 @@ type BasePlugin<C extends AnyPluginConfig = PluginConfig> = {
|
|
|
3378
2116
|
*
|
|
3379
2117
|
* - `'default'`: Default behavior
|
|
3380
2118
|
* - `'exit'`: Exit the current block
|
|
2119
|
+
* - `'lift'`: Lift the current block out of the nearest matching ancestor
|
|
3381
2120
|
* - `'reset'`: Reset block to default paragraph type
|
|
3382
2121
|
* - `'lineBreak'`: Insert newline character
|
|
3383
2122
|
* - `'deleteExit'`: Delete backward then exit
|
|
@@ -3387,6 +2126,7 @@ type BasePlugin<C extends AnyPluginConfig = PluginConfig> = {
|
|
|
3387
2126
|
* Defines actions on delete based on block state.
|
|
3388
2127
|
*
|
|
3389
2128
|
* - `'default'`: Default behavior
|
|
2129
|
+
* - `'lift'`: Lift the current block out of the nearest matching ancestor
|
|
3390
2130
|
* - `'reset'`: Reset block to default paragraph type
|
|
3391
2131
|
*/
|
|
3392
2132
|
delete?: DeleteRules;
|
|
@@ -3557,7 +2297,7 @@ type BaseTransformOptions = GetInjectNodePropsOptions & {
|
|
|
3557
2297
|
};
|
|
3558
2298
|
type BreakRules = {
|
|
3559
2299
|
/** Action when Enter is pressed in an empty block. */
|
|
3560
|
-
empty?: 'default' | 'deleteExit' | 'exit' | 'reset';
|
|
2300
|
+
empty?: 'default' | 'deleteExit' | 'exit' | 'lift' | 'reset';
|
|
3561
2301
|
/**
|
|
3562
2302
|
* Action when Enter is pressed at the end of an empty line. This is typically
|
|
3563
2303
|
* used with `default: 'lineBreak'`.
|
|
@@ -3598,7 +2338,7 @@ type DeleteRules = {
|
|
|
3598
2338
|
* </blockquote>
|
|
3599
2339
|
* ```
|
|
3600
2340
|
*/
|
|
3601
|
-
start?: 'default' | 'reset';
|
|
2341
|
+
start?: 'default' | 'lift' | 'reset';
|
|
3602
2342
|
/** Action when Backspace is pressed and the block is empty. */
|
|
3603
2343
|
empty?: 'default' | 'reset';
|
|
3604
2344
|
};
|
|
@@ -3795,6 +2535,7 @@ type SlateEditor = BaseEditor & {
|
|
|
3795
2535
|
meta: BaseEditor['meta'] & {
|
|
3796
2536
|
/** An array of plugins that are currently being used by the editor. */
|
|
3797
2537
|
pluginList: AnyEditorPlugin[];
|
|
2538
|
+
inputRules: ResolvedInputRulesMeta;
|
|
3798
2539
|
shortcuts: any;
|
|
3799
2540
|
};
|
|
3800
2541
|
plugins: Record<string, AnyEditorPlugin>;
|
|
@@ -3810,6 +2551,7 @@ type TSlateEditor<V extends Value = Value, P extends AnyPluginConfig = CorePlugi
|
|
|
3810
2551
|
api: EditorApi<V> & UnionToIntersection<InferApi<CorePlugin | P>>;
|
|
3811
2552
|
children: V;
|
|
3812
2553
|
meta: BaseEditor['meta'] & {
|
|
2554
|
+
inputRules: ResolvedInputRulesMeta;
|
|
3813
2555
|
pluginList: P[];
|
|
3814
2556
|
shortcuts: any;
|
|
3815
2557
|
};
|
|
@@ -3887,6 +2629,15 @@ type BaseWithSlateOptions<P extends AnyPluginConfig = CorePlugin> = {
|
|
|
3887
2629
|
* limit is reached, further input will be prevented.
|
|
3888
2630
|
*/
|
|
3889
2631
|
maxLength?: number;
|
|
2632
|
+
/**
|
|
2633
|
+
* Configuration for the built-in navigation feedback plugin.
|
|
2634
|
+
*
|
|
2635
|
+
* This core plugin flashes the landed target after navigation jumps such as
|
|
2636
|
+
* TOC, footnote, search, or custom outline movement.
|
|
2637
|
+
*
|
|
2638
|
+
* @default { duration: 1600 }
|
|
2639
|
+
*/
|
|
2640
|
+
navigationFeedback?: NavigationFeedbackConfig['options'] | boolean;
|
|
3890
2641
|
/**
|
|
3891
2642
|
* Configuration for automatic node ID generation and management.
|
|
3892
2643
|
*
|
|
@@ -3987,6 +2738,7 @@ declare const withSlate: <V extends Value = Value, P extends AnyPluginConfig = C
|
|
|
3987
2738
|
autoSelect,
|
|
3988
2739
|
chunking,
|
|
3989
2740
|
maxLength,
|
|
2741
|
+
navigationFeedback,
|
|
3990
2742
|
nodeId,
|
|
3991
2743
|
optionsStoreFactory,
|
|
3992
2744
|
plugins,
|
|
@@ -4073,6 +2825,8 @@ type RenderElementProps<N$1 extends TElement = TElement> = {
|
|
|
4073
2825
|
};
|
|
4074
2826
|
children: any;
|
|
4075
2827
|
element: N$1;
|
|
2828
|
+
/** Pre-computed path for static rendering (avoids expensive findPath traversal). */
|
|
2829
|
+
path?: Path;
|
|
4076
2830
|
};
|
|
4077
2831
|
//#endregion
|
|
4078
2832
|
//#region src/lib/types/RenderLeafProps.d.ts
|
|
@@ -4085,6 +2839,8 @@ type RenderLeafProps<N$1 extends TText = TText> = {
|
|
|
4085
2839
|
};
|
|
4086
2840
|
children: any;
|
|
4087
2841
|
leaf: N$1;
|
|
2842
|
+
/** Pre-computed path for static rendering. */
|
|
2843
|
+
path?: Path;
|
|
4088
2844
|
text: N$1;
|
|
4089
2845
|
/**
|
|
4090
2846
|
* The position of the leaf within the Text node, only present when the text
|
|
@@ -4098,6 +2854,8 @@ type RenderTextFn = (props: RenderTextProps) => React$1.ReactElement<any>;
|
|
|
4098
2854
|
type RenderTextProps<N$1 extends TText = TText> = {
|
|
4099
2855
|
/** The text node being rendered. */
|
|
4100
2856
|
text: N$1;
|
|
2857
|
+
/** Pre-computed path for static rendering. */
|
|
2858
|
+
path?: Path;
|
|
4101
2859
|
/** The children (leaves) rendered within this text node. */
|
|
4102
2860
|
children: any;
|
|
4103
2861
|
/**
|
|
@@ -4174,7 +2932,7 @@ declare const getSlateElements: (element: HTMLElement) => HTMLElement[];
|
|
|
4174
2932
|
declare const defaultsDeepToNodes: <N$1 extends TNode>(options: Omit<ApplyDeepToNodesOptions<N$1>, "apply">) => void;
|
|
4175
2933
|
//#endregion
|
|
4176
2934
|
//#region src/lib/utils/getInjectMatch.d.ts
|
|
4177
|
-
declare const getInjectMatch: <E extends SlateEditor>(editor: E, plugin: EditorPlugin) => (node: TNode, path
|
|
2935
|
+
declare const getInjectMatch: <E extends SlateEditor>(editor: E, plugin: EditorPlugin) => (node: TNode, path?: Path) => boolean;
|
|
4178
2936
|
//#endregion
|
|
4179
2937
|
//#region src/lib/utils/getInjectedPlugins.d.ts
|
|
4180
2938
|
/**
|
|
@@ -4271,7 +3029,7 @@ declare const normalizeDescendantsToDocumentFragment: (editor: SlateEditor, {
|
|
|
4271
3029
|
}) => Descendant[];
|
|
4272
3030
|
//#endregion
|
|
4273
3031
|
//#region src/lib/utils/omitPluginContext.d.ts
|
|
4274
|
-
declare const omitPluginContext: <T extends SlatePluginContext<AnySlatePlugin>>(ctx: T) => Omit<T, "api" | "editor" | "
|
|
3032
|
+
declare const omitPluginContext: <T extends SlatePluginContext<AnySlatePlugin>>(ctx: T) => Omit<T, "api" | "editor" | "plugin" | "type" | "getOption" | "tf" | "getOptions" | "setOptions" | "setOption">;
|
|
4275
3033
|
//#endregion
|
|
4276
3034
|
//#region src/lib/utils/overridePluginsByKey.d.ts
|
|
4277
3035
|
/**
|
|
@@ -4290,5 +3048,4 @@ declare const pipeOnNodeChange: (editor: SlateEditor, node: Descendant, prevNode
|
|
|
4290
3048
|
//#region src/lib/utils/pipeOnTextChange.d.ts
|
|
4291
3049
|
declare const pipeOnTextChange: (editor: SlateEditor, node: Descendant, text: string, prevText: string, operation: TextOperation) => boolean;
|
|
4292
3050
|
//#endregion
|
|
4293
|
-
export { TSlateEditor as $,
|
|
4294
|
-
//# sourceMappingURL=index-NTp--CEF.d.ts.map
|
|
3051
|
+
export { TSlateEditor as $, SlateHTMLProps as $a, Serializer as $i, cleanHtmlFontElements as $n, SlateExtensionConfig as $r, upsertInlineFormattingContext as $t, applyDeepToNodes as A, ResolvedInputRule as Aa, AnySlatePlugin as Ai, isHtmlInlineElement as An, AstPlugin as Ao, PlateError as Ar, BaseParagraphPlugin as At, ZustandStoreApi as B, getSelectedDomNode as Ba, InjectNodeProps as Bi, htmlBrToNewLine as Bn, navigate as Br, STATIC_VALUE_CREATED_AT as Bt, isSlateNode as C, InsertDataInputRuleContext as Ca, getPluginType as Ci, pipeDeserializeHtmlLeaf as Cn, SlateRenderLeaf as Co, NodeIdOptions as Cr, NodeComponents as Ct, isSlateText as D, MatchBlockFenceOptions as Da, createSlatePlugin as Di, isOlSymbol as Dn, SlateRenderElement as Do, DebugErrorType as Dr, SelectionRules as Dt, isSlateString as E, MarkInputRuleConfig as Ea, getEditorPlugin as Ei, parseHtmlDocument as En, pipeRenderElementStatic as Eo, normalizeNodeId as Er, PluginConfig as Et, RenderLeafProps as F, TextSubstitutionPattern as Fa, ExtendEditorApi as Fi, inlineTagNames as Fn, getEdgeNodes as Fr, withBreakRules as Ft, WithSlateOptions as G, getPluginDataAttributes as Ga, NodeStaticWrapperComponentReturnType as Gi, someHtmlElement as Gn, NAVIGATION_FEEDBACK_KEY as Gr, createBlockFenceInputRule as Gt, nanoid$1 as H, getSelectedDomBlocks as Ha, NodeStaticProps as Hi, getHtmlComments as Hn, flashTarget as Hr, LengthPlugin as Ht, RenderElementFn as I, stripSlateDataAttributes as Ia, ExtendEditorTransforms as Ii, htmlTextNodeToString as In, EdgeNodes as Ir, OverridePlugin as It, BaseEditor as J, ViewPlugin as Ja, Parser as Ji, deserializeHtmlElement as Jn, NavigationFeedbackPluginKey as Jr, createTextSubstitutionInputRule as Jt, createSlateEditor as K, createStaticString as Ka, NormalizeInitialValue as Ki, deserializeHtmlNodeChildren as Kn, NavigationFeedbackActiveTarget as Kr, createBlockStartInputRule as Kt, RenderElementProps as L, stripHtmlClassNames as La, HtmlDeserializer as Li, htmlStringToDOMNode as Ln, AffinityConfig as Lr, withOverrides as Lt, RenderTextFn as M, SelectionInputRuleContext as Ma, Deserializer as Mi, isHtmlElement as Mn, isNodeAffinity as Mr, withNormalizeRules as Mt, RenderTextProps as N, TextSubstitutionInputRuleConfig as Na, EditorPlugin as Ni, isHtmlComment as Nn, isNodesAffinity as Nr, withMergeRules as Nt, isSlateVoid as O, MatchBlockStartOptions as Oa, createTSlatePlugin as Oi, isHtmlText as On, pluginRenderElementStatic as Oo, DebugPlugin as Or, WithAnyKey as Ot, RenderLeafFn as P, TextSubstitutionMatch as Pa, ExtendEditor as Pi, isHtmlBlockElement as Pn, getMarkBoundaryAffinity as Pr, withDeleteRules as Pt, SlateEditor as Q, SlateElementProps as Qa, RenderStaticNodeWrapperProps as Qi, cleanHtmlLinkElements as Qn, NavigationNavigateOptions as Qr, endInlineFormattingContext as Qt, RenderChunkFn as R, pipeDecorate as Ra, HtmlSerializer as Ri, htmlElementToLeaf as Rn, AffinityPlugin as Rr, withNodeId as Rt, isSlateLeaf as S, InsertDataInputRule as Sa, getPluginKeys as Si, pluginDeserializeHtml as Sn, pluginRenderTextStatic as So, NodeIdConfig as Sr, NodeComponent as St, isSlatePluginNode as T, InsertTextInputRuleContext as Ta, getSlatePlugin as Ti, parseHtmlElement as Tn, pluginRenderLeafStatic as To, NormalizeNodeIdOptions as Tr, ParserOptions as Tt, BaseWithSlateOptions as U, getRenderNodeStaticProps as Ua, NodeStaticWrapperComponent as Ui, getDataNodeProps as Un, resolveNavigationFeedbackTarget as Ur, defineInputRule as Ut, createZustandStore$1 as V, getSelectedDomFragment as Va, LeafStaticProps as Vi, htmlBodyToFragment as Vn, clearNavigationFeedbackTarget as Vr, normalizeStaticValue as Vt, CreateSlateEditorOptions as W, getNodeDataAttributes as Wa, NodeStaticWrapperComponentProps as Wi, findHtmlElement as Wn, NavigationFeedbackPlugin as Wr, createRuleFactory as Wt, KeyofNodePlugins as X, getEditorDOMFromHtmlString as Xa, RenderStaticNodeWrapper as Xi, copyBlockMarksToSpanChild as Xn, NavigationFeedbackTarget as Xr, matchBlockStart as Xt, InferPlugins as Y, createStaticEditor as Ya, PartialEditorPlugin as Yi, deserializeHtml as Yn, NavigationFeedbackStoredTarget as Yr, matchBlockFence as Yt, KeyofPlugins as Z, SlateElement as Za, RenderStaticNodeWrapperFunction as Zi, cleanHtmlTextNodes as Zn, NavigationFlashTargetOptions as Zr, matchDelimitedInline as Zt, getInjectMatch as _, InputRulesConfig as _a, HistoryPlugin as _i, replaceTagName as _n, LeafStatic as _o, GetCorePluginsOptions as _r, InferOptions as _t, omitPluginContext as a, SlateShortcut as aa, InsertExitBreakOptions as ai, collapseWhiteSpaceChildren as an, StyledSlateElementProps as ao, CARRIAGE_RETURN as ar, BasePluginContext as at, isSlateEditor as b, InsertBreakInputRule as ba, getPluginByType as bi, preCleanHtml as bn, SlateRenderText as bo, ChunkingConfig as br, MatchRules as bt, isType as c, AnyInputRule as ca, init as ci, CollapseWhiteSpaceState as cn, useNodeAttributes as co, SPACE as cr, BaseTransformOptions as ct, isHotkey as d, BlockFenceInputRuleMatch as da, DOMPlugin as di, WhiteSpaceRule as dn, SlateRenderLeafProps as do, HtmlPlugin as dr, EditOnlyConfig as dt, SlatePlugin as ea, SlateExtensionPlugin as ei, isLastNonEmptyTextOfInlineFormattingContext as en, SlateLeaf as eo, cleanHtmlEmptyElements as er, AnyPluginConfig as et, getSlateClass as f, BlockStartInputRuleConfig as fa, DomConfig as fi, unwrapHtmlElement as fn, SlateRenderNodeProps as fo, withChunking as fr, ExtendConfig as ft, getInjectedPlugins as g, InputRuleTarget as ga, ParserPlugin as gi, traverseHtmlComments as gn, ElementStatic as go, DebugConfig as gr, InferKey as gt, keyToDataAttribute as h, InputRuleBuilder as ha, withScrolling as hi, traverseHtmlElements as hn, serializeHtml as ho, CorePluginTransforms as hr, InferApi as ht, overridePluginsByKey as i, SlatePlugins as ia, liftBlock as ii, collapseWhiteSpaceElement as in, SlateTextProps as io, DeserializeHtmlNodeReturnType as ir, BasePlugin as it, EditableProps as j, ResolvedInputRulesMeta as ja, Decorate as ji, isHtmlFragmentHref as jn, setAffinitySelection as jr, ParagraphConfig as jt, ApplyDeepToNodesOptions as k, MatchDelimitedInlineOptions as ka, AnyEditorPlugin as ki, isHtmlTable as kn, HandlerReturnType as ko, LogLevel as kr, WithRequiredKey as kt, Hotkeys as l, BaseInputRule as la, AUTO_SCROLL as li, TrimEndRule as ln, BoxStaticProps as lo, TAB as lr, BreakRules as lt, getNodeDataAttributeKeys as m, DelimitedInlineInputRuleMatch as ma, WithAutoScrollOptions as mi, traverseHtmlNode as mn, SerializeHtmlOptions as mo, CorePluginApi as mr, GetInjectNodePropsReturnType as mt, pipeOnNodeChange as n, SlatePluginContext as na, resetBlock as ni, collapseWhiteSpaceText as nn, SlateNodeProps as no, cleanHtmlBrElements as nr, BaseHtmlDeserializer as nt, normalizeDescendantsToDocumentFragment as o, TextStaticProps as oa, insertExitBreak as oi, collapseWhiteSpace as on, StyledSlateLeafProps as oo, LINE_FEED as or, BasePluginNode as ot, getPluginNodeProps as p, BlockStartInputRuleMatch as pa, ScrollMode as pi, traverseHtmlTexts as pn, SlateRenderTextProps as po, CorePlugin as pr, GetInjectNodePropsOptions as pt, withSlate as q, getStaticPlugins as qa, OverrideEditor as qi, deserializeHtmlNode as qn, NavigationFeedbackConfig as qr, createMarkInputRule as qt, pipeInsertDataQuery as r, SlatePluginMethods as ra, LiftBlockOptions as ri, collapseWhiteSpaceNode as rn, SlateText as ro, DeserializeHtmlChildren as rr, BaseInjectProps as rt, mergeDeepToNodes as s, TransformOptions as sa, InitOptions as si, collapseString as sn, StyledSlateTextProps as so, NO_BREAK_SPACE as sr, BaseSerializer as st, pipeOnTextChange as t, SlatePluginConfig$1 as ta, setValue as ti, inferWhiteSpaceRule as tn, SlateLeafProps as to, cleanHtmlCrLf as tr, BaseDeserializer as tt, createHotkey as u, BlockFenceInputRuleConfig as ua, AutoScrollOperationsMap as ui, TrimStartRule as un, SlateRenderElementProps as uo, ZERO_WIDTH_SPACE as ur, DeleteRules as ut, defaultsDeepToNodes as v, InputRulesDefinition as va, withPlateHistory as vi, removeHtmlSurroundings as vn, PlateStatic as vo, LengthConfig as vr, InferSelectors as vt, isSlatePluginElement as w, InsertTextInputRule as wa, getPluginTypes as wi, pipeDeserializeHtmlElement as wn, pipeRenderLeafStatic as wo, NodeIdPlugin as wr, NormalizeRules as wt, isSlateElement as x, InsertBreakInputRuleContext as xa, getPluginKey as xi, postCleanHtml as xn, pipeRenderTextStatic as xo, ChunkingPlugin as xr, MergeRules as xt, getSlateElements as y, InputRulesFactoryContext as ya, getContainerTypes as yi, removeHtmlNodesBetweenComments as yn, PlateStaticProps as yo, getCorePlugins as yr, InferTransforms as yt, RenderChunkProps as z, isSelectOutside as za, InferConfig as zi, htmlElementToElement as zn, ElementAffinity as zr, NormalizeStaticValueOptions as zt };
|