@lofcz/platejs-core 52.3.4 → 52.3.6
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-CLvWpTKx.d.ts} +52 -1745
- package/dist/index.d.ts +2 -2
- package/dist/index.js +31 -3
- package/dist/react/index.d.ts +194 -195
- package/dist/react/index.js +3 -4
- package/dist/static/index.d.ts +1 -1
- package/dist/static/index.js +2 -2
- package/dist/{static-CVN6JhaR.js → static-DIYyt_jS.js} +27 -15
- package/dist/{withSlate-1B0SfAWG.js → withSlate-BfRR5wTZ.js} +98 -81
- package/package.json +5 -5
- 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
2
|
import { Ancestor, DOMRange, DecoratedRange, Descendant, Editor, EditorAboveOptions, EditorApi, EditorBase, EditorTransforms, LeafPosition, NodeEntry, NodeOf, NodeOperation, Operation, Path, QueryNodeOptions, ScrollIntoViewOptions, TElement, TNode, TRange, TSelection, TText, TextOperation, Value } from "@platejs/slate";
|
|
3
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>;
|
|
@@ -198,1725 +196,13 @@ declare const createStaticEditor: <V extends Value = Value, P extends AnyPluginC
|
|
|
198
196
|
...options
|
|
199
197
|
}?: CreateStaticEditorOptions<V, P>) => TSlateEditor<V, P>;
|
|
200
198
|
//#endregion
|
|
201
|
-
//#region ../slate/dist/index.d.ts
|
|
202
|
-
//#region src/internal/dom-editor/findDocumentOrShadowRoot.d.ts
|
|
203
|
-
declare const findDocumentOrShadowRoot: (editor: Editor$1) => Document | ShadowRoot | undefined;
|
|
204
|
-
//#endregion
|
|
205
|
-
//#region src/internal/dom-editor/findEventRange.d.ts
|
|
206
|
-
declare const findEventRange: (editor: Editor$1, event: any) => slate0.BaseRange | undefined;
|
|
207
|
-
//#endregion
|
|
208
|
-
//#region src/internal/dom-editor/findKey.d.ts
|
|
209
|
-
declare const findKey: (editor: Editor$1, node: TNode$1) => slate_dom0.Key | undefined;
|
|
210
|
-
//#endregion
|
|
211
|
-
//#region src/internal/dom-editor/getWindow.d.ts
|
|
212
|
-
declare const getWindow: (editor: Editor$1) => Window | undefined;
|
|
213
|
-
//#endregion
|
|
214
|
-
//#region src/internal/dom-editor/hasDOMNode.d.ts
|
|
215
|
-
declare const hasDOMNode: (editor: Editor$1, target: DOMNode, options?: Parameters<typeof DOMEditor.hasDOMNode>[2]) => boolean;
|
|
216
|
-
//#endregion
|
|
217
|
-
//#region src/internal/dom-editor/hasRange.d.ts
|
|
218
|
-
declare const hasRange: (editor: Editor$1, range: TRange$1) => boolean;
|
|
219
|
-
//#endregion
|
|
220
|
-
//#region src/internal/dom-editor/isComposing.d.ts
|
|
221
|
-
declare const isComposing: (editor: Editor$1) => boolean;
|
|
222
|
-
//#endregion
|
|
223
|
-
//#region src/internal/dom-editor/isFocused.d.ts
|
|
224
|
-
declare const isFocused: (editor: Editor$1) => boolean;
|
|
225
|
-
//#endregion
|
|
226
|
-
//#region src/internal/dom-editor/isReadOnly.d.ts
|
|
227
|
-
declare const isReadOnly: (editor: Editor$1) => boolean;
|
|
228
|
-
//#endregion
|
|
229
|
-
//#region src/internal/dom-editor/isTargetInsideNonReadonlyVoid.d.ts
|
|
230
|
-
declare const isTargetInsideNonReadonlyVoid: (editor: Editor$1, target: EventTarget | null) => boolean;
|
|
231
|
-
//#endregion
|
|
232
|
-
//#region src/types.d.ts
|
|
233
|
-
type At = TLocation | TNode$1;
|
|
234
|
-
type AtOrDescendant = Descendant$1 | TLocation;
|
|
235
|
-
type LeafEdge = 'end' | 'start';
|
|
236
|
-
type TextUnit = 'block' | 'character' | 'line' | 'word';
|
|
237
|
-
type TextUnitAdjustment = TextUnit | 'offset';
|
|
238
|
-
type TSelection$1 = Selection;
|
|
239
|
-
//#endregion
|
|
240
|
-
//#region src/interfaces/point.d.ts
|
|
241
|
-
type Point = {
|
|
242
|
-
/** The index of the character in the text node. */
|
|
243
|
-
offset: number;
|
|
244
|
-
/** The path to the text node. */
|
|
245
|
-
path: Path$2;
|
|
246
|
-
};
|
|
247
|
-
/** Point retrieval, check and transform methods. */
|
|
248
|
-
|
|
249
|
-
//#endregion
|
|
250
|
-
//#region src/interfaces/range.d.ts
|
|
251
|
-
/**
|
|
252
|
-
* `TRange` objects are a set of points that refer to a specific span of a Slate
|
|
253
|
-
* document. They can define a span inside a single node or a can span across
|
|
254
|
-
* multiple nodes.
|
|
255
|
-
*/
|
|
256
|
-
type TRange$1 = {
|
|
257
|
-
/** The start point of the range. */
|
|
258
|
-
anchor: Point;
|
|
259
|
-
/** The end point of the range. */
|
|
260
|
-
focus: Point;
|
|
261
|
-
};
|
|
262
|
-
//#endregion
|
|
263
|
-
//#region src/interfaces/operation.d.ts
|
|
264
|
-
/**
|
|
265
|
-
* `Operation` objects define the low-level instructions that Slate editors use
|
|
266
|
-
* to apply changes to their internal state. Representing all changes as
|
|
267
|
-
* operations is what allows Slate editors to easily implement history,
|
|
268
|
-
* collaboration, and other features.
|
|
269
|
-
*/
|
|
270
|
-
type Operation$1<N$1 extends Descendant$1 = Descendant$1> = NodeOperation$1<N$1> | SelectionOperation | TextOperation$1;
|
|
271
|
-
/** Operation manipulation and check methods. */
|
|
272
|
-
|
|
273
|
-
type InsertNodeOperation<N$1 extends Descendant$1 = Descendant$1> = {
|
|
274
|
-
[key: string]: unknown;
|
|
275
|
-
node: N$1;
|
|
276
|
-
path: Path$2;
|
|
277
|
-
type: 'insert_node';
|
|
278
|
-
};
|
|
279
|
-
type InsertTextOperation = {
|
|
280
|
-
[key: string]: unknown;
|
|
281
|
-
offset: number;
|
|
282
|
-
path: Path$2;
|
|
283
|
-
text: string;
|
|
284
|
-
type: 'insert_text';
|
|
285
|
-
};
|
|
286
|
-
type MergeNodeOperation<N$1 extends Descendant$1 = Descendant$1> = {
|
|
287
|
-
[key: string]: unknown;
|
|
288
|
-
path: Path$2;
|
|
289
|
-
position: number;
|
|
290
|
-
properties: Partial<NodeProps<N$1>>;
|
|
291
|
-
type: 'merge_node';
|
|
292
|
-
};
|
|
293
|
-
type MoveNodeOperation = {
|
|
294
|
-
[key: string]: unknown;
|
|
295
|
-
newPath: Path$2;
|
|
296
|
-
path: Path$2;
|
|
297
|
-
type: 'move_node';
|
|
298
|
-
};
|
|
299
|
-
type NodeOperation$1<N$1 extends Descendant$1 = Descendant$1> = InsertNodeOperation<N$1> | MergeNodeOperation<N$1> | MoveNodeOperation | RemoveNodeOperation<N$1> | SetNodeOperation<N$1> | SplitNodeOperation<N$1>;
|
|
300
|
-
type RemoveNodeOperation<N$1 extends Descendant$1 = Descendant$1> = {
|
|
301
|
-
[key: string]: unknown;
|
|
302
|
-
node: N$1;
|
|
303
|
-
path: Path$2;
|
|
304
|
-
type: 'remove_node';
|
|
305
|
-
};
|
|
306
|
-
type RemoveTextOperation = {
|
|
307
|
-
[key: string]: unknown;
|
|
308
|
-
offset: number;
|
|
309
|
-
path: Path$2;
|
|
310
|
-
text: string;
|
|
311
|
-
type: 'remove_text';
|
|
312
|
-
};
|
|
313
|
-
type SelectionOperation = SetSelectionOperation;
|
|
314
|
-
type SetNodeOperation<N1 extends Descendant$1 = Descendant$1, N2 extends Descendant$1 = Descendant$1> = {
|
|
315
|
-
[key: string]: unknown;
|
|
316
|
-
newProperties: Partial<NodeProps<N1>>;
|
|
317
|
-
path: Path$2;
|
|
318
|
-
properties: Partial<NodeProps<N2>>;
|
|
319
|
-
type: 'set_node';
|
|
320
|
-
};
|
|
321
|
-
type SetSelectionOperation = {
|
|
322
|
-
[key: string]: unknown;
|
|
323
|
-
newProperties: null;
|
|
324
|
-
properties: TRange$1;
|
|
325
|
-
type: 'set_selection';
|
|
326
|
-
} | {
|
|
327
|
-
[key: string]: unknown;
|
|
328
|
-
newProperties: Partial<TRange$1>;
|
|
329
|
-
properties: Partial<TRange$1>;
|
|
330
|
-
type: 'set_selection';
|
|
331
|
-
} | {
|
|
332
|
-
[key: string]: unknown;
|
|
333
|
-
newProperties: TRange$1;
|
|
334
|
-
properties: null;
|
|
335
|
-
type: 'set_selection';
|
|
336
|
-
};
|
|
337
|
-
type SplitNodeOperation<N$1 extends Descendant$1 = Descendant$1> = {
|
|
338
|
-
[key: string]: unknown;
|
|
339
|
-
path: Path$2;
|
|
340
|
-
position: number;
|
|
341
|
-
properties: Partial<NodeProps<N$1>>;
|
|
342
|
-
type: 'split_node';
|
|
343
|
-
};
|
|
344
|
-
type TextOperation$1 = InsertTextOperation | RemoveTextOperation;
|
|
345
|
-
//#endregion
|
|
346
|
-
//#region src/interfaces/path.d.ts
|
|
347
|
-
/**
|
|
348
|
-
* `Path` arrays are a list of indexes that describe a node's exact position in
|
|
349
|
-
* a Slate node tree. Although they are usually relative to the root `Editor`
|
|
350
|
-
* object, they can be relative to any `Node` object.
|
|
351
|
-
*/
|
|
352
|
-
type Path$2 = number[];
|
|
353
|
-
/** Path retrieval, check and transform methods. */
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* `TText` objects represent the nodes that contain the actual text content of a
|
|
357
|
-
* Slate document along with any formatting properties. They are always leaf
|
|
358
|
-
* nodes in the document tree as they cannot contain any children.
|
|
359
|
-
*/
|
|
360
|
-
type TText$1 = {
|
|
361
|
-
text: string;
|
|
362
|
-
} & UnknownObject;
|
|
363
|
-
/** Text retrieval and check methods. */
|
|
364
|
-
|
|
365
|
-
type MarksIn<V extends Value$1> = MarksOf<V[number]>;
|
|
366
|
-
type MarksOf<N$1 extends TNode$1> = Simplify<UnionToIntersection<NodeProps<TextOf<N$1>>>>;
|
|
367
|
-
/** A utility type to get all the text node types from a root node type. */
|
|
368
|
-
type TextIn<V extends Value$1> = TextOf<V[number]>;
|
|
369
|
-
type TextOf<N$1 extends TNode$1> = Editor$1 extends N$1 ? TText$1 : TElement$1 extends N$1 ? TText$1 : N$1 extends Editor$1 ? TextOf<N$1['children'][number]> : N$1 extends TElement$1 ? Extract<N$1['children'][number], TText$1> | TextOf<N$1['children'][number]> : N$1 extends TText$1 ? N$1 : never;
|
|
370
|
-
//#endregion
|
|
371
|
-
//#region src/interfaces/node-entry.d.ts
|
|
372
|
-
/** Ancestor entry from a node. */
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* `NodeEntry` objects are returned when iterating over the nodes in a Slate
|
|
376
|
-
* document tree. They consist of the node and its `Path` relative to the root
|
|
377
|
-
* node in the document.
|
|
378
|
-
*/
|
|
379
|
-
type NodeEntry$2<N$1 extends TNode$1 = TNode$1> = [N$1, Path$2];
|
|
380
|
-
/** Node entry from an editor. */
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* The `Descendant` union type represents nodes that are descendants in the
|
|
384
|
-
* tree. It is returned as a convenience in certain cases to narrow a value
|
|
385
|
-
* further than the more generic `Node` union.
|
|
386
|
-
*/
|
|
387
|
-
type Descendant$1 = TElement$1 | TText$1;
|
|
388
|
-
/** Convenience type for returning the props of a node. */
|
|
389
|
-
type NodeProps<N$1 extends TNode$1 = TNode$1> = N$1 extends Editor$1 ? Omit<N$1, 'children'> : N$1 extends TElement$1 ? Omit<N$1, 'children'> : Omit<N$1, 'text'>;
|
|
390
|
-
/**
|
|
391
|
-
* The `TNode` union type represents all of the different types of nodes that
|
|
392
|
-
* occur in a Slate document tree.
|
|
393
|
-
*/
|
|
394
|
-
type TNode$1 = Editor$1 | TElement$1 | TText$1;
|
|
395
|
-
/** A utility type to get all the ancestor node types from a root node type. */
|
|
396
|
-
type AncestorIn<V extends Value$1> = AncestorOf<Editor$1 | V[number]>;
|
|
397
|
-
type AncestorOf<N$1 extends TNode$1> = Editor$1 extends N$1 ? Editor$1 | TElement$1 : TElement$1 extends N$1 ? TElement$1 : N$1 extends Editor$1 ? ElementOf<N$1['children'][number]> | N$1 | N$1['children'][number] : N$1 extends TElement$1 ? ElementOf<N$1> | N$1 : never;
|
|
398
|
-
/** A utility type to get the child node types from a root node type. */
|
|
399
|
-
|
|
400
|
-
/** A utility type to get all the descendant node types from a root node type. */
|
|
401
|
-
type DescendantIn$1<V extends Value$1> = DescendantOf<V[number]>;
|
|
402
|
-
type DescendantOf<N$1 extends TNode$1> = N$1 extends Editor$1 ? ElementOf<N$1> | TextOf<N$1> : N$1 extends TElement$1 ? ElementOf<N$1['children'][number]> | TextOf<N$1> : never;
|
|
403
|
-
/**
|
|
404
|
-
* The `Node` union type represents all of the different types of nodes that
|
|
405
|
-
* occur in a Slate document tree.
|
|
406
|
-
*/
|
|
407
|
-
|
|
408
|
-
/** A utility type to get all possible node types from a Value type */
|
|
409
|
-
type NodeIn<V extends Value$1> = NodeOf$1<Editor$1 | V[number]>;
|
|
410
|
-
/** A utility type to get all the node types from a root node type. */
|
|
411
|
-
type NodeOf$1<N$1 extends TNode$1> = ElementOf<N$1> | N$1 | TextOf<N$1>;
|
|
412
|
-
//#endregion
|
|
413
|
-
//#region src/internal/dom-editor/toDOMNode.d.ts
|
|
414
|
-
declare const toDOMNode: (editor: Editor$1, node: TNode$1) => HTMLElement | undefined;
|
|
415
|
-
//#endregion
|
|
416
|
-
//#region src/internal/dom-editor/toDOMPoint.d.ts
|
|
417
|
-
declare const toDOMPoint: (editor: Editor$1, point: Point) => slate_dom0.DOMPoint | undefined;
|
|
418
|
-
//#endregion
|
|
419
|
-
//#region src/internal/dom-editor/toDOMRange.d.ts
|
|
420
|
-
declare const toDOMRange: (editor: Editor$1, range: TRange$1) => Range | undefined;
|
|
421
|
-
//#endregion
|
|
422
|
-
//#region src/internal/dom-editor/toSlateNode.d.ts
|
|
423
|
-
declare const toSlateNode: (editor: Editor$1, domNode: DOMNode) => TNode$1 | undefined;
|
|
424
|
-
//#endregion
|
|
425
|
-
//#region src/internal/dom-editor/toSlatePoint.d.ts
|
|
426
|
-
declare const toSlatePoint: (editor: Editor$1, domPoint: DOMPoint, options: Omit<Parameters<typeof DOMEditor.toSlatePoint>[2], "suppressThrow">) => slate0.BasePoint | null | undefined;
|
|
427
|
-
//#endregion
|
|
428
|
-
//#region src/internal/dom-editor/toSlateRange.d.ts
|
|
429
|
-
declare const toSlateRange: (editor: Editor$1, domRange: Parameters<typeof DOMEditor.toSlateRange>[1], options: Omit<Parameters<typeof DOMEditor.toSlateRange>[2], "supressThrow">) => slate0.BaseRange | null | undefined;
|
|
430
|
-
//#endregion
|
|
431
|
-
//#region src/internal/editor/createPathRef.d.ts
|
|
432
|
-
declare const createPathRef: (editor: Editor$1, at: Path$2, options?: EditorPathRefOptions) => slate0.PathRef;
|
|
433
|
-
//#endregion
|
|
434
|
-
//#region src/internal/editor/createPointRef.d.ts
|
|
435
|
-
declare const createPointRef: (editor: Editor$1, point: Point, options?: EditorPointRefOptions) => slate0.PointRef;
|
|
436
|
-
//#endregion
|
|
437
|
-
//#region src/internal/editor/createRangeRef.d.ts
|
|
438
|
-
declare const createRangeRef: (editor: Editor$1, range: TRange$1, options?: EditorRangeRefOptions) => slate0.RangeRef;
|
|
439
|
-
//#endregion
|
|
440
|
-
//#region src/internal/editor/editor-path.d.ts
|
|
441
|
-
declare const path$1: (editor: Editor$1, at: At, options?: EditorPathOptions) => slate0.Path | undefined;
|
|
442
|
-
//#endregion
|
|
443
|
-
//#region src/internal/editor/getEdgePoints.d.ts
|
|
444
|
-
declare const getEdgePoints: (editor: Editor$1, at: At) => [slate0.BasePoint, slate0.BasePoint] | undefined;
|
|
445
|
-
//#endregion
|
|
446
|
-
//#region src/internal/editor/getEditorString.d.ts
|
|
447
|
-
declare const getEditorString: (editor: Editor$1, at?: At | null, options?: EditorStringOptions) => string;
|
|
448
|
-
//#endregion
|
|
449
|
-
//#region src/internal/editor/getEndPoint.d.ts
|
|
450
|
-
declare const getEndPoint: (editor: Editor$1, at: At, options?: EditorEndOptions) => slate0.BasePoint | undefined;
|
|
451
|
-
//#endregion
|
|
452
|
-
//#region src/internal/editor/getPathRefs.d.ts
|
|
453
|
-
declare const getPathRefs: (editor: Editor$1) => Set<slate0.PathRef>;
|
|
454
|
-
//#endregion
|
|
455
|
-
//#region src/internal/editor/getPoint.d.ts
|
|
456
|
-
declare const getPoint: (editor: Editor$1, at: At, options?: EditorPointOptions) => slate0.BasePoint | undefined;
|
|
457
|
-
//#endregion
|
|
458
|
-
//#region src/internal/editor/getPointAfter.d.ts
|
|
459
|
-
declare const getPointAfter: (editor: Editor$1, at: At, options?: EditorAfterOptions) => slate0.BasePoint | undefined;
|
|
460
|
-
//#endregion
|
|
461
|
-
//#region src/internal/editor/getPointBefore.d.ts
|
|
462
|
-
declare const getPointBefore: (editor: Editor$1, at: At, options?: EditorBeforeOptions) => Point | undefined;
|
|
463
|
-
//#endregion
|
|
464
|
-
//#region src/internal/editor/getPointRefs.d.ts
|
|
465
|
-
declare const getPointRefs: (editor: Editor$1) => Set<slate0.PointRef>;
|
|
466
|
-
//#endregion
|
|
467
|
-
//#region src/internal/editor/getPositions.d.ts
|
|
468
|
-
declare const getPositions: (editor: Editor$1, options?: EditorPositionsOptions) => Generator<slate0.BasePoint, void, undefined>;
|
|
469
|
-
//#endregion
|
|
470
|
-
//#region src/internal/editor/getRangeRefs.d.ts
|
|
471
|
-
declare const getRangeRefs: (editor: Editor$1) => Set<slate0.RangeRef>;
|
|
472
|
-
//#endregion
|
|
473
|
-
//#region src/internal/editor/getStartPoint.d.ts
|
|
474
|
-
declare const getStartPoint: (editor: Editor$1, at: At, options?: EditorStartOptions) => slate0.BasePoint | undefined;
|
|
475
|
-
//#endregion
|
|
476
|
-
//#region src/internal/editor/hasBlocks.d.ts
|
|
477
|
-
declare const hasBlocks$1: (editor: Editor$1, element: TElement$1) => boolean;
|
|
478
|
-
//#endregion
|
|
479
|
-
//#region src/internal/editor/hasInlines.d.ts
|
|
480
|
-
declare const hasInlines$1: (editor: Editor$1, element: TElement$1) => boolean;
|
|
481
|
-
//#endregion
|
|
482
|
-
//#region src/internal/editor/hasTexts.d.ts
|
|
483
|
-
declare const hasTexts$1: (editor: Editor$1, element: TElement$1) => boolean;
|
|
484
|
-
//#endregion
|
|
485
|
-
//#region src/internal/editor/isBlock.d.ts
|
|
486
|
-
declare const isBlock$1: (editor: Editor$1, value: any) => value is TElement$1;
|
|
487
|
-
//#endregion
|
|
488
|
-
//#region src/internal/editor/isEdgePoint.d.ts
|
|
489
|
-
declare const isEdgePoint: (editor: Editor$1, point: Point, at: TLocation) => boolean;
|
|
490
|
-
//#endregion
|
|
491
|
-
//#region src/internal/editor/isEditorNormalizing.d.ts
|
|
492
|
-
declare const isEditorNormalizing: (editor: Editor$1) => boolean;
|
|
493
|
-
//#endregion
|
|
494
|
-
//#region src/internal/editor/isElementReadOnly.d.ts
|
|
495
|
-
declare const isElementReadOnly: <E extends Editor$1 = Editor$1>(editor: E, options?: EditorElementReadOnlyOptions) => slate0.NodeEntry<slate0.BaseElement> | undefined;
|
|
496
|
-
//#endregion
|
|
497
|
-
//#region src/internal/editor/isEmpty.d.ts
|
|
498
|
-
declare const isEmpty$1: <E extends Editor$1>(editor: E, target?: At | null, options?: EditorEmptyOptions) => boolean;
|
|
499
|
-
//#endregion
|
|
500
|
-
//#region src/internal/editor/isEndPoint.d.ts
|
|
501
|
-
declare const isEndPoint: (editor: Editor$1, point: Point | null | undefined, at: TLocation) => boolean;
|
|
502
|
-
//#endregion
|
|
503
|
-
//#region src/internal/editor/isStartPoint.d.ts
|
|
504
|
-
declare const isStartPoint: (editor: Editor$1, point: Point | null | undefined, at: TLocation) => boolean;
|
|
505
|
-
//#endregion
|
|
506
|
-
//#region src/internal/editor/range.d.ts
|
|
507
|
-
declare const range$1: (editor: Editor$1, at: At | "before" | "start", to?: At | null, options?: {
|
|
508
|
-
before?: EditorBeforeOptions;
|
|
509
|
-
}) => TRange$1 | undefined;
|
|
510
|
-
//#endregion
|
|
511
|
-
//#region src/internal/editor/unhangRange.d.ts
|
|
512
|
-
declare const unhangRange$1: (editor: Editor$1, range: TRange$1, options?: EditorUnhangRangeOptions) => TRange$1;
|
|
513
|
-
//#endregion
|
|
514
|
-
//#region src/internal/editor-extension/hasMark.d.ts
|
|
515
|
-
declare const hasMark: (editor: Editor$1, key: string) => boolean;
|
|
516
|
-
//#endregion
|
|
517
|
-
//#region src/internal/editor-extension/isAt.d.ts
|
|
518
|
-
/**
|
|
519
|
-
* Check if a location (point/range) is at a specific position.
|
|
520
|
-
*
|
|
521
|
-
* For ranges:
|
|
522
|
-
*
|
|
523
|
-
* - If text=true, check if range is in single text node
|
|
524
|
-
* - If block=true, check if range is in single block
|
|
525
|
-
* - If blocks=true, check if range is across multiple blocks
|
|
526
|
-
* - If start=true, check if range starts at block start
|
|
527
|
-
* - If end=true, check if range ends at block end
|
|
528
|
-
*
|
|
529
|
-
* For points:
|
|
530
|
-
*
|
|
531
|
-
* - If word=true, check relative to word boundaries
|
|
532
|
-
* - If start=true, check if at start
|
|
533
|
-
* - If end=true, check if at end
|
|
534
|
-
*/
|
|
535
|
-
declare const isAt: <E extends Editor$1>(editor: E, {
|
|
536
|
-
at,
|
|
537
|
-
block,
|
|
538
|
-
blocks,
|
|
539
|
-
end,
|
|
540
|
-
start,
|
|
541
|
-
text,
|
|
542
|
-
word,
|
|
543
|
-
...options
|
|
544
|
-
}?: {
|
|
545
|
-
/** The location to check. Defaults to current selection */
|
|
546
|
-
at?: TLocation | null;
|
|
547
|
-
/** Check if range is in single block */
|
|
548
|
-
block?: boolean;
|
|
549
|
-
/** Check if range is across multiple blocks */
|
|
550
|
-
blocks?: boolean;
|
|
551
|
-
/** Check if range ends at block end or point is at word end */
|
|
552
|
-
end?: boolean;
|
|
553
|
-
/** Check if range starts at block start */
|
|
554
|
-
start?: boolean;
|
|
555
|
-
/** Check if range is in single text node */
|
|
556
|
-
text?: boolean;
|
|
557
|
-
/** Check if point is at word boundary (only with end=true) */
|
|
558
|
-
word?: boolean;
|
|
559
|
-
} & Omit<EditorAboveOptions$1<ValueOf$1<E>>, "at" | "block">) => boolean;
|
|
560
|
-
//#endregion
|
|
561
|
-
//#region src/internal/editor-extension/isText.d.ts
|
|
562
|
-
/** Check if a node at a location is a Text node */
|
|
563
|
-
declare const isText$1: (editor: Editor$1, at: At) => boolean;
|
|
564
|
-
//#endregion
|
|
565
|
-
//#region src/interfaces/scroll.d.ts
|
|
566
|
-
type ScrollIntoViewOptions$1 = StandardBehaviorOptions | boolean;
|
|
567
|
-
//#endregion
|
|
568
|
-
//#region src/internal/editor-extension/scrollIntoView.d.ts
|
|
569
|
-
declare function scrollIntoView(editor: Editor$1, target: DOMRange$1 | Point, options?: ScrollIntoViewOptions$1): void;
|
|
570
|
-
//#endregion
|
|
571
|
-
//#region src/internal/editor-extension/some.d.ts
|
|
572
|
-
/**
|
|
573
|
-
* Iterate through all of the nodes in the editor and break early for the first
|
|
574
|
-
* truthy match. Otherwise returns false.
|
|
575
|
-
*/
|
|
576
|
-
declare const some: <E extends Editor$1 = Editor$1>(editor: E, options: EditorNodesOptions<ValueOf$1<E>>) => boolean;
|
|
577
|
-
//#endregion
|
|
578
|
-
//#region src/slate-history/with-history.d.ts
|
|
579
|
-
/**
|
|
580
|
-
* The `withHistory` plugin keeps track of the operation history of a Slate
|
|
581
|
-
* editor as operations are applied to it, using undo and redo stacks.
|
|
582
|
-
*/
|
|
583
|
-
|
|
584
|
-
//#endregion
|
|
585
|
-
//#region src/utils/match.d.ts
|
|
586
|
-
type Predicate<T extends TNode$1> = PredicateFn<T> | PredicateObj;
|
|
587
|
-
type PredicateFn<T extends TNode$1> = (obj: T, path: Path$2) => boolean;
|
|
588
|
-
type PredicateObj = Record<string, any[] | any>;
|
|
589
|
-
/**
|
|
590
|
-
* Match the object with a predicate object or function. If predicate is:
|
|
591
|
-
*
|
|
592
|
-
* - Object: every predicate key/value should be in obj.
|
|
593
|
-
* - Function: it should return true.
|
|
594
|
-
*/
|
|
595
|
-
|
|
596
|
-
//#endregion
|
|
597
|
-
//#region src/utils/queryNode.d.ts
|
|
598
|
-
/** Filter nodes. */
|
|
599
|
-
type QueryNodeOptions$1 = {
|
|
600
|
-
/** List of types that are valid. If empty or undefined - allow all. */
|
|
601
|
-
allow?: string[] | string | null;
|
|
602
|
-
/** List of types that are invalid. */
|
|
603
|
-
exclude?: string[] | string | null;
|
|
604
|
-
/** Query the node entry. */
|
|
605
|
-
filter?: <N$1 extends TNode$1>(entry: NodeEntry$2<N$1>) => boolean;
|
|
606
|
-
/** Valid path levels. */
|
|
607
|
-
level?: number[] | number | null;
|
|
608
|
-
/** Paths above that value are invalid. */
|
|
609
|
-
maxLevel?: number | null;
|
|
610
|
-
};
|
|
611
|
-
/** Query the node entry. */
|
|
612
|
-
|
|
613
|
-
//#endregion
|
|
614
|
-
//#region src/interfaces/location.d.ts
|
|
615
|
-
/**
|
|
616
|
-
* The `TLocation` interface is a union of the ways to refer to a specific
|
|
617
|
-
* location in a Slate document: paths, points or ranges.
|
|
618
|
-
*
|
|
619
|
-
* Methods will often accept a `Location` instead of requiring only a `Path`,
|
|
620
|
-
* `Point` or `TRange`. This eliminates the need for developers to manage
|
|
621
|
-
* converting between the different interfaces in their own code base.
|
|
622
|
-
*/
|
|
623
|
-
type TLocation = Path$2 | Point | TRange$1;
|
|
624
|
-
/** Location check methods. */
|
|
625
|
-
|
|
626
|
-
/**
|
|
627
|
-
* The `Span` interface is a low-level way to refer to locations in nodes
|
|
628
|
-
* without using `Point` which requires leaf text nodes to be present.
|
|
629
|
-
*/
|
|
630
|
-
type Span$1 = [Path$2, Path$2];
|
|
631
|
-
//#endregion
|
|
632
|
-
//#region src/interfaces/editor/editor-api.d.ts
|
|
633
|
-
type EditorAboveOptions$1<V extends Value$1 = Value$1> = QueryOptions<V> & QueryMode & QueryVoids;
|
|
634
|
-
type EditorAfterOptions = {
|
|
635
|
-
distance?: number;
|
|
636
|
-
} & QueryTextUnit & QueryVoids;
|
|
637
|
-
type EditorApi$1<V extends Value$1 = Value$1> = {
|
|
638
|
-
/** Get the fragment at a location or selection. */
|
|
639
|
-
fragment: <N$1 extends ElementOrTextIn<V>>(at?: At | null, options?: EditorFragmentOptions) => N$1[];
|
|
640
|
-
/** Get the dirty paths of the editor. */
|
|
641
|
-
getDirtyPaths: <N$1 extends DescendantIn$1<V>>(operation: Operation$1<N$1>) => Path$2[];
|
|
642
|
-
/**
|
|
643
|
-
* Returns the fragment at the current selection. Used when cutting or
|
|
644
|
-
* copying, as an example, to get the fragment at the current selection.
|
|
645
|
-
*/
|
|
646
|
-
getFragment: (at?: At) => ElementOrTextIn<V>[];
|
|
647
|
-
/** Check if a value is a read-only `Element` object. */
|
|
648
|
-
isElementReadOnly: <N$1 extends ElementIn<V>>(element: N$1) => boolean;
|
|
649
|
-
/** Check if a path is selected by the current selection. */
|
|
650
|
-
isSelected: (target: Path$2 | TRange$1, options?: EditorIsSelectedOptions) => boolean;
|
|
651
|
-
/** Check if a value is a void `Element` object. */
|
|
652
|
-
isVoid: <N$1 extends ElementIn<V>>(element: N$1) => boolean;
|
|
653
|
-
/** Check if a value is a markable `Element` object. */
|
|
654
|
-
markableVoid: <N$1 extends ElementIn<V>>(element: N$1) => boolean;
|
|
655
|
-
/**
|
|
656
|
-
* Manually set if the editor should currently be normalizing. Note: Using
|
|
657
|
-
* this incorrectly can leave the editor in an invalid state.
|
|
658
|
-
*/
|
|
659
|
-
setNormalizing: (isNormalizing: boolean) => void;
|
|
660
|
-
/** Whether nodes should be merged. */
|
|
661
|
-
shouldMergeNodes: (prevNodeEntry: NodeEntry$2, curNodeEntry: NodeEntry$2, options?: {
|
|
662
|
-
reverse?: boolean;
|
|
663
|
-
}) => boolean;
|
|
664
|
-
/** Override this method to prevent normalizing the editor. */
|
|
665
|
-
shouldNormalize: (options: {
|
|
666
|
-
dirtyPaths: Path$2[];
|
|
667
|
-
initialDirtyPathsLength: number;
|
|
668
|
-
iteration: number;
|
|
669
|
-
operation?: Operation$1;
|
|
670
|
-
}) => boolean;
|
|
671
|
-
/**
|
|
672
|
-
* Override this method to prevent normalizing a specific node. Defaults to
|
|
673
|
-
* returning `true`.
|
|
674
|
-
*/
|
|
675
|
-
shouldNormalizeNode: (entry: NodeEntry$2) => boolean;
|
|
676
|
-
/** Called when there is a change in the editor. */
|
|
677
|
-
onChange: (options?: {
|
|
678
|
-
operation?: Operation$1;
|
|
679
|
-
}) => void;
|
|
680
|
-
} & {
|
|
681
|
-
/**
|
|
682
|
-
* Get the point after a location.
|
|
683
|
-
*
|
|
684
|
-
* If there is no point after the location (e.g. we are at the bottom of the
|
|
685
|
-
* document) returns `undefined`.
|
|
686
|
-
*/
|
|
687
|
-
after: OmitFirst<typeof getPointAfter>;
|
|
688
|
-
/**
|
|
689
|
-
* Returns the point before a location with optional matching criteria.
|
|
690
|
-
*
|
|
691
|
-
* If there is no point before the location (e.g. we are at the top of the
|
|
692
|
-
* document) returns `undefined`.
|
|
693
|
-
*/
|
|
694
|
-
before: OmitFirst<typeof getPointBefore>;
|
|
695
|
-
/** Get the start and end points of a location. */
|
|
696
|
-
edges: OmitFirst<typeof getEdgePoints>;
|
|
697
|
-
/** Check if an element is read-only. */
|
|
698
|
-
elementReadOnly: OmitFirst<typeof isElementReadOnly>;
|
|
699
|
-
/** Get the end point of a location. */
|
|
700
|
-
end: OmitFirst<typeof getEndPoint>;
|
|
701
|
-
/** Check if a node has block children. */
|
|
702
|
-
hasBlocks: OmitFirst<typeof hasBlocks$1>;
|
|
703
|
-
/** Check if a node has inline and text children. */
|
|
704
|
-
hasInlines: OmitFirst<typeof hasInlines$1>;
|
|
705
|
-
/** Check if mark is active at selection */
|
|
706
|
-
hasMark: OmitFirst<typeof hasMark>;
|
|
707
|
-
/** Check if a node has text children. */
|
|
708
|
-
hasTexts: OmitFirst<typeof hasTexts$1>;
|
|
709
|
-
/** Check if a value is a block `Element` object. */
|
|
710
|
-
isBlock: OmitFirst<typeof isBlock$1>;
|
|
711
|
-
/** Check if a point is an edge of a location. */
|
|
712
|
-
isEdge: OmitFirst<typeof isEdgePoint>;
|
|
713
|
-
/**
|
|
714
|
-
* Check if an element is empty, accounting for void nodes.
|
|
715
|
-
*
|
|
716
|
-
* @example
|
|
717
|
-
* ```ts
|
|
718
|
-
* editor.api.isEmpty() // Check if editor is empty
|
|
719
|
-
* editor.api.isEmpty(at) // Check if nodes at location are empty
|
|
720
|
-
* editor.api.isEmpty(at, { after: true }) // Check if text after location is empty
|
|
721
|
-
* editor.api.isEmpty(at, { block: true }) // Check if block above location is empty
|
|
722
|
-
* ```;
|
|
723
|
-
*/
|
|
724
|
-
isEmpty: OmitFirst<typeof isEmpty$1>;
|
|
725
|
-
/** Check if a point is the end point of a location. */
|
|
726
|
-
isEnd: OmitFirst<typeof isEndPoint>;
|
|
727
|
-
/** Check if the editor is currently normalizing after each operation. */
|
|
728
|
-
isNormalizing: OmitFirst<typeof isEditorNormalizing>;
|
|
729
|
-
/** Check if a point is the start point of a location. */
|
|
730
|
-
isStart: OmitFirst<typeof isStartPoint>;
|
|
731
|
-
/** Get the path of a location. */
|
|
732
|
-
path: OmitFirst<typeof path$1>;
|
|
733
|
-
/**
|
|
734
|
-
* Create a mutable ref for a `Path` object, which will stay in sync as new
|
|
735
|
-
* operations are applied to the editor.
|
|
736
|
-
*/
|
|
737
|
-
pathRef: OmitFirst<typeof createPathRef>;
|
|
738
|
-
/** Get the set of currently tracked path refs of the editor. */
|
|
739
|
-
pathRefs: OmitFirst<typeof getPathRefs>;
|
|
740
|
-
/** Get the `start` or `end` (default is `start`) point of a location. */
|
|
741
|
-
point: OmitFirst<typeof getPoint>;
|
|
742
|
-
/**
|
|
743
|
-
* Create a mutable ref for a `Point` object, which will stay in sync as new
|
|
744
|
-
* operations are applied to the editor.
|
|
745
|
-
*/
|
|
746
|
-
pointRef: OmitFirst<typeof createPointRef>;
|
|
747
|
-
/** Get the set of currently tracked point refs of the editor. */
|
|
748
|
-
pointRefs: OmitFirst<typeof getPointRefs>;
|
|
749
|
-
/**
|
|
750
|
-
* Iterate through all of the positions in the document where a `Point` can be
|
|
751
|
-
* placed. The first `Point` returns is always the starting point followed by
|
|
752
|
-
* the next `Point` as determined by the `unit` option. Note: By default void
|
|
753
|
-
* nodes are treated as a single point and iteration will not happen inside
|
|
754
|
-
* their content unless the voids option is set, then iteration will occur.
|
|
755
|
-
*/
|
|
756
|
-
positions: OmitFirst<typeof getPositions>;
|
|
757
|
-
/**
|
|
758
|
-
* Get a range from a location to another location.
|
|
759
|
-
*
|
|
760
|
-
* @example
|
|
761
|
-
* ```ts
|
|
762
|
-
* editor.api.range(at, to) // From a location to another location
|
|
763
|
-
* editor.api.range('start', at) // From block start to a location
|
|
764
|
-
* editor.api.range('before', at, { before }) // From the point before a location
|
|
765
|
-
* ```;
|
|
766
|
-
*/
|
|
767
|
-
range: OmitFirst<typeof range$1>;
|
|
768
|
-
/**
|
|
769
|
-
* Create a mutable ref for a `TRange` object, which will stay in sync as new
|
|
770
|
-
* operations are applied to the editor.
|
|
771
|
-
*/
|
|
772
|
-
rangeRef: OmitFirst<typeof createRangeRef>;
|
|
773
|
-
/** Get the set of currently tracked range refs of the editor. */
|
|
774
|
-
rangeRefs: OmitFirst<typeof getRangeRefs>;
|
|
775
|
-
/** Get the start point of a location. */
|
|
776
|
-
start: OmitFirst<typeof getStartPoint>;
|
|
777
|
-
/**
|
|
778
|
-
* Get the text string content of a location.
|
|
779
|
-
*
|
|
780
|
-
* Note: by default the text of void nodes is considered to be an empty
|
|
781
|
-
* string, regardless of content, unless you pass in true for the voids
|
|
782
|
-
* option.
|
|
783
|
-
*
|
|
784
|
-
* @example
|
|
785
|
-
* ```ts
|
|
786
|
-
* editor.api.string() // Get selection string
|
|
787
|
-
* editor.api.string([]) // Get whole editor string
|
|
788
|
-
* editor.api.string(at) // Get string at location
|
|
789
|
-
* ```;
|
|
790
|
-
*/
|
|
791
|
-
string: OmitFirst<typeof getEditorString>;
|
|
792
|
-
/**
|
|
793
|
-
* Convert a range into a non-hanging one.
|
|
794
|
-
*
|
|
795
|
-
* A "hanging" range is one created by the browser's "triple-click" selection
|
|
796
|
-
* behavior. When triple-clicking a block, the browser selects from the start
|
|
797
|
-
* of that block to the start of the _next_ block. The range thus "hangs over"
|
|
798
|
-
* into the next block. If `unhangRange` is given such a range, it moves the
|
|
799
|
-
* end backwards until it's in a non-empty text node that precedes the hanging
|
|
800
|
-
* block.
|
|
801
|
-
*
|
|
802
|
-
* Note that `unhangRange` is designed for the specific purpose of fixing
|
|
803
|
-
* triple-clicked blocks, and therefore currently has a number of caveats:
|
|
804
|
-
*
|
|
805
|
-
* - It does not modify the start of the range; only the end. For example, it
|
|
806
|
-
* does not "unhang" a selection that starts at the end of a previous
|
|
807
|
-
* block.
|
|
808
|
-
* - It only does anything if the start block is fully selected. For example, it
|
|
809
|
-
* does not handle ranges created by double-clicking the end of a paragraph
|
|
810
|
-
* (which browsers treat by selecting from the end of that paragraph to the
|
|
811
|
-
* start of the next).
|
|
812
|
-
*/
|
|
813
|
-
unhangRange: OmitFirst<typeof unhangRange$1>;
|
|
814
|
-
/** Get the matching ancestor above a location in the document. */
|
|
815
|
-
above: <N$1 extends AncestorIn<V>>(options?: EditorAboveOptions$1<V>) => NodeEntry$2<N$1> | undefined;
|
|
816
|
-
/** Get the first node at a location. */
|
|
817
|
-
first: <N$1 extends DescendantIn$1<V>>(at: At) => NodeEntry$2<N$1> | undefined;
|
|
818
|
-
/** Get the fragment at a location. */
|
|
819
|
-
fragment: <N$1 extends ElementOrTextIn<V>>(at: At) => N$1[] | undefined;
|
|
820
|
-
/** Check if a path exists in the editor. */
|
|
821
|
-
hasPath: (path: Path$2) => boolean;
|
|
822
|
-
/** Get the last node at a location. */
|
|
823
|
-
last: <N$1 extends DescendantIn$1<V>>(at: At, options?: EditorLastOptions) => NodeEntry$2<N$1> | undefined;
|
|
824
|
-
/** Get the leaf text node at a location. */
|
|
825
|
-
leaf: <N$1 extends TextIn<V>>(at: At, options?: EditorLeafOptions) => NodeEntry$2<N$1> | undefined;
|
|
826
|
-
/** Iterate through all of the levels at a location. */
|
|
827
|
-
levels: <N$1 extends NodeIn<V>>(options?: EditorLevelsOptions<V>) => Generator<NodeEntry$2<N$1>, void, undefined>;
|
|
828
|
-
/** Get the marks that would be added to text at the current selection. */
|
|
829
|
-
marks: () => MarksIn<V> | null;
|
|
830
|
-
/**
|
|
831
|
-
* Get the matching node in the branch of the document after a location.
|
|
832
|
-
*
|
|
833
|
-
* Note: To find the next Point, and not the next Node, use the `Editor.after`
|
|
834
|
-
* method
|
|
835
|
-
*/
|
|
836
|
-
next: <N$1 extends DescendantIn$1<V>>(options?: EditorNextOptions<V>) => NodeEntry$2<N$1> | undefined;
|
|
837
|
-
/**
|
|
838
|
-
* Get the node at a location or find the first node that matches options.
|
|
839
|
-
*
|
|
840
|
-
* @example
|
|
841
|
-
* ```ts
|
|
842
|
-
* editor.api.node([0]) // Get node at path [0]
|
|
843
|
-
* editor.api.node({ at: [], id: '1' }) // Find first node with id '1'
|
|
844
|
-
* editor.api.node({ at: path, block: true }) // Find first block at path
|
|
845
|
-
* ```;
|
|
846
|
-
*/
|
|
847
|
-
node: <N$1 extends DescendantIn$1<V>>(atOrOptions: AtOrDescendant | EditorNodesOptions<V>, nodeOptions?: EditorNodeOptions) => NodeEntry$2<N$1> | undefined;
|
|
848
|
-
/**
|
|
849
|
-
* At any given `Location` or `Span` in the editor provided by `at` (default
|
|
850
|
-
* is the current selection), the method returns a Generator of `NodeEntry`
|
|
851
|
-
* objects that represent the nodes that include `at`. At the top of the
|
|
852
|
-
* hierarchy is the `Editor` object itself.
|
|
853
|
-
*/
|
|
854
|
-
nodes: <N$1 extends DescendantIn$1<V>>(options?: EditorNodesOptions<V>) => Generator<NodeEntry$2<N$1>, void, undefined>;
|
|
855
|
-
/** Get the parent node of a location. */
|
|
856
|
-
parent: <N$1 extends AncestorIn<V>>(at: At, options?: EditorParentOptions) => NodeEntry$2<N$1> | undefined;
|
|
857
|
-
/**
|
|
858
|
-
* Get the matching node in the branch of the document before a location.
|
|
859
|
-
*
|
|
860
|
-
* Note: To find the previous Point, and not the previous Node, use the
|
|
861
|
-
* `Editor.before` method
|
|
862
|
-
*/
|
|
863
|
-
previous: <N$1 extends DescendantIn$1<V>>(options?: EditorPreviousOptions<V>) => NodeEntry$2<N$1> | undefined;
|
|
864
|
-
/** Match a void node in the current branch of the editor. */
|
|
865
|
-
void: <N$1 extends ElementIn<V>>(options?: EditorVoidOptions) => NodeEntry$2<N$1> | undefined;
|
|
866
|
-
} & {
|
|
867
|
-
findDocumentOrShadowRoot: OmitFirst<typeof findDocumentOrShadowRoot>;
|
|
868
|
-
/** Get the target range from a DOM `event` */
|
|
869
|
-
findEventRange: OmitFirst<typeof findEventRange>;
|
|
870
|
-
/**
|
|
871
|
-
* Find a key for a Slate node. Returns an instance of `Key` which looks like
|
|
872
|
-
* `{ id: string }`
|
|
873
|
-
*/
|
|
874
|
-
findKey: OmitFirst<typeof findKey>;
|
|
875
|
-
getWindow: OmitFirst<typeof getWindow>;
|
|
876
|
-
/** Check if a DOM node is within the editor */
|
|
877
|
-
hasDOMNode: OmitFirst<typeof hasDOMNode>;
|
|
878
|
-
hasRange: OmitFirst<typeof hasRange>;
|
|
879
|
-
/** Check if the user is currently composing inside the editor */
|
|
880
|
-
isComposing: OmitFirst<typeof isComposing>;
|
|
881
|
-
/** Check if the editor is focused */
|
|
882
|
-
isFocused: OmitFirst<typeof isFocused>;
|
|
883
|
-
/** Check if the editor is in read-only mode */
|
|
884
|
-
isReadOnly: OmitFirst<typeof isReadOnly>;
|
|
885
|
-
/** Check if the target is inside a non-readonly void element. */
|
|
886
|
-
isTargetInsideNonReadonlyVoid: OmitFirst<typeof isTargetInsideNonReadonlyVoid>;
|
|
887
|
-
/** Find the native DOM element from a Slate node */
|
|
888
|
-
toDOMNode: OmitFirst<typeof toDOMNode>;
|
|
889
|
-
/** Find a native DOM selection point from a Slate point */
|
|
890
|
-
toDOMPoint: OmitFirst<typeof toDOMPoint>;
|
|
891
|
-
/** Find a native DOM range from a Slate `range` */
|
|
892
|
-
toDOMRange: OmitFirst<typeof toDOMRange>;
|
|
893
|
-
/** Find a Slate point from a DOM selection's `domNode` and `domOffset`. */
|
|
894
|
-
toSlatePoint: OmitFirst<typeof toSlatePoint>;
|
|
895
|
-
/** Find a Slate range from a DOM range or selection. */
|
|
896
|
-
toSlateRange: OmitFirst<typeof toSlateRange>;
|
|
897
|
-
/**
|
|
898
|
-
* Find the path of Slate node. If DOM node is not found, it will use
|
|
899
|
-
* `findNodePath` (traversal method).
|
|
900
|
-
*/
|
|
901
|
-
findPath: (node: TNode$1, options?: EditorFindPathOptions) => Path$2 | undefined;
|
|
902
|
-
hasEditableTarget: (target: EventTarget | null) => target is Node;
|
|
903
|
-
hasSelectableTarget: (target: EventTarget | null) => target is Node;
|
|
904
|
-
hasTarget: (target: EventTarget | null) => target is Node;
|
|
905
|
-
/** Find a Slate node from a native DOM `element` */
|
|
906
|
-
toSlateNode: <N$1 extends NodeIn<V>>(domNode: Parameters<typeof toSlateNode>[1]) => N$1 | undefined;
|
|
907
|
-
} & {
|
|
908
|
-
/** Get the merge flag's current value. */
|
|
909
|
-
isMerging: OmitFirst<typeof HistoryApi.isMerging>;
|
|
910
|
-
/** Get the saving flag's current value. */
|
|
911
|
-
isSaving: OmitFirst<typeof HistoryApi.isSaving>;
|
|
912
|
-
isSplittingOnce: OmitFirst<typeof HistoryApi.isSplittingOnce>;
|
|
913
|
-
} & {
|
|
914
|
-
create: {
|
|
915
|
-
/** Default block factory. */
|
|
916
|
-
block: (node?: Partial<TElement$1>, path?: Path$2) => TElement$1;
|
|
917
|
-
/** Default value factory. */
|
|
918
|
-
value: () => Value$1;
|
|
919
|
-
};
|
|
920
|
-
/**
|
|
921
|
-
* Check if a location (point/range) is at a specific position.
|
|
922
|
-
*
|
|
923
|
-
* @example
|
|
924
|
-
* ```ts
|
|
925
|
-
* // For ranges:
|
|
926
|
-
* editor.api.isAt({ text: true }) // Check if range is in single text node
|
|
927
|
-
* editor.api.isAt({ block: true }) // Check if range is in single block
|
|
928
|
-
* editor.api.isAt({ blocks: true }) // Check if range is across multiple blocks
|
|
929
|
-
* editor.api.isAt({ start: true }) // Check if range starts at block start
|
|
930
|
-
* editor.api.isAt({ end: true }) // Check if range ends at block end
|
|
931
|
-
*
|
|
932
|
-
* // For points:
|
|
933
|
-
* editor.api.isAt({ word: true }) // Check relative to word boundaries
|
|
934
|
-
* editor.api.isAt({ start: true }) // Check if at start
|
|
935
|
-
* editor.api.isAt({ end: true }) // Check if at end
|
|
936
|
-
* ```;
|
|
937
|
-
*/
|
|
938
|
-
isAt: OmitFirst<typeof isAt>;
|
|
939
|
-
/** Check if a node at a location is a Text node */
|
|
940
|
-
isText: OmitFirst<typeof isText$1>;
|
|
941
|
-
/**
|
|
942
|
-
* Scroll the editor to bring a target point into view.
|
|
943
|
-
*
|
|
944
|
-
* @param target - The point to scroll into view
|
|
945
|
-
* @param options - Scroll options
|
|
946
|
-
*/
|
|
947
|
-
scrollIntoView: OmitFirst<typeof scrollIntoView>;
|
|
948
|
-
/**
|
|
949
|
-
* Check if any node at a location (default: selection) matches the given
|
|
950
|
-
* criteria
|
|
951
|
-
*/
|
|
952
|
-
some: OmitFirst<typeof some>;
|
|
953
|
-
/**
|
|
954
|
-
* Get the block at a location or find the first block that matches options.
|
|
955
|
-
* If `above` is true, get the block above the location, similar to
|
|
956
|
-
* `editor.api.above({ block: true })`. If `highest` is true, get the highest
|
|
957
|
-
* block at the location.
|
|
958
|
-
*
|
|
959
|
-
* @example
|
|
960
|
-
* ```ts
|
|
961
|
-
* editor.api.block() // Get block above selection
|
|
962
|
-
* editor.api.block({ above: true }) // Get block above selection
|
|
963
|
-
* editor.api.block({ at: [0, 0] }) // Get block at [0, 0]
|
|
964
|
-
* editor.api.block({ at: [0, 0], above: true }) // Get block at [0]
|
|
965
|
-
* editor.api.block({ highest: true }) // Get highest block at selection
|
|
966
|
-
* ```;
|
|
967
|
-
*/
|
|
968
|
-
block: <N$1 extends ElementIn<V>>(options?: EditorBlockOptions<V>) => NodeEntry$2<N$1> | undefined;
|
|
969
|
-
/** Returns all matching blocks. */
|
|
970
|
-
blocks: <N$1 extends ElementIn<V>>(options?: EditorNodesOptions<V>) => NodeEntry$2<N$1>[];
|
|
971
|
-
/** Returns the first matching descendant. */
|
|
972
|
-
descendant: <N$1 extends DescendantIn$1<V>>(options: EditorNodesOptions<V>) => NodeEntry$2<N$1> | undefined;
|
|
973
|
-
/** Returns the edge blocks above a location (default: selection). */
|
|
974
|
-
edgeBlocks: <N1 extends ElementIn<V>, N2 extends ElementIn<V> = N1>(options?: EditorAboveOptions$1<V>) => [NodeEntry$2<N1>, NodeEntry$2<N2>] | null;
|
|
975
|
-
/** Check if the selection is collapsed */
|
|
976
|
-
isCollapsed: () => boolean;
|
|
977
|
-
/** Check if selection is at editor end */
|
|
978
|
-
isEditorEnd: () => boolean;
|
|
979
|
-
/** Check if the selection is expanded */
|
|
980
|
-
isExpanded: () => boolean;
|
|
981
|
-
/** Check if a value is an inline `Element` object. */
|
|
982
|
-
isInline: <N$1 extends DescendantIn$1<V>>(element: N$1) => boolean;
|
|
983
|
-
/** Check if a value is a selectable `Element` object. */
|
|
984
|
-
isSelectable: <N$1 extends ElementIn<V>>(element: N$1) => boolean;
|
|
985
|
-
/** Returns the selection mark value by key. */
|
|
986
|
-
mark: <K$1 extends keyof MarksIn<V>>(key: K$1) => MarksIn<V>[K$1] | null | undefined;
|
|
987
|
-
/** Returns the range spanning the given node entries. */
|
|
988
|
-
nodesRange: (nodes: NodeEntry$2[]) => TRange$1 | undefined;
|
|
989
|
-
/**
|
|
990
|
-
* Get a property value from a list of nodes. Returns undefined if the
|
|
991
|
-
* property value is not consistent across all nodes.
|
|
992
|
-
*/
|
|
993
|
-
prop: (options: EditorPropOptions<V>) => string | undefined;
|
|
994
|
-
};
|
|
995
|
-
type EditorBeforeOptions = {
|
|
996
|
-
distance?: number;
|
|
997
|
-
} & QueryTextUnit & QueryVoids & {
|
|
998
|
-
/**
|
|
999
|
-
* If true, get the point after the matching point. If false, get the
|
|
1000
|
-
* matching point.
|
|
1001
|
-
*/
|
|
1002
|
-
afterMatch?: boolean;
|
|
1003
|
-
/** Return block start point if no match found */
|
|
1004
|
-
matchBlockStart?: boolean;
|
|
1005
|
-
/**
|
|
1006
|
-
* If true, `matchString` will be interpreted as regex expression(s).
|
|
1007
|
-
* Otherwise, it will be compared by string equality.
|
|
1008
|
-
*
|
|
1009
|
-
* @default false
|
|
1010
|
-
*/
|
|
1011
|
-
matchByRegex?: boolean;
|
|
1012
|
-
/** Lookup before the location for `matchString`. */
|
|
1013
|
-
matchString?: string[] | string;
|
|
1014
|
-
/**
|
|
1015
|
-
* If true, lookup until the start of the editor value. If false, lookup
|
|
1016
|
-
* until the first invalid character.
|
|
1017
|
-
*/
|
|
1018
|
-
skipInvalid?: boolean;
|
|
1019
|
-
/** Lookup before the location until this predicate is true */
|
|
1020
|
-
match?: (value: {
|
|
1021
|
-
at: At;
|
|
1022
|
-
beforePoint: Point;
|
|
1023
|
-
beforeString: string;
|
|
1024
|
-
}) => boolean;
|
|
1025
|
-
};
|
|
1026
|
-
type EditorBlockOptions<V extends Value$1 = Value$1> = Omit<EditorNodesOptions<V>, 'block' | 'mode'> & {
|
|
1027
|
-
/**
|
|
1028
|
-
* If true, get the block above the location. This has no effect when `at` is
|
|
1029
|
-
* not a block path.
|
|
1030
|
-
*/
|
|
1031
|
-
above?: boolean;
|
|
1032
|
-
/**
|
|
1033
|
-
* If true, get the highest block at the location. This will return the block
|
|
1034
|
-
* at the root level (path length 1).
|
|
1035
|
-
*/
|
|
1036
|
-
highest?: boolean;
|
|
1037
|
-
};
|
|
1038
|
-
type EditorElementReadOnlyOptions = {
|
|
1039
|
-
at?: TLocation;
|
|
1040
|
-
} & QueryMode & QueryVoids;
|
|
1041
|
-
type EditorEmptyOptions = {
|
|
1042
|
-
/** Check if text after selection is empty */
|
|
1043
|
-
after?: boolean;
|
|
1044
|
-
/** Check if block above location is empty */
|
|
1045
|
-
block?: boolean;
|
|
1046
|
-
} & Omit<EditorNodesOptions, 'at' | 'block'>;
|
|
1047
|
-
type EditorEndOptions = {
|
|
1048
|
-
/** Get the end point of the previous node */
|
|
1049
|
-
previous?: boolean;
|
|
1050
|
-
};
|
|
1051
|
-
type EditorFindPathOptions = Omit<EditorNodesOptions<Value$1>, 'at' | 'block' | 'match'>;
|
|
1052
|
-
type EditorFragmentOptions = {
|
|
1053
|
-
/** Types of container nodes to unwrap */
|
|
1054
|
-
unwrap?: string[];
|
|
1055
|
-
};
|
|
1056
|
-
type EditorIsSelectedOptions = {
|
|
1057
|
-
/** Check if selection contains the entire path range */
|
|
1058
|
-
contains?: boolean;
|
|
1059
|
-
};
|
|
1060
|
-
type EditorLastOptions = {
|
|
1061
|
-
/** Get last node at this level (0-based). */
|
|
1062
|
-
level?: number;
|
|
1063
|
-
};
|
|
1064
|
-
type EditorLeafOptions = {
|
|
1065
|
-
depth?: number;
|
|
1066
|
-
edge?: LeafEdge;
|
|
1067
|
-
};
|
|
1068
|
-
type EditorLevelsOptions<V extends Value$1 = Value$1> = {
|
|
1069
|
-
reverse?: boolean;
|
|
1070
|
-
} & QueryOptions<V> & QueryVoids;
|
|
1071
|
-
type EditorNextOptions<V extends Value$1 = Value$1> = QueryOptions<V> & QueryVoids & {
|
|
1072
|
-
/**
|
|
1073
|
-
* Determines where to start traversing from:
|
|
1074
|
-
*
|
|
1075
|
-
* - `'after'` (default): Start from the point after the current location
|
|
1076
|
-
* - `'child'`: Start from the first child of the current path. `at` must be a
|
|
1077
|
-
* path.
|
|
1078
|
-
*/
|
|
1079
|
-
from?: 'after' | 'child';
|
|
1080
|
-
/**
|
|
1081
|
-
* - `'all'` (default if `from` is `child`): Return all matching nodes.
|
|
1082
|
-
* - `'highest'`: in a hierarchy of nodes, only return the highest level
|
|
1083
|
-
* matching nodes
|
|
1084
|
-
* - `'lowest'` (default if `from` is `after`): in a hierarchy of nodes, only
|
|
1085
|
-
* return the lowest level matching nodes
|
|
1086
|
-
*/
|
|
1087
|
-
mode?: 'all' | 'highest' | 'lowest';
|
|
1088
|
-
};
|
|
1089
|
-
type EditorNodeOptions = {
|
|
1090
|
-
depth?: number;
|
|
1091
|
-
edge?: LeafEdge;
|
|
1092
|
-
};
|
|
1093
|
-
type EditorNodesOptions<V extends Value$1 = Value$1> = {
|
|
1094
|
-
/** Where to start at. @default editor.selection */
|
|
1095
|
-
at?: At | Span$1;
|
|
1096
|
-
ignoreNonSelectable?: boolean;
|
|
1097
|
-
reverse?: boolean;
|
|
1098
|
-
universal?: boolean;
|
|
1099
|
-
} & Omit<QueryOptions<V>, 'at'> & QueryMode & QueryVoids;
|
|
1100
|
-
type EditorNormalizeOptions = {
|
|
1101
|
-
force?: boolean;
|
|
1102
|
-
operation?: Operation$1;
|
|
1103
|
-
};
|
|
1104
|
-
type EditorParentOptions = {
|
|
1105
|
-
depth?: number;
|
|
1106
|
-
edge?: LeafEdge;
|
|
1107
|
-
};
|
|
1108
|
-
type EditorPositionsOptions = {
|
|
1109
|
-
ignoreNonSelectable?: boolean;
|
|
1110
|
-
/**
|
|
1111
|
-
* When `true` returns the positions in reverse order. In the case of the
|
|
1112
|
-
* `unit` being `word`, the actual returned positions are different (i.e. we
|
|
1113
|
-
* will get the start of a word in reverse instead of the end).
|
|
1114
|
-
*/
|
|
1115
|
-
reverse?: boolean;
|
|
1116
|
-
} & QueryAt & QueryVoids & QueryTextUnit;
|
|
1117
|
-
type EditorPreviousOptions<V extends Value$1 = Value$1> = QueryOptions<V> & QueryVoids & {
|
|
1118
|
-
/**
|
|
1119
|
-
* Determines where to start traversing from:
|
|
1120
|
-
*
|
|
1121
|
-
* - `'before'` (default): Start from the point before the current location
|
|
1122
|
-
* - `'parent'`: Start from the parent of the current location
|
|
1123
|
-
*/
|
|
1124
|
-
from?: 'before' | 'parent';
|
|
1125
|
-
/**
|
|
1126
|
-
* - `'all'`: Return all matching nodes
|
|
1127
|
-
* - `'highest'`: in a hierarchy of nodes, only return the highest level
|
|
1128
|
-
* matching nodes
|
|
1129
|
-
* - `'lowest'` (default): in a hierarchy of nodes, only return the lowest
|
|
1130
|
-
* level matching nodes
|
|
1131
|
-
*/
|
|
1132
|
-
mode?: 'all' | 'highest' | 'lowest';
|
|
1133
|
-
/** Get the previous sibling node */
|
|
1134
|
-
sibling?: boolean;
|
|
1135
|
-
};
|
|
1136
|
-
type EditorPropOptions<V extends Value$1 = Value$1> = {
|
|
1137
|
-
/** Nodes to get the property value from. */
|
|
1138
|
-
nodes: TElement$1[];
|
|
1139
|
-
/** Property key to get. */
|
|
1140
|
-
key?: string;
|
|
1141
|
-
/** Default value to return if property is not found. */
|
|
1142
|
-
defaultValue?: string;
|
|
1143
|
-
/**
|
|
1144
|
-
* - `'all'`: Get the property value from all nodes.
|
|
1145
|
-
* - `'block'`: Get the property value from the first block node.
|
|
1146
|
-
* - `'text'`: Get the property value from the first text node.
|
|
1147
|
-
*/
|
|
1148
|
-
mode?: 'all' | 'block' | 'text';
|
|
1149
|
-
/** Function to get the property value from a node. */
|
|
1150
|
-
getProp?: (node: DescendantIn$1<V>) => any;
|
|
1151
|
-
};
|
|
1152
|
-
type EditorStartOptions = {
|
|
1153
|
-
/** Get the start point of the next node */
|
|
1154
|
-
next?: boolean;
|
|
1155
|
-
};
|
|
1156
|
-
type EditorStringOptions = QueryVoids;
|
|
1157
|
-
type EditorUnhangRangeOptions = {
|
|
1158
|
-
/**
|
|
1159
|
-
* When true, unhang a range of length 1 so both edges are in the same text
|
|
1160
|
-
* node. This is useful for handling ranges created by character-level
|
|
1161
|
-
* operations.
|
|
1162
|
-
*/
|
|
1163
|
-
character?: boolean;
|
|
1164
|
-
/** @default true */
|
|
1165
|
-
unhang?: boolean;
|
|
1166
|
-
/** Allow placing the end of the selection in a void node */
|
|
1167
|
-
voids?: boolean;
|
|
1168
|
-
};
|
|
1169
|
-
type EditorVoidOptions = QueryAt & QueryMode & QueryVoids;
|
|
1170
|
-
type QueryAt = {
|
|
1171
|
-
/** Where to start at. @default editor.selection */
|
|
1172
|
-
at?: At;
|
|
1173
|
-
};
|
|
1174
|
-
type QueryMode = {
|
|
1175
|
-
/**
|
|
1176
|
-
* - `'all'` (default): Return all matching nodes
|
|
1177
|
-
* - `'highest'`: in a hierarchy of nodes, only return the highest level
|
|
1178
|
-
* matching nodes
|
|
1179
|
-
* - `'lowest'`: in a hierarchy of nodes, only return the lowest level matching
|
|
1180
|
-
* nodes
|
|
1181
|
-
*/
|
|
1182
|
-
mode?: 'all' | 'highest' | 'lowest';
|
|
1183
|
-
};
|
|
1184
|
-
type QueryOptions<V extends Value$1 = Value$1> = {
|
|
1185
|
-
/** Match the node by id. `true` will match all nodes with an id. */
|
|
1186
|
-
id?: boolean | string;
|
|
1187
|
-
/** Match block nodes. */
|
|
1188
|
-
block?: boolean;
|
|
1189
|
-
/** When true, match only empty nodes. When false, match only non-empty nodes */
|
|
1190
|
-
empty?: boolean;
|
|
1191
|
-
/** Match the node. */
|
|
1192
|
-
match?: Predicate<NodeIn<V>>;
|
|
1193
|
-
/** When true, match only text nodes */
|
|
1194
|
-
text?: boolean;
|
|
1195
|
-
} & QueryAt;
|
|
1196
|
-
type QueryTextUnit = {
|
|
1197
|
-
/**
|
|
1198
|
-
* - `offset`: Moves to the next offset `Point`. It will include the `Point` at
|
|
1199
|
-
* the end of a `Text` object and then move onto the first `Point` (at the
|
|
1200
|
-
* 0th offset) of the next `Text` object. This may be counter-intuitive
|
|
1201
|
-
* because the end of a `Text` and the beginning of the next `Text` might be
|
|
1202
|
-
* thought of as the same position.
|
|
1203
|
-
* - `character`: Moves to the next `character` but is not always the next
|
|
1204
|
-
* `index` in the string. This is because Unicode encodings may require
|
|
1205
|
-
* multiple bytes to create one character. Unlike `offset`, `character` will
|
|
1206
|
-
* not count the end of a `Text` and the beginning of the next `Text` as
|
|
1207
|
-
* separate positions to return. Warning: The character offsets for Unicode
|
|
1208
|
-
* characters does not appear to be reliable in some cases like a Smiley
|
|
1209
|
-
* Emoji will be identified as 2 characters.
|
|
1210
|
-
* - `word`: Moves to the position immediately after the next `word`. In
|
|
1211
|
-
* `reverse` mode, moves to the position immediately before the previous
|
|
1212
|
-
* `word`.
|
|
1213
|
-
* - `line` | `block`: Starts at the beginning position and then the position at
|
|
1214
|
-
* the end of the block. Then starts at the beginning of the next block and
|
|
1215
|
-
* then the end of the next block.
|
|
1216
|
-
*/
|
|
1217
|
-
unit?: TextUnitAdjustment;
|
|
1218
|
-
};
|
|
1219
|
-
type QueryVoids = {
|
|
1220
|
-
/** When `true` include void Nodes. */
|
|
1221
|
-
voids?: boolean;
|
|
1222
|
-
};
|
|
1223
|
-
//#endregion
|
|
1224
|
-
//#region src/internal/dom-editor/blur.d.ts
|
|
1225
|
-
declare const blur: (editor: Editor$1) => void;
|
|
1226
|
-
//#endregion
|
|
1227
|
-
//#region src/internal/dom-editor/deselectDOM.d.ts
|
|
1228
|
-
declare const deselectDOM: (editor: Editor$1) => void;
|
|
1229
|
-
//#endregion
|
|
1230
|
-
//#region src/internal/dom-editor/focus.d.ts
|
|
1231
|
-
declare const focus$1: (editor: Editor$1, {
|
|
1232
|
-
at,
|
|
1233
|
-
edge,
|
|
1234
|
-
retries
|
|
1235
|
-
}?: FocusOptions) => void;
|
|
1236
|
-
//#endregion
|
|
1237
|
-
//#region src/internal/editor/addMark.d.ts
|
|
1238
|
-
declare const addMark$1: (editor: Editor$1, key: string, value: any) => void;
|
|
1239
|
-
//#endregion
|
|
1240
|
-
//#region src/internal/editor/deleteBackward.d.ts
|
|
1241
|
-
declare const deleteBackward$1: (editor: Editor$1, unit?: TextUnit) => void;
|
|
1242
|
-
//#endregion
|
|
1243
|
-
//#region src/internal/editor/deleteForward.d.ts
|
|
1244
|
-
declare const deleteForward$1: (editor: Editor$1, unit?: TextUnit) => void;
|
|
1245
|
-
//#endregion
|
|
1246
|
-
//#region src/internal/editor/deleteFragment.d.ts
|
|
1247
|
-
declare const deleteFragment$1: (editor: Editor$1, options?: EditorFragmentDeletionOptions) => void;
|
|
1248
|
-
//#endregion
|
|
1249
|
-
//#region src/internal/editor/insertBreak.d.ts
|
|
1250
|
-
declare const insertBreak$1: (editor: Editor$1) => void;
|
|
1251
|
-
//#endregion
|
|
1252
|
-
//#region src/internal/editor/withoutNormalizing.d.ts
|
|
1253
|
-
declare const withoutNormalizing$1: (editor: Editor$1, fn: () => boolean | void) => boolean;
|
|
1254
|
-
//#endregion
|
|
1255
|
-
//#region src/internal/transforms/collapseSelection.d.ts
|
|
1256
|
-
declare const collapseSelection: (editor: Editor$1, options?: SelectionCollapseOptions) => void;
|
|
1257
|
-
//#endregion
|
|
1258
|
-
//#region src/internal/transforms/deleteText.d.ts
|
|
1259
|
-
declare const deleteText: <E extends Editor$1>(editor: E, options?: DeleteTextOptions) => void;
|
|
1260
|
-
//#endregion
|
|
1261
|
-
//#region src/internal/transforms/moveSelection.d.ts
|
|
1262
|
-
declare const moveSelection: (editor: Editor$1, options?: SelectionMoveOptions) => void;
|
|
1263
|
-
//#endregion
|
|
1264
|
-
//#region src/internal/transforms/select.d.ts
|
|
1265
|
-
declare const select$1: (editor: Editor$1, target?: At, options?: SelectOptions) => void;
|
|
1266
|
-
//#endregion
|
|
1267
|
-
//#region src/internal/transforms/setPoint.d.ts
|
|
1268
|
-
declare const setPoint$1: (editor: Editor$1, props: Partial<Point>, options?: SelectionSetPointOptions) => void;
|
|
1269
|
-
//#endregion
|
|
1270
|
-
//#region src/internal/transforms/setSelection.d.ts
|
|
1271
|
-
declare const setSelection$1: (editor: Editor$1, props: Partial<TRange$1>) => void;
|
|
1272
|
-
//#endregion
|
|
1273
|
-
//#region src/internal/transforms-extension/addMarks.d.ts
|
|
1274
|
-
declare const addMarks: (editor: Editor$1, marks: EditorMarks, {
|
|
1275
|
-
remove
|
|
1276
|
-
}?: AddMarksOptions) => void;
|
|
1277
|
-
//#endregion
|
|
1278
|
-
//#region src/internal/transforms-extension/duplicateNodes.d.ts
|
|
1279
|
-
declare const duplicateNodes: (editor: Editor$1, {
|
|
1280
|
-
block,
|
|
1281
|
-
nodes,
|
|
1282
|
-
...options
|
|
1283
|
-
}?: DuplicateNodesOptions) => void;
|
|
1284
|
-
//#endregion
|
|
1285
|
-
//#region src/internal/transforms-extension/removeMarks.d.ts
|
|
1286
|
-
declare const removeMarks: (editor: Editor$1, keys?: string[] | string | null, {
|
|
1287
|
-
at,
|
|
1288
|
-
shouldChange,
|
|
1289
|
-
...options
|
|
1290
|
-
}?: RemoveMarksOptions) => void;
|
|
1291
|
-
//#endregion
|
|
1292
|
-
//#region src/internal/transforms-extension/reset.d.ts
|
|
1293
|
-
declare const reset: (editor: Editor$1, options?: ResetOptions) => void;
|
|
1294
|
-
//#endregion
|
|
1295
|
-
//#region src/internal/transforms-extension/toggleBlock.d.ts
|
|
1296
|
-
declare const toggleBlock: (editor: Editor$1, type: string, {
|
|
1297
|
-
defaultType: defaultTypeProp,
|
|
1298
|
-
someOptions,
|
|
1299
|
-
wrap,
|
|
1300
|
-
...options
|
|
1301
|
-
}?: ToggleBlockOptions) => void;
|
|
1302
|
-
//#endregion
|
|
1303
|
-
//#region src/internal/transforms-extension/toggleMark.d.ts
|
|
1304
|
-
/** Add or remove mark in the selection. */
|
|
1305
|
-
declare const toggleMark: (editor: Editor$1, key: string, {
|
|
1306
|
-
remove
|
|
1307
|
-
}?: ToggleMarkOptions) => void;
|
|
1308
|
-
//#endregion
|
|
1309
|
-
//#region src/interfaces/editor/editor-transforms.d.ts
|
|
1310
|
-
type AddMarksOptions = {
|
|
1311
|
-
/** Marks to remove before adding new ones */
|
|
1312
|
-
remove?: string[] | string;
|
|
1313
|
-
};
|
|
1314
|
-
type DeleteTextOptions = {
|
|
1315
|
-
distance?: number;
|
|
1316
|
-
hanging?: boolean;
|
|
1317
|
-
reverse?: boolean;
|
|
1318
|
-
unit?: TextUnit;
|
|
1319
|
-
} & QueryAt & QueryVoids & QueryTextUnit;
|
|
1320
|
-
type DuplicateNodesOptions<V extends Value$1 = Value$1> = {
|
|
1321
|
-
/** Location to get nodes from and insert after. Default: selection */
|
|
1322
|
-
at?: At;
|
|
1323
|
-
/** If true, duplicate blocks above location. Ignored if `nodes` is provided */
|
|
1324
|
-
block?: boolean;
|
|
1325
|
-
/** Specific nodes to duplicate. If provided, ignores `block` option */
|
|
1326
|
-
nodes?: NodeEntry$2[];
|
|
1327
|
-
} & Omit<InsertNodesOptions<V>, 'at' | 'block'>;
|
|
1328
|
-
type EditorTransforms$1<V extends Value$1 = Value$1> = {
|
|
1329
|
-
/**
|
|
1330
|
-
* Add a custom property to the leaf text nodes in the current selection.
|
|
1331
|
-
*
|
|
1332
|
-
* If the selection is currently collapsed, the marks will be added to the
|
|
1333
|
-
* `editor.marks` property instead, and applied when text is inserted next.
|
|
1334
|
-
*/
|
|
1335
|
-
addMark: OmitFirst<typeof addMark$1>;
|
|
1336
|
-
/**
|
|
1337
|
-
* Add multiple marks to the leaf text nodes in the current selection. If
|
|
1338
|
-
* marks with the same keys exist, they will be removed first.
|
|
1339
|
-
*
|
|
1340
|
-
* @example
|
|
1341
|
-
* ```ts
|
|
1342
|
-
* editor.tf.addMarks({ bold: true, italic: true })
|
|
1343
|
-
* editor.tf.addMarks({ bold: subscript }, { remove: 'superscript' })
|
|
1344
|
-
* editor.tf.addMarks({ bold: true }, { remove: ['italic', 'underline'] })
|
|
1345
|
-
* ```;
|
|
1346
|
-
*/
|
|
1347
|
-
addMarks: OmitFirst<typeof addMarks>;
|
|
1348
|
-
/** Delete content in the editor backward from the current selection. */
|
|
1349
|
-
deleteBackward: OmitFirst<typeof deleteBackward$1>;
|
|
1350
|
-
/** Delete content in the editor forward from the current selection. */
|
|
1351
|
-
deleteForward: OmitFirst<typeof deleteForward$1>;
|
|
1352
|
-
/** Delete the content of the current selection. */
|
|
1353
|
-
deleteFragment: OmitFirst<typeof deleteFragment$1>;
|
|
1354
|
-
/**
|
|
1355
|
-
* Duplicate nodes at a location. By default duplicates nodes at the current
|
|
1356
|
-
* selection. When `block: true`, duplicates the blocks above the location.
|
|
1357
|
-
*/
|
|
1358
|
-
duplicateNodes: OmitFirst<typeof duplicateNodes>;
|
|
1359
|
-
/** Insert a block break at the current selection. */
|
|
1360
|
-
insertBreak: OmitFirst<typeof insertBreak$1>;
|
|
1361
|
-
/**
|
|
1362
|
-
* Remove marks from text nodes.
|
|
1363
|
-
*
|
|
1364
|
-
* - If `keys` is provided: removes specific mark(s) from text nodes
|
|
1365
|
-
* - If `at` is provided: removes from range
|
|
1366
|
-
* - If `at` is not provided and selection is expanded: removes marks only if
|
|
1367
|
-
* `keys` is provided
|
|
1368
|
-
* - If `at` is not provided and selection is collapsed: removes from
|
|
1369
|
-
* `editor.marks`
|
|
1370
|
-
*
|
|
1371
|
-
* - If `keys` is provided: removes specific mark(s)
|
|
1372
|
-
* - If `keys` is not provided: removes all marks
|
|
1373
|
-
*
|
|
1374
|
-
* If the selection is currently collapsed, the removal will be stored on
|
|
1375
|
-
* `editor.marks` and applied to the text inserted next.
|
|
1376
|
-
*
|
|
1377
|
-
* @example
|
|
1378
|
-
* ```ts
|
|
1379
|
-
* editor.tf.removeMarks() // Remove all marks from editor.marks
|
|
1380
|
-
* editor.tf.removeMarks('bold') // Remove bold mark at selection
|
|
1381
|
-
* editor.tf.removeMarks(['bold', 'italic']) // Remove multiple marks at selection
|
|
1382
|
-
* editor.tf.removeMarks('bold', { at: range }) // Remove bold in range
|
|
1383
|
-
* ```;
|
|
1384
|
-
*/
|
|
1385
|
-
removeMarks: OmitFirst<typeof removeMarks>;
|
|
1386
|
-
/**
|
|
1387
|
-
* Reset the editor state. Use `children: true` to only reset children without
|
|
1388
|
-
* clearing history and operations
|
|
1389
|
-
*/
|
|
1390
|
-
reset: OmitFirst<typeof reset>;
|
|
1391
|
-
/**
|
|
1392
|
-
* Toggle a block type. If wrap is true, wrap/unwrap the block in the
|
|
1393
|
-
* specified type. Otherwise, sets the block type directly.
|
|
1394
|
-
*
|
|
1395
|
-
* @example
|
|
1396
|
-
* ```ts
|
|
1397
|
-
* editor.tf.toggleBlock('blockquote') // Toggle blockquote
|
|
1398
|
-
* editor.tf.toggleBlock('list', { wrap: true }) // Toggle list wrapper
|
|
1399
|
-
* ```;
|
|
1400
|
-
*/
|
|
1401
|
-
toggleBlock: OmitFirst<typeof toggleBlock>;
|
|
1402
|
-
/**
|
|
1403
|
-
* Toggle a mark on the leaf text nodes in the current selection. If the mark
|
|
1404
|
-
* exists, it will be removed. Otherwise, it will be added.
|
|
1405
|
-
*
|
|
1406
|
-
* When adding a mark, you can specify marks to remove first using the
|
|
1407
|
-
* `remove` option. This is useful for mutually exclusive marks like
|
|
1408
|
-
* subscript/superscript.
|
|
1409
|
-
*
|
|
1410
|
-
* @example
|
|
1411
|
-
* ```ts
|
|
1412
|
-
* editor.tf.toggleMark('bold') // Toggle bold mark
|
|
1413
|
-
* editor.tf.toggleMark('subscript', { remove: 'superscript' }) // Add subscript, remove superscript
|
|
1414
|
-
* ```;
|
|
1415
|
-
*/
|
|
1416
|
-
toggleMark: OmitFirst<typeof toggleMark>;
|
|
1417
|
-
/**
|
|
1418
|
-
* Call a function, deferring normalization until after it completes
|
|
1419
|
-
*
|
|
1420
|
-
* @returns True if normalized.
|
|
1421
|
-
*/
|
|
1422
|
-
withoutNormalizing: OmitFirst<typeof withoutNormalizing$1>;
|
|
1423
|
-
/**
|
|
1424
|
-
* Handle `Escape`.
|
|
1425
|
-
*
|
|
1426
|
-
* @returns `true` if the event is handled, `false` otherwise.
|
|
1427
|
-
*/
|
|
1428
|
-
escape: () => boolean | undefined;
|
|
1429
|
-
/**
|
|
1430
|
-
* Insert of fragment of nodes at the specified location or (if not defined)
|
|
1431
|
-
* the current selection or (if not defined) the end of the document.
|
|
1432
|
-
*/
|
|
1433
|
-
insertFragment: <N$1 extends ElementOrTextIn<V>>(fragment: N$1[], options?: InsertFragmentOptions) => void;
|
|
1434
|
-
/**
|
|
1435
|
-
* Atomically insert `node` at the specified location or (if not defined) the
|
|
1436
|
-
* current selection or (if not defined) the end of the document.
|
|
1437
|
-
*/
|
|
1438
|
-
insertNode: <N$1 extends DescendantIn$1<V>>(node: N$1, options?: InsertNodesOptions<V>) => void;
|
|
1439
|
-
/**
|
|
1440
|
-
* Atomically inserts `nodes` at the specified location or (if not defined)
|
|
1441
|
-
* the current selection or (if not defined) the end of the document.
|
|
1442
|
-
*/
|
|
1443
|
-
insertNodes: <N$1 extends ElementOrTextIn<V>>(nodes: N$1 | N$1[], options?: InsertNodesOptions<V>) => void;
|
|
1444
|
-
/**
|
|
1445
|
-
* Insert a soft break at the current selection. If the selection is currently
|
|
1446
|
-
* expanded, delete it first.
|
|
1447
|
-
*/
|
|
1448
|
-
insertSoftBreak: () => void;
|
|
1449
|
-
/**
|
|
1450
|
-
* Lift nodes at the specified location upwards in the document tree. If
|
|
1451
|
-
* necessary, the parent node is split. If no location is specified, use the
|
|
1452
|
-
* selection.
|
|
1453
|
-
*/
|
|
1454
|
-
liftNodes: (options?: LiftNodesOptions<V>) => void;
|
|
1455
|
-
/**
|
|
1456
|
-
* Merge a node at the specified location with the previous node at the same
|
|
1457
|
-
* depth. If no location is specified, use the selection. Resulting empty
|
|
1458
|
-
* container nodes are removed.
|
|
1459
|
-
*/
|
|
1460
|
-
mergeNodes: (options?: MergeNodesOptions<V>) => void;
|
|
1461
|
-
/**
|
|
1462
|
-
* Handle `ArrowDown` and `ArrowUp` (reverse).
|
|
1463
|
-
*
|
|
1464
|
-
* @returns `true` if the event is handled, `false` otherwise.
|
|
1465
|
-
*/
|
|
1466
|
-
moveLine: (options: {
|
|
1467
|
-
reverse: boolean;
|
|
1468
|
-
}) => boolean | undefined;
|
|
1469
|
-
/**
|
|
1470
|
-
* Move the nodes from an origin to a destination. A destination must be
|
|
1471
|
-
* specified in the `options`. If no origin is specified, move the selection.
|
|
1472
|
-
*/
|
|
1473
|
-
moveNodes: (options: MoveNodesOptions<V>) => boolean | void;
|
|
1474
|
-
/** Normalize any dirty objects in the editor. */
|
|
1475
|
-
normalize: (options?: EditorNormalizeOptions) => void;
|
|
1476
|
-
/** Redo to the next saved state. */
|
|
1477
|
-
redo: () => void;
|
|
1478
|
-
/**
|
|
1479
|
-
* Remove a custom property from all of the leaf text nodes within non-void
|
|
1480
|
-
* nodes or void nodes that `editor.api.markableVoid()` allows in the current
|
|
1481
|
-
* selection.
|
|
1482
|
-
*
|
|
1483
|
-
* If the selection is currently collapsed, the removal will be stored on
|
|
1484
|
-
* `editor.marks` and applied to the text inserted next.
|
|
1485
|
-
*/
|
|
1486
|
-
removeMark: (key: string) => void;
|
|
1487
|
-
/**
|
|
1488
|
-
* Remove nodes at the specified location in the document. If no location is
|
|
1489
|
-
* specified, remove the nodes in the selection.
|
|
1490
|
-
*/
|
|
1491
|
-
removeNodes: (options?: RemoveNodesOptions<V>) => void;
|
|
1492
|
-
/**
|
|
1493
|
-
* Replace nodes at a location with new nodes.
|
|
1494
|
-
*
|
|
1495
|
-
* @example
|
|
1496
|
-
* ```ts
|
|
1497
|
-
* editor.tf.replaceNodes(node, { at }) // Replace node at location
|
|
1498
|
-
* editor.tf.replaceNodes(node, { at, select: true }) // Replace node then select
|
|
1499
|
-
* editor.tf.replaceNodes(node, { at, children: true }) // Replace children at location
|
|
1500
|
-
* ```;
|
|
1501
|
-
*/
|
|
1502
|
-
replaceNodes: <N$1 extends ElementOrTextIn<V>>(nodes: N$1 | N$1[], options?: ReplaceNodesOptions<V>) => void;
|
|
1503
|
-
/**
|
|
1504
|
-
* Handle `mod+a`.
|
|
1505
|
-
*
|
|
1506
|
-
* @returns `true` if the event is handled, `false` otherwise.
|
|
1507
|
-
*/
|
|
1508
|
-
selectAll: () => boolean | undefined;
|
|
1509
|
-
/**
|
|
1510
|
-
* Set properties of nodes at the specified location. If no location is
|
|
1511
|
-
* specified, use the selection.
|
|
1512
|
-
*
|
|
1513
|
-
* If `props` contains `undefined` values, the node's corresponding property
|
|
1514
|
-
* will also be set to `undefined` as opposed to ignored.
|
|
1515
|
-
*/
|
|
1516
|
-
setNodes: <N$1 extends DescendantIn$1<V>>(props: Partial<NodeProps<N$1>>, options?: SetNodesOptions<V>) => void;
|
|
1517
|
-
/**
|
|
1518
|
-
* Split nodes at the specified location. If no location is specified, split
|
|
1519
|
-
* the selection.
|
|
1520
|
-
*/
|
|
1521
|
-
splitNodes: (options?: SplitNodesOptions<V>) => void;
|
|
1522
|
-
/**
|
|
1523
|
-
* Handle `Tab`, `Shift+Tab` (reverse).
|
|
1524
|
-
*
|
|
1525
|
-
* @returns `true` if the event is handled, `false` otherwise.
|
|
1526
|
-
*/
|
|
1527
|
-
tab: (options: {
|
|
1528
|
-
reverse: boolean;
|
|
1529
|
-
}) => boolean | undefined;
|
|
1530
|
-
/** Undo to the previous saved state. */
|
|
1531
|
-
undo: () => void;
|
|
1532
|
-
/**
|
|
1533
|
-
* Unset properties of nodes at the specified location. If no location is
|
|
1534
|
-
* specified, use the selection.
|
|
1535
|
-
*/
|
|
1536
|
-
unsetNodes: <N$1 extends DescendantIn$1<V>>(props: (keyof NodeProps<N$1>)[] | keyof NodeProps<N$1>, options?: UnsetNodesOptions<V>) => void;
|
|
1537
|
-
/**
|
|
1538
|
-
* Unwrap nodes at the specified location. If necessary, the parent node is
|
|
1539
|
-
* split. If no location is specified, use the selection.
|
|
1540
|
-
*/
|
|
1541
|
-
unwrapNodes: (options?: UnwrapNodesOptions<V>) => void;
|
|
1542
|
-
/**
|
|
1543
|
-
* Wrap nodes at the specified location in the `element` container. If no
|
|
1544
|
-
* location is specified, wrap the selection.
|
|
1545
|
-
*/
|
|
1546
|
-
wrapNodes: <N$1 extends ElementIn<V>>(element: N$1, options?: WrapNodesOptions<V>) => void;
|
|
1547
|
-
/**
|
|
1548
|
-
* Push a batch of operations as either `undos` or `redos` onto `editor.undos`
|
|
1549
|
-
* or `editor.redos`
|
|
1550
|
-
*/
|
|
1551
|
-
writeHistory: (stack: 'redos' | 'undos', batch: any) => void;
|
|
1552
|
-
} /** Text Transforms */ & {
|
|
1553
|
-
/** Delete text in the document. */
|
|
1554
|
-
delete: OmitFirst<typeof deleteText>;
|
|
1555
|
-
/**
|
|
1556
|
-
* Insert a string of text at the specified location or (if not defined) the
|
|
1557
|
-
* current selection or (if not defined) the end of the document.
|
|
1558
|
-
*/
|
|
1559
|
-
insertText: (text: string, options?: InsertTextOptions) => void;
|
|
1560
|
-
} /** Selection Transforms */ & {
|
|
1561
|
-
/** Collapse the selection to a single point. */
|
|
1562
|
-
collapse: OmitFirst<typeof collapseSelection>;
|
|
1563
|
-
/** Move the selection's point forward or backward. */
|
|
1564
|
-
move: OmitFirst<typeof moveSelection>;
|
|
1565
|
-
/**
|
|
1566
|
-
* Set the selection to a new value specified by `at`. When a selection
|
|
1567
|
-
* already exists, this method is just a proxy for `setSelection` and will
|
|
1568
|
-
* update the existing value.
|
|
1569
|
-
*
|
|
1570
|
-
* @example
|
|
1571
|
-
* ```ts
|
|
1572
|
-
* editor.tf.select(at) // Select at location
|
|
1573
|
-
* editor.tf.select(at, { edge: 'end' }) // Select end of block above
|
|
1574
|
-
* editor.tf.select(at, { edge: 'start' }) // Select start of block above
|
|
1575
|
-
* ```;
|
|
1576
|
-
*/
|
|
1577
|
-
select: OmitFirst<typeof select$1>;
|
|
1578
|
-
/** Set new properties on one of the selection's points. */
|
|
1579
|
-
setPoint: OmitFirst<typeof setPoint$1>;
|
|
1580
|
-
/**
|
|
1581
|
-
* Set new properties on an active selection. Since the value is a
|
|
1582
|
-
* `Partial<TRange>`, this method can only handle updates to an existing
|
|
1583
|
-
* selection. If there is no active selection the operation will be void. Use
|
|
1584
|
-
* `select` if you'd like to create a selection when there is none.
|
|
1585
|
-
*/
|
|
1586
|
-
setSelection: OmitFirst<typeof setSelection$1>;
|
|
1587
|
-
/** Unset the selection. */
|
|
1588
|
-
deselect: () => void;
|
|
1589
|
-
} & {
|
|
1590
|
-
/** Blur the editor */
|
|
1591
|
-
blur: OmitFirst<typeof blur>;
|
|
1592
|
-
/** Deselect the editor. */
|
|
1593
|
-
deselectDOM: OmitFirst<typeof deselectDOM>;
|
|
1594
|
-
/**
|
|
1595
|
-
* Focus the editor.
|
|
1596
|
-
*
|
|
1597
|
-
* - If `at` is defined: select the location and focus
|
|
1598
|
-
* - If `edge` is defined: select the location (default: editor) edge ('start' |
|
|
1599
|
-
* 'end') and focus
|
|
1600
|
-
*
|
|
1601
|
-
* @example
|
|
1602
|
-
* ```ts
|
|
1603
|
-
* editor.tf.focus() // focus editor
|
|
1604
|
-
* editor.tf.focus({ edge: 'end' }) // end of selection if selection exists
|
|
1605
|
-
* editor.tf.focus({ edge: 'end' }) // end of editor if selection is null
|
|
1606
|
-
* ```;
|
|
1607
|
-
*/
|
|
1608
|
-
focus: OmitFirst<typeof focus$1>;
|
|
1609
|
-
/**
|
|
1610
|
-
* Insert data from a `DataTransfer` into the editor. This is a proxy method
|
|
1611
|
-
* to call in this order `insertFragmentData(editor: Editor, data:
|
|
1612
|
-
* DataTransfer)` and then `insertTextData(editor: Editor, data:
|
|
1613
|
-
* DataTransfer)`.
|
|
1614
|
-
*/
|
|
1615
|
-
insertData: DOMEditor['insertData'];
|
|
1616
|
-
/**
|
|
1617
|
-
* Insert fragment data from a `DataTransfer` into the editor. Returns true if
|
|
1618
|
-
* some content has been effectively inserted.
|
|
1619
|
-
*/
|
|
1620
|
-
insertFragmentData: DOMEditor['insertFragmentData'];
|
|
1621
|
-
/**
|
|
1622
|
-
* Insert text data from a `DataTransfer` into the editor. Returns true if
|
|
1623
|
-
* some content has been effectively inserted.
|
|
1624
|
-
*/
|
|
1625
|
-
insertTextData: DOMEditor['insertTextData'];
|
|
1626
|
-
/** Sets data from the currently selected fragment on a `DataTransfer`. */
|
|
1627
|
-
setFragmentData: DOMEditor['setFragmentData'];
|
|
1628
|
-
} & {
|
|
1629
|
-
setSplittingOnce: OmitFirst<typeof HistoryApi.setSplittingOnce>;
|
|
1630
|
-
/**
|
|
1631
|
-
* Apply a series of changes inside a synchronous `fn`, These operations will
|
|
1632
|
-
* be merged into the previous history.
|
|
1633
|
-
*/
|
|
1634
|
-
withMerging: OmitFirst<typeof HistoryApi.withMerging>;
|
|
1635
|
-
/**
|
|
1636
|
-
* Apply a series of changes inside a synchronous `fn`, ensuring that the
|
|
1637
|
-
* first operation starts a new batch in the history. Subsequent operations
|
|
1638
|
-
* will be merged as usual.
|
|
1639
|
-
*/
|
|
1640
|
-
withNewBatch: OmitFirst<typeof HistoryApi.withNewBatch>;
|
|
1641
|
-
/**
|
|
1642
|
-
* Apply a series of changes inside a synchronous `fn`, without merging any of
|
|
1643
|
-
* the new operations into previous save point in the history.
|
|
1644
|
-
*/
|
|
1645
|
-
withoutMerging: OmitFirst<typeof HistoryApi.withoutMerging>;
|
|
1646
|
-
/**
|
|
1647
|
-
* Apply a series of changes inside a synchronous `fn`, without saving any of
|
|
1648
|
-
* their operations into the history.
|
|
1649
|
-
*/
|
|
1650
|
-
withoutSaving: OmitFirst<typeof HistoryApi.withoutSaving>;
|
|
1651
|
-
} & {
|
|
1652
|
-
/** Apply an operation in the editor. */
|
|
1653
|
-
apply: <N$1 extends DescendantIn$1<V>>(operation: Operation$1<N$1>) => void;
|
|
1654
|
-
/** Normalize a Node according to the schema. */
|
|
1655
|
-
normalizeNode: <N$1 extends NodeIn<V>>(entry: NodeEntry$2<N$1>, options?: {
|
|
1656
|
-
operation?: Operation$1;
|
|
1657
|
-
}) => void;
|
|
1658
|
-
};
|
|
1659
|
-
type FocusOptions = {
|
|
1660
|
-
/** Target location to select before focusing */
|
|
1661
|
-
at?: At;
|
|
1662
|
-
/** Focus at location or editor edge. Default location is at or selection. */
|
|
1663
|
-
edge?: 'end' | 'endEditor' | 'start' | 'startEditor';
|
|
1664
|
-
/** Number of times to retry focusing */
|
|
1665
|
-
retries?: number;
|
|
1666
|
-
};
|
|
1667
|
-
type InsertFragmentOptions = {
|
|
1668
|
-
batchDirty?: boolean;
|
|
1669
|
-
hanging?: boolean;
|
|
1670
|
-
} & QueryAt & QueryVoids;
|
|
1671
|
-
type InsertNodesOptions<V extends Value$1 = Value$1> = {
|
|
1672
|
-
batchDirty?: boolean;
|
|
1673
|
-
hanging?: boolean;
|
|
1674
|
-
/**
|
|
1675
|
-
* Insert the nodes after the currect block. Does not apply if the removeEmpty
|
|
1676
|
-
* option caused the current block to be removed.
|
|
1677
|
-
*/
|
|
1678
|
-
nextBlock?: boolean;
|
|
1679
|
-
/**
|
|
1680
|
-
* Remove the currect block if empty before inserting. Only applies to
|
|
1681
|
-
* paragraphs by default, but can be customized by passing a QueryNodeOptions
|
|
1682
|
-
* object.
|
|
1683
|
-
*/
|
|
1684
|
-
removeEmpty?: QueryNodeOptions$1 | boolean;
|
|
1685
|
-
/** If true, select the inserted nodes. */
|
|
1686
|
-
select?: boolean;
|
|
1687
|
-
} & QueryOptions<V> & QueryMode & QueryVoids;
|
|
1688
|
-
type InsertTextOptions = {
|
|
1689
|
-
/** @default true */
|
|
1690
|
-
marks?: boolean;
|
|
1691
|
-
} & QueryAt & QueryVoids;
|
|
1692
|
-
type LiftNodesOptions<V extends Value$1 = Value$1> = QueryOptions<V> & QueryMode & QueryVoids;
|
|
1693
|
-
type MergeNodesOptions<V extends Value$1, _E extends Editor$1 = Editor$1> = {
|
|
1694
|
-
hanging?: boolean;
|
|
1695
|
-
/** Whether it's merging node from `deleteForward`. */
|
|
1696
|
-
reverse?: boolean;
|
|
1697
|
-
} & QueryOptions<V> & QueryMode & QueryVoids;
|
|
1698
|
-
type MoveNodesOptions<V extends Value$1 = Value$1> = {
|
|
1699
|
-
to: Path$2;
|
|
1700
|
-
/** Move only children of the node at location */
|
|
1701
|
-
children?: boolean;
|
|
1702
|
-
/** Start index of the children to move. Default: 0 */
|
|
1703
|
-
fromIndex?: number;
|
|
1704
|
-
} & QueryOptions<V> & QueryMode & QueryVoids;
|
|
1705
|
-
type RemoveMarksOptions = {
|
|
1706
|
-
/** Range where the mark(s) will be removed. Default: selection */
|
|
1707
|
-
at?: TRange$1;
|
|
1708
|
-
/** When true, trigger onChange if collapsed selection */
|
|
1709
|
-
shouldChange?: boolean;
|
|
1710
|
-
} & Omit<UnsetNodesOptions, 'match' | 'split'>;
|
|
1711
|
-
type RemoveNodesOptions<V extends Value$1 = Value$1> = {
|
|
1712
|
-
/** When true, remove all children of the node at the specified location */
|
|
1713
|
-
children?: boolean;
|
|
1714
|
-
event?: {
|
|
1715
|
-
type: 'mergeNodes';
|
|
1716
|
-
};
|
|
1717
|
-
hanging?: boolean;
|
|
1718
|
-
/** When true, remove the previous empty block if it exists */
|
|
1719
|
-
previousEmptyBlock?: boolean;
|
|
1720
|
-
} & QueryOptions<V> & QueryMode & QueryVoids;
|
|
1721
|
-
type ReplaceNodesOptions<V extends Value$1 = Value$1> = {
|
|
1722
|
-
/** When true, replace all children of the node at the specified location */
|
|
1723
|
-
children?: boolean;
|
|
1724
|
-
/** Options for removing nodes */
|
|
1725
|
-
removeNodes?: Omit<RemoveNodesOptions<V>, 'at'>;
|
|
1726
|
-
} & InsertNodesOptions<V>;
|
|
1727
|
-
type ResetOptions = {
|
|
1728
|
-
/** When true, only reset children without clearing history and operations */
|
|
1729
|
-
children?: boolean;
|
|
1730
|
-
} & Omit<ReplaceNodesOptions, 'at' | 'children'>;
|
|
1731
|
-
type SelectOptions = {
|
|
1732
|
-
/** Select edge of the block above location */
|
|
1733
|
-
edge?: 'end' | 'start';
|
|
1734
|
-
/** If true, focus the editor before selecting */
|
|
1735
|
-
focus?: boolean;
|
|
1736
|
-
/** Select start of next sibling */
|
|
1737
|
-
next?: boolean;
|
|
1738
|
-
/** Select end of previous sibling */
|
|
1739
|
-
previous?: boolean;
|
|
1740
|
-
};
|
|
1741
|
-
type SetNodesOptions<V extends Value$1 = Value$1> = {
|
|
1742
|
-
compare?: PropsCompare;
|
|
1743
|
-
hanging?: boolean;
|
|
1744
|
-
/**
|
|
1745
|
-
* When true, only apply to text nodes in non-void nodes or markable void
|
|
1746
|
-
* nodes
|
|
1747
|
-
*/
|
|
1748
|
-
marks?: boolean;
|
|
1749
|
-
merge?: PropsMerge;
|
|
1750
|
-
split?: boolean;
|
|
1751
|
-
} & QueryOptions<V> & QueryMode & QueryVoids;
|
|
1752
|
-
type SplitNodesOptions<V extends Value$1 = Value$1> = {
|
|
1753
|
-
always?: boolean;
|
|
1754
|
-
height?: number;
|
|
1755
|
-
} & QueryOptions<V> & QueryMode & QueryVoids;
|
|
1756
|
-
type ToggleBlockOptions = {
|
|
1757
|
-
/** The default block type to revert to when untoggling. Defaults to paragraph. */
|
|
1758
|
-
defaultType?: string;
|
|
1759
|
-
someOptions?: EditorNodesOptions;
|
|
1760
|
-
/**
|
|
1761
|
-
* If true, toggles wrapping the block with the specified type. Otherwise,
|
|
1762
|
-
* toggles the block type directly.
|
|
1763
|
-
*/
|
|
1764
|
-
wrap?: boolean;
|
|
1765
|
-
} & SetNodesOptions;
|
|
1766
|
-
type ToggleMarkOptions = {
|
|
1767
|
-
/** Mark keys to remove when adding the mark. */
|
|
1768
|
-
remove?: string[] | string;
|
|
1769
|
-
};
|
|
1770
|
-
type UnsetNodesOptions<V extends Value$1 = Value$1> = {
|
|
1771
|
-
hanging?: boolean;
|
|
1772
|
-
split?: boolean;
|
|
1773
|
-
} & QueryOptions<V> & QueryMode & QueryVoids;
|
|
1774
|
-
type UnwrapNodesOptions<V extends Value$1 = Value$1> = {
|
|
1775
|
-
hanging?: boolean;
|
|
1776
|
-
split?: boolean;
|
|
1777
|
-
} & QueryOptions<V> & QueryMode & QueryVoids;
|
|
1778
|
-
type WrapNodesOptions<V extends Value$1 = Value$1> = {
|
|
1779
|
-
/**
|
|
1780
|
-
* When true, wrap node children into a single element:
|
|
1781
|
-
*
|
|
1782
|
-
* - Wraps the first child node into the element
|
|
1783
|
-
* - Move the other child nodes next to the element children
|
|
1784
|
-
*/
|
|
1785
|
-
children?: boolean;
|
|
1786
|
-
hanging?: boolean;
|
|
1787
|
-
/**
|
|
1788
|
-
* Indicates that it's okay to split a node in order to wrap the location. For
|
|
1789
|
-
* example, if `ipsum` was selected in a `Text` node with `lorem ipsum dolar`,
|
|
1790
|
-
* `split: true` would wrap the word `ipsum` only, resulting in splitting the
|
|
1791
|
-
* `Text` node. If `split: false`, the entire `Text` node `lorem ipsum dolar`
|
|
1792
|
-
* would be wrapped.
|
|
1793
|
-
*/
|
|
1794
|
-
split?: boolean;
|
|
1795
|
-
} & QueryOptions<V> & QueryMode & QueryVoids;
|
|
1796
|
-
type PropsCompare = (prop: Partial<Descendant$1>, node: Partial<Descendant$1>) => boolean;
|
|
1797
|
-
type PropsMerge = (prop: Partial<Descendant$1>, node: Partial<Descendant$1>) => object;
|
|
1798
|
-
//#endregion
|
|
1799
|
-
//#region src/interfaces/editor/legacy-editor.d.ts
|
|
1800
|
-
|
|
1801
|
-
//#endregion
|
|
1802
|
-
//#region src/interfaces/element.d.ts
|
|
1803
|
-
/**
|
|
1804
|
-
* `TElement` objects are a type of node in a Slate document that contain other
|
|
1805
|
-
* element nodes or text nodes. They can be either "blocks" or "inlines"
|
|
1806
|
-
* depending on the Slate editor's configuration.
|
|
1807
|
-
*/
|
|
1808
|
-
type TElement$1 = {
|
|
1809
|
-
children: Descendant$1[];
|
|
1810
|
-
type: string;
|
|
1811
|
-
} & UnknownObject;
|
|
1812
|
-
/** Element retrieval and check methods. */
|
|
1813
|
-
|
|
1814
|
-
/** A utility type to get all the element nodes type from a root node. */
|
|
1815
|
-
type ElementIn<V extends Value$1> = ElementOf<V[number]>;
|
|
1816
|
-
type ElementOf<N$1 extends TNode$1> = Editor$1 extends N$1 ? TElement$1 : TElement$1 extends N$1 ? TElement$1 : N$1 extends Editor$1 ? ElementOf<N$1['children'][number]> | Extract<N$1['children'][number], TElement$1> : N$1 extends TElement$1 ? ElementOf<N$1['children'][number]> | Extract<N$1['children'][number], TElement$1> | N$1 : never;
|
|
1817
|
-
/**
|
|
1818
|
-
* `ElementEntry` objects refer to an `Element` and the `Path` where it can be
|
|
1819
|
-
* found inside a root node.
|
|
1820
|
-
*/
|
|
1821
|
-
/** Element or text of an editor. */
|
|
1822
|
-
type ElementOrTextIn<V extends Value$1> = ElementIn<V> | TextIn<V>;
|
|
1823
|
-
//#endregion
|
|
1824
|
-
//#region src/slate-history/history.d.ts
|
|
1825
|
-
/** `HistoryApi` contains helpers for history-enabled editors. */
|
|
1826
|
-
declare const HistoryApi: {
|
|
1827
|
-
/** Check if a value is a `History` object. */
|
|
1828
|
-
isHistory(value: any): value is History;
|
|
1829
|
-
/** Get the merge flag's current value. */
|
|
1830
|
-
isMerging(editor: Editor$1): boolean | undefined;
|
|
1831
|
-
/** Get the splitting once flag's current value. */
|
|
1832
|
-
isSaving(editor: Editor$1): boolean | undefined;
|
|
1833
|
-
isSplittingOnce(editor: Editor$1): boolean | undefined;
|
|
1834
|
-
/** Get the saving flag's current value. */
|
|
1835
|
-
redo(editor: Editor$1): void;
|
|
1836
|
-
/** Redo to the previous saved state. */
|
|
1837
|
-
setSplittingOnce(editor: Editor$1, value: boolean | undefined): void;
|
|
1838
|
-
/** Undo to the previous saved state. */
|
|
1839
|
-
undo(editor: Editor$1): void;
|
|
1840
|
-
/**
|
|
1841
|
-
* Apply a series of changes inside a synchronous `fn`, These operations will
|
|
1842
|
-
* be merged into the previous history.
|
|
1843
|
-
*/
|
|
1844
|
-
withMerging(editor: Editor$1, fn: () => void): void;
|
|
1845
|
-
/**
|
|
1846
|
-
* Apply a series of changes inside a synchronous `fn`, ensuring that the
|
|
1847
|
-
* first operation starts a new batch in the history. Subsequent operations
|
|
1848
|
-
* will be merged as usual.
|
|
1849
|
-
*/
|
|
1850
|
-
withNewBatch(editor: Editor$1, fn: () => void): void;
|
|
1851
|
-
/**
|
|
1852
|
-
* Apply a series of changes inside a synchronous `fn`, without merging any of
|
|
1853
|
-
* the new operations into previous save point in the history.
|
|
1854
|
-
*/
|
|
1855
|
-
withoutMerging(editor: Editor$1, fn: () => void): void;
|
|
1856
|
-
/**
|
|
1857
|
-
* Apply a series of changes inside a synchronous `fn`, without saving any of
|
|
1858
|
-
* their operations into the history.
|
|
1859
|
-
*/
|
|
1860
|
-
withoutSaving(editor: Editor$1, fn: () => void): void;
|
|
1861
|
-
};
|
|
1862
|
-
type History = {
|
|
1863
|
-
/** Redos of the editor. */
|
|
1864
|
-
redos: Batch[];
|
|
1865
|
-
/** Undos of the editor. */
|
|
1866
|
-
undos: Batch[];
|
|
1867
|
-
};
|
|
1868
|
-
/**
|
|
1869
|
-
* `History` objects hold all of the operations that are applied to a value, so
|
|
1870
|
-
* they can be undone or redone as necessary.
|
|
1871
|
-
*/
|
|
1872
|
-
type Batch = {
|
|
1873
|
-
operations: Operation$1[];
|
|
1874
|
-
selectionBefore: TRange$1 | null;
|
|
1875
|
-
};
|
|
1876
|
-
//#endregion
|
|
1877
|
-
//#region src/interfaces/editor/editor-type.d.ts
|
|
1878
|
-
type Editor$1<V extends Value$1 = Value$1> = EditorBase$1<V> & {
|
|
1879
|
-
api: EditorApi$1<V>;
|
|
1880
|
-
tf: EditorTransforms$1<V>;
|
|
1881
|
-
transforms: EditorTransforms$1<V>;
|
|
1882
|
-
};
|
|
1883
|
-
type EditorBase$1<V extends Value$1 = Value$1> = {
|
|
1884
|
-
/** Unique identifier for the editor. */
|
|
1885
|
-
id: string;
|
|
1886
|
-
/** Value of the editor. */
|
|
1887
|
-
children: V;
|
|
1888
|
-
/** Contains the undos and redos of the editor. */
|
|
1889
|
-
history: History;
|
|
1890
|
-
/** Marks that are currently applied to the editor. */
|
|
1891
|
-
marks: EditorMarks | null;
|
|
1892
|
-
/**
|
|
1893
|
-
* Editor metadata. Use this for custom fields instead of extending the editor
|
|
1894
|
-
* directly.
|
|
1895
|
-
*/
|
|
1896
|
-
meta: UnknownObject & {
|
|
1897
|
-
isNormalizing?: boolean;
|
|
1898
|
-
};
|
|
1899
|
-
/** Operations that have been applied to the editor. */
|
|
1900
|
-
operations: Operation$1<DescendantIn$1<V>>[];
|
|
1901
|
-
/** The current selection of the editor. */
|
|
1902
|
-
selection: EditorSelection;
|
|
1903
|
-
} & EditorMethods<V> & UnknownObject;
|
|
1904
|
-
type EditorMarks = Record<string, any>;
|
|
1905
|
-
type EditorMethods<V extends Value$1 = Value$1> = Pick<EditorTransforms$1<V>, 'redo' | 'undo'>;
|
|
1906
|
-
type EditorSelection = TRange$1 | null;
|
|
1907
|
-
type Value$1 = TElement$1[];
|
|
1908
|
-
/** A helper type for getting the value of an editor. */
|
|
1909
|
-
type ValueOf$1<E extends Editor$1> = E['children'];
|
|
1910
|
-
//#endregion
|
|
1911
|
-
//#region src/create-editor.d.ts
|
|
1912
|
-
//#endregion
|
|
1913
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
|
|
@@ -2442,8 +731,8 @@ declare const insertExitBreak: (editor: SlateEditor, {
|
|
|
2442
731
|
//#endregion
|
|
2443
732
|
//#region src/lib/plugins/slate-extension/transforms/resetBlock.d.ts
|
|
2444
733
|
/**
|
|
2445
|
-
* Reset the current block to a paragraph, removing all properties except
|
|
2446
|
-
* type.
|
|
734
|
+
* Reset the current block to a paragraph, removing all properties except the
|
|
735
|
+
* configured node id key and type.
|
|
2447
736
|
*/
|
|
2448
737
|
declare const resetBlock: (editor: SlateEditor, {
|
|
2449
738
|
at
|
|
@@ -2469,7 +758,9 @@ type SlateExtensionConfig = PluginConfig<'slateExtension', {
|
|
|
2469
758
|
prevText: string;
|
|
2470
759
|
text: string;
|
|
2471
760
|
}) => void;
|
|
2472
|
-
}, {
|
|
761
|
+
}, {
|
|
762
|
+
redecorate: () => void;
|
|
763
|
+
}, {
|
|
2473
764
|
init: OmitFirst<typeof init>;
|
|
2474
765
|
insertExitBreak: OmitFirst<typeof insertExitBreak>;
|
|
2475
766
|
resetBlock: OmitFirst<typeof resetBlock>;
|
|
@@ -2490,7 +781,9 @@ declare const SlateExtensionPlugin: SlatePlugin<PluginConfig<"slateExtension", {
|
|
|
2490
781
|
prevText: string;
|
|
2491
782
|
text: string;
|
|
2492
783
|
}) => void;
|
|
2493
|
-
}, {
|
|
784
|
+
}, {
|
|
785
|
+
redecorate: () => void;
|
|
786
|
+
}, {
|
|
2494
787
|
init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
|
|
2495
788
|
insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
|
|
2496
789
|
resetBlock: ((args_0?: {
|
|
@@ -2761,31 +1054,33 @@ declare const getCorePlugins: ({
|
|
|
2761
1054
|
}: GetCorePluginsOptions) => (SlatePlugin<DebugConfig> | SlatePlugin<PluginConfig<"slateExtension", {
|
|
2762
1055
|
onNodeChange: (options: {
|
|
2763
1056
|
editor: SlateEditor;
|
|
2764
|
-
node: Descendant
|
|
2765
|
-
operation: NodeOperation
|
|
2766
|
-
prevNode: Descendant
|
|
1057
|
+
node: _platejs_slate1.Descendant;
|
|
1058
|
+
operation: _platejs_slate1.NodeOperation;
|
|
1059
|
+
prevNode: _platejs_slate1.Descendant;
|
|
2767
1060
|
}) => void;
|
|
2768
1061
|
onTextChange: (options: {
|
|
2769
1062
|
editor: SlateEditor;
|
|
2770
|
-
node: Descendant
|
|
2771
|
-
operation: TextOperation
|
|
1063
|
+
node: _platejs_slate1.Descendant;
|
|
1064
|
+
operation: _platejs_slate1.TextOperation;
|
|
2772
1065
|
prevText: string;
|
|
2773
1066
|
text: string;
|
|
2774
1067
|
}) => void;
|
|
2775
|
-
}, {
|
|
1068
|
+
}, {
|
|
1069
|
+
redecorate: () => void;
|
|
1070
|
+
}, {
|
|
2776
1071
|
init: ((args_0: InitOptions) => void) & ((args_0: InitOptions) => void);
|
|
2777
1072
|
insertExitBreak: ((args_0?: InsertExitBreakOptions | undefined) => true | undefined) & ((args_0?: InsertExitBreakOptions | undefined) => true | undefined);
|
|
2778
1073
|
resetBlock: ((args_0?: {
|
|
2779
|
-
at?: Path
|
|
1074
|
+
at?: _platejs_slate1.Path;
|
|
2780
1075
|
} | undefined) => true | undefined) & ((args_0?: {
|
|
2781
|
-
at?: Path
|
|
1076
|
+
at?: _platejs_slate1.Path;
|
|
2782
1077
|
} | undefined) => true | undefined);
|
|
2783
|
-
setValue: ((value?: string | Value
|
|
2784
|
-
apply: <N$1 extends TElement
|
|
1078
|
+
setValue: ((value?: string | _platejs_slate1.Value | undefined) => void) & ((value?: string | _platejs_slate1.Value | undefined) => void);
|
|
1079
|
+
apply: <N$1 extends _platejs_slate1.TElement | _platejs_slate1.TText>(operation: _platejs_slate1.Operation<N$1>) => void;
|
|
2785
1080
|
}, {}>> | SlatePlugin<PluginConfig<"dom", {
|
|
2786
1081
|
scrollMode?: ScrollMode;
|
|
2787
1082
|
scrollOperations?: AutoScrollOperationsMap;
|
|
2788
|
-
scrollOptions?: ScrollIntoViewOptions
|
|
1083
|
+
scrollOptions?: _platejs_slate1.ScrollIntoViewOptions;
|
|
2789
1084
|
}, {
|
|
2790
1085
|
isScrolling: () => boolean;
|
|
2791
1086
|
}, {
|
|
@@ -2795,7 +1090,7 @@ declare const getCorePlugins: ({
|
|
|
2795
1090
|
element: HTMLElement | string;
|
|
2796
1091
|
collapseWhiteSpace?: boolean;
|
|
2797
1092
|
defaultElementPlugin?: WithRequiredKey;
|
|
2798
|
-
}) => Descendant
|
|
1093
|
+
}) => _platejs_slate1.Descendant[];
|
|
2799
1094
|
}>, {}, {}>> | SlatePlugin<PluginConfig<"ast", {}, {}, {}, {}>> | SlatePlugin<PluginConfig<"nodeId", {
|
|
2800
1095
|
disableInsertOverrides?: boolean;
|
|
2801
1096
|
filterInline?: boolean;
|
|
@@ -2804,7 +1099,7 @@ declare const getCorePlugins: ({
|
|
|
2804
1099
|
normalizeInitialValue?: boolean;
|
|
2805
1100
|
reuseId?: boolean;
|
|
2806
1101
|
idCreator?: () => any;
|
|
2807
|
-
} & QueryNodeOptions
|
|
1102
|
+
} & _platejs_slate1.QueryNodeOptions, {}, {
|
|
2808
1103
|
nodeId: {
|
|
2809
1104
|
normalize: () => void;
|
|
2810
1105
|
};
|
|
@@ -2844,7 +1139,7 @@ declare const HtmlPlugin: SlatePlugin<PluginConfig<"html", {}, Record<"html", {
|
|
|
2844
1139
|
element: HTMLElement | string;
|
|
2845
1140
|
collapseWhiteSpace?: boolean;
|
|
2846
1141
|
defaultElementPlugin?: WithRequiredKey;
|
|
2847
|
-
}) => Descendant
|
|
1142
|
+
}) => _platejs_slate1.Descendant[];
|
|
2848
1143
|
}>, {}, {}>>;
|
|
2849
1144
|
//#endregion
|
|
2850
1145
|
//#region src/lib/plugins/html/constants.d.ts
|
|
@@ -3181,6 +1476,13 @@ declare const endInlineFormattingContext: (state: CollapseWhiteSpaceState) => vo
|
|
|
3181
1476
|
//#region src/lib/plugins/length/LengthPlugin.d.ts
|
|
3182
1477
|
declare const LengthPlugin: SlatePlugin<LengthConfig>;
|
|
3183
1478
|
//#endregion
|
|
1479
|
+
//#region src/lib/plugins/node-id/normalizeStaticValue.d.ts
|
|
1480
|
+
declare const STATIC_VALUE_CREATED_AT = 1704067200000;
|
|
1481
|
+
type NormalizeStaticValueOptions = NormalizeNodeIdOptions & {
|
|
1482
|
+
createdAt?: number;
|
|
1483
|
+
};
|
|
1484
|
+
declare const normalizeStaticValue: <V extends Value>(value: V, options?: NormalizeStaticValueOptions) => V;
|
|
1485
|
+
//#endregion
|
|
3184
1486
|
//#region src/lib/plugins/node-id/withNodeId.d.ts
|
|
3185
1487
|
/** Enables support for inserting nodes with an id key. */
|
|
3186
1488
|
declare const withNodeId: OverrideEditor<NodeIdConfig>;
|
|
@@ -4073,6 +2375,8 @@ type RenderElementProps<N$1 extends TElement = TElement> = {
|
|
|
4073
2375
|
};
|
|
4074
2376
|
children: any;
|
|
4075
2377
|
element: N$1;
|
|
2378
|
+
/** Pre-computed path for static rendering (avoids expensive findPath traversal). */
|
|
2379
|
+
path?: Path;
|
|
4076
2380
|
};
|
|
4077
2381
|
//#endregion
|
|
4078
2382
|
//#region src/lib/types/RenderLeafProps.d.ts
|
|
@@ -4085,6 +2389,8 @@ type RenderLeafProps<N$1 extends TText = TText> = {
|
|
|
4085
2389
|
};
|
|
4086
2390
|
children: any;
|
|
4087
2391
|
leaf: N$1;
|
|
2392
|
+
/** Pre-computed path for static rendering. */
|
|
2393
|
+
path?: Path;
|
|
4088
2394
|
text: N$1;
|
|
4089
2395
|
/**
|
|
4090
2396
|
* The position of the leaf within the Text node, only present when the text
|
|
@@ -4098,6 +2404,8 @@ type RenderTextFn = (props: RenderTextProps) => React$1.ReactElement<any>;
|
|
|
4098
2404
|
type RenderTextProps<N$1 extends TText = TText> = {
|
|
4099
2405
|
/** The text node being rendered. */
|
|
4100
2406
|
text: N$1;
|
|
2407
|
+
/** Pre-computed path for static rendering. */
|
|
2408
|
+
path?: Path;
|
|
4101
2409
|
/** The children (leaves) rendered within this text node. */
|
|
4102
2410
|
children: any;
|
|
4103
2411
|
/**
|
|
@@ -4290,5 +2598,4 @@ declare const pipeOnNodeChange: (editor: SlateEditor, node: Descendant, prevNode
|
|
|
4290
2598
|
//#region src/lib/utils/pipeOnTextChange.d.ts
|
|
4291
2599
|
declare const pipeOnTextChange: (editor: SlateEditor, node: Descendant, text: string, prevText: string, operation: TextOperation) => boolean;
|
|
4292
2600
|
//#endregion
|
|
4293
|
-
export { TSlateEditor as $,
|
|
4294
|
-
//# sourceMappingURL=index-NTp--CEF.d.ts.map
|
|
2601
|
+
export { TSlateEditor as $, SlateElement as $i, SPACE as $n, getPluginType as $r, CollapseWhiteSpaceState as $t, applyDeepToNodes as A, pluginRenderElementStatic as Aa, SlatePlugin as Ai, htmlElementToElement as An, ElementAffinity as Ar, BaseParagraphPlugin as At, ZustandStoreApi as B, pipeDecorate as Bi, deserializeHtml as Bn, setValue as Br, STATIC_VALUE_CREATED_AT as Bt, isSlateNode as C, pipeRenderTextStatic as Ca, OverrideEditor as Ci, isHtmlElement as Cn, isNodeAffinity as Cr, NodeComponents as Ct, isSlateText as D, pluginRenderLeafStatic as Da, RenderStaticNodeWrapperFunction as Di, htmlTextNodeToString as Dn, EdgeNodes as Dr, SelectionRules as Dt, isSlateString as E, pipeRenderLeafStatic as Ea, RenderStaticNodeWrapper as Ei, inlineTagNames as En, getEdgeNodes as Er, PluginConfig as Et, RenderLeafProps as F, SlateShortcut as Fi, findHtmlElement as Fn, ScrollMode as Fr, withBreakRules as Ft, WithSlateOptions as G, getRenderNodeStaticProps as Gi, cleanHtmlEmptyElements as Gn, init as Gr, isLastNonEmptyTextOfInlineFormattingContext as Gt, nanoid$1 as H, getSelectedDomNode as Hi, cleanHtmlTextNodes as Hn, InsertExitBreakOptions as Hr, LengthPlugin as Ht, RenderElementFn as I, TextStaticProps as Ii, someHtmlElement as In, WithAutoScrollOptions as Ir, OverridePlugin as It, BaseEditor as J, createStaticString as Ji, DeserializeHtmlChildren as Jn, withPlateHistory as Jr, collapseWhiteSpaceNode as Jt, createSlateEditor as K, getNodeDataAttributes as Ki, cleanHtmlCrLf as Kn, ParserPlugin as Kr, inferWhiteSpaceRule as Kt, RenderElementProps as L, TransformOptions as Li, deserializeHtmlNodeChildren as Ln, withScrolling as Lr, withOverrides as Lt, RenderTextFn as M, AstPlugin as Ma, SlatePluginContext as Mi, htmlBodyToFragment as Mn, AutoScrollOperationsMap as Mr, withNormalizeRules as Mt, RenderTextProps as N, SlatePluginMethods as Ni, getHtmlComments as Nn, DOMPlugin as Nr, withMergeRules as Nt, isSlateVoid as O, pipeRenderElementStatic as Oa, RenderStaticNodeWrapperProps as Oi, htmlStringToDOMNode as On, AffinityConfig as Or, WithAnyKey as Ot, RenderLeafFn as P, SlatePlugins as Pi, getDataNodeProps as Pn, DomConfig as Pr, withDeleteRules as Pt, SlateEditor as Q, getEditorDOMFromHtmlString as Qi, NO_BREAK_SPACE as Qn, getPluginKeys as Qr, collapseString as Qt, RenderChunkFn as R, stripSlateDataAttributes as Ri, deserializeHtmlNode as Rn, SlateExtensionConfig as Rr, withNodeId as Rt, isSlateLeaf as S, SlateRenderText as Sa, NormalizeInitialValue as Si, isHtmlFragmentHref as Sn, setAffinitySelection as Sr, NodeComponent as St, isSlatePluginNode as T, SlateRenderLeaf as Ta, PartialEditorPlugin as Ti, isHtmlBlockElement as Tn, getMarkBoundaryAffinity as Tr, ParserOptions as Tt, BaseWithSlateOptions as U, getSelectedDomFragment as Ui, cleanHtmlLinkElements as Un, insertExitBreak as Ur, endInlineFormattingContext as Ut, createZustandStore$1 as V, isSelectOutside as Vi, copyBlockMarksToSpanChild as Vn, resetBlock as Vr, normalizeStaticValue as Vt, CreateSlateEditorOptions as W, getSelectedDomBlocks as Wi, cleanHtmlFontElements as Wn, InitOptions as Wr, upsertInlineFormattingContext as Wt, KeyofNodePlugins as X, ViewPlugin as Xi, CARRIAGE_RETURN as Xn, getPluginByType as Xr, collapseWhiteSpaceChildren as Xt, InferPlugins as Y, getStaticPlugins as Yi, DeserializeHtmlNodeReturnType as Yn, getContainerTypes as Yr, collapseWhiteSpaceElement as Yt, KeyofPlugins as Z, createStaticEditor as Zi, LINE_FEED as Zn, getPluginKey as Zr, collapseWhiteSpace as Zt, getInjectMatch as _, serializeHtml as _a, LeafStaticProps as _i, parseHtmlDocument as _n, normalizeNodeId as _r, InferOptions as _t, omitPluginContext as a, SlateText as aa, AnyEditorPlugin as ai, traverseHtmlNode as an, CorePluginApi as ar, BasePluginContext as at, isSlateEditor as b, PlateStatic as ba, NodeStaticWrapperComponentProps as bi, isHtmlTable as bn, LogLevel as br, MatchRules as bt, isType as c, StyledSlateLeafProps as ca, Deserializer as ci, replaceTagName as cn, GetCorePluginsOptions as cr, BaseTransformOptions as ct, isHotkey as d, BoxStaticProps as da, ExtendEditorApi as di, preCleanHtml as dn, ChunkingConfig as dr, EditOnlyConfig as dt, SlateElementProps as ea, getPluginTypes as ei, TrimEndRule as en, TAB as er, AnyPluginConfig as et, getSlateClass as f, SlateRenderElementProps as fa, ExtendEditorTransforms as fi, postCleanHtml as fn, ChunkingPlugin as fr, ExtendConfig as ft, getInjectedPlugins as g, SerializeHtmlOptions as ga, InjectNodeProps as gi, parseHtmlElement as gn, NormalizeNodeIdOptions as gr, InferKey as gt, keyToDataAttribute as h, SlateRenderTextProps as ha, InferConfig as hi, pipeDeserializeHtmlElement as hn, NodeIdPlugin as hr, InferApi as ht, overridePluginsByKey as i, SlateNodeProps as ia, createTSlatePlugin as ii, traverseHtmlTexts as in, CorePlugin as ir, BasePlugin as it, EditableProps as j, HandlerReturnType as ja, SlatePluginConfig$1 as ji, htmlBrToNewLine as jn, AUTO_SCROLL as jr, ParagraphConfig as jt, ApplyDeepToNodesOptions as k, SlateRenderElement as ka, Serializer as ki, htmlElementToLeaf as kn, AffinityPlugin as kr, WithRequiredKey as kt, Hotkeys as l, StyledSlateTextProps as la, EditorPlugin as li, removeHtmlSurroundings as ln, LengthConfig as lr, BreakRules as lt, getNodeDataAttributeKeys as m, SlateRenderNodeProps as ma, HtmlSerializer as mi, pipeDeserializeHtmlLeaf as mn, NodeIdOptions as mr, GetInjectNodePropsReturnType as mt, pipeOnNodeChange as n, SlateLeaf as na, getEditorPlugin as ni, WhiteSpaceRule as nn, HtmlPlugin as nr, BaseHtmlDeserializer as nt, normalizeDescendantsToDocumentFragment as o, SlateTextProps as oa, AnySlatePlugin as oi, traverseHtmlElements as on, CorePluginTransforms as or, BasePluginNode as ot, getPluginNodeProps as p, SlateRenderLeafProps as pa, HtmlDeserializer as pi, pluginDeserializeHtml as pn, NodeIdConfig as pr, GetInjectNodePropsOptions as pt, withSlate as q, getPluginDataAttributes as qi, cleanHtmlBrElements as qn, HistoryPlugin as qr, collapseWhiteSpaceText as qt, pipeInsertDataQuery as r, SlateLeafProps as ra, createSlatePlugin as ri, unwrapHtmlElement as rn, withChunking as rr, BaseInjectProps as rt, mergeDeepToNodes as s, StyledSlateElementProps as sa, Decorate as si, traverseHtmlComments as sn, DebugConfig as sr, BaseSerializer as st, pipeOnTextChange as t, SlateHTMLProps as ta, getSlatePlugin as ti, TrimStartRule as tn, ZERO_WIDTH_SPACE as tr, BaseDeserializer as tt, createHotkey as u, useNodeAttributes as ua, ExtendEditor as ui, removeHtmlNodesBetweenComments as un, getCorePlugins as ur, DeleteRules as ut, defaultsDeepToNodes as v, ElementStatic as va, NodeStaticProps as vi, isOlSymbol as vn, DebugErrorType as vr, InferSelectors as vt, isSlatePluginElement as w, pluginRenderTextStatic as wa, Parser as wi, isHtmlComment as wn, isNodesAffinity as wr, NormalizeRules as wt, isSlateElement as x, PlateStaticProps as xa, NodeStaticWrapperComponentReturnType as xi, isHtmlInlineElement as xn, PlateError as xr, MergeRules as xt, getSlateElements as y, LeafStatic as ya, NodeStaticWrapperComponent as yi, isHtmlText as yn, DebugPlugin as yr, InferTransforms as yt, RenderChunkProps as z, stripHtmlClassNames as zi, deserializeHtmlElement as zn, SlateExtensionPlugin as zr, NormalizeStaticValueOptions as zt };
|