slate 0.94.1 → 0.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/apply.d.ts +3 -3
- package/dist/core/apply.d.ts.map +1 -1
- package/dist/core/get-dirty-paths.d.ts +6 -6
- package/dist/core/get-dirty-paths.d.ts.map +1 -1
- package/dist/core/get-fragment.d.ts +3 -3
- package/dist/core/get-fragment.d.ts.map +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/normalize-node.d.ts +3 -3
- package/dist/core/normalize-node.d.ts.map +1 -1
- package/dist/core/should-normalize.d.ts +3 -3
- package/dist/core/should-normalize.d.ts.map +1 -1
- package/dist/create-editor.d.ts +5 -5
- package/dist/create-editor.d.ts.map +1 -1
- package/dist/editor/above.d.ts +2 -2
- package/dist/editor/above.d.ts.map +1 -1
- package/dist/editor/add-mark.d.ts +2 -2
- package/dist/editor/add-mark.d.ts.map +1 -1
- package/dist/editor/after.d.ts +2 -2
- package/dist/editor/after.d.ts.map +1 -1
- package/dist/editor/before.d.ts +2 -2
- package/dist/editor/before.d.ts.map +1 -1
- package/dist/editor/delete-backward.d.ts +3 -3
- package/dist/editor/delete-backward.d.ts.map +1 -1
- package/dist/editor/delete-forward.d.ts +3 -3
- package/dist/editor/delete-forward.d.ts.map +1 -1
- package/dist/editor/delete-fragment.d.ts +2 -2
- package/dist/editor/delete-fragment.d.ts.map +1 -1
- package/dist/editor/edges.d.ts +2 -2
- package/dist/editor/edges.d.ts.map +1 -1
- package/dist/editor/element-read-only.d.ts +2 -2
- package/dist/editor/element-read-only.d.ts.map +1 -1
- package/dist/editor/end.d.ts +2 -2
- package/dist/editor/end.d.ts.map +1 -1
- package/dist/editor/first.d.ts +2 -2
- package/dist/editor/first.d.ts.map +1 -1
- package/dist/editor/fragment.d.ts +2 -2
- package/dist/editor/fragment.d.ts.map +1 -1
- package/dist/editor/get-void.d.ts +2 -2
- package/dist/editor/get-void.d.ts.map +1 -1
- package/dist/editor/has-blocks.d.ts +2 -2
- package/dist/editor/has-blocks.d.ts.map +1 -1
- package/dist/editor/has-inlines.d.ts +2 -2
- package/dist/editor/has-inlines.d.ts.map +1 -1
- package/dist/editor/has-path.d.ts +2 -2
- package/dist/editor/has-path.d.ts.map +1 -1
- package/dist/editor/has-texts.d.ts +2 -2
- package/dist/editor/has-texts.d.ts.map +1 -1
- package/dist/editor/index.d.ts +54 -54
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/insert-break.d.ts +2 -2
- package/dist/editor/insert-break.d.ts.map +1 -1
- package/dist/editor/insert-node.d.ts +2 -2
- package/dist/editor/insert-node.d.ts.map +1 -1
- package/dist/editor/insert-soft-break.d.ts +2 -2
- package/dist/editor/insert-soft-break.d.ts.map +1 -1
- package/dist/editor/insert-text.d.ts +2 -2
- package/dist/editor/insert-text.d.ts.map +1 -1
- package/dist/editor/is-block.d.ts +2 -2
- package/dist/editor/is-block.d.ts.map +1 -1
- package/dist/editor/is-edge.d.ts +2 -2
- package/dist/editor/is-edge.d.ts.map +1 -1
- package/dist/editor/is-editor.d.ts +2 -2
- package/dist/editor/is-editor.d.ts.map +1 -1
- package/dist/editor/is-empty.d.ts +2 -2
- package/dist/editor/is-empty.d.ts.map +1 -1
- package/dist/editor/is-end.d.ts +2 -2
- package/dist/editor/is-end.d.ts.map +1 -1
- package/dist/editor/is-normalizing.d.ts +2 -2
- package/dist/editor/is-normalizing.d.ts.map +1 -1
- package/dist/editor/is-start.d.ts +2 -2
- package/dist/editor/is-start.d.ts.map +1 -1
- package/dist/editor/last.d.ts +2 -2
- package/dist/editor/last.d.ts.map +1 -1
- package/dist/editor/leaf.d.ts +2 -2
- package/dist/editor/leaf.d.ts.map +1 -1
- package/dist/editor/levels.d.ts +3 -3
- package/dist/editor/levels.d.ts.map +1 -1
- package/dist/editor/marks.d.ts +2 -2
- package/dist/editor/marks.d.ts.map +1 -1
- package/dist/editor/next.d.ts +2 -2
- package/dist/editor/next.d.ts.map +1 -1
- package/dist/editor/node.d.ts +2 -2
- package/dist/editor/node.d.ts.map +1 -1
- package/dist/editor/nodes.d.ts +3 -3
- package/dist/editor/nodes.d.ts.map +1 -1
- package/dist/editor/normalize.d.ts +2 -2
- package/dist/editor/normalize.d.ts.map +1 -1
- package/dist/editor/parent.d.ts +2 -2
- package/dist/editor/parent.d.ts.map +1 -1
- package/dist/editor/path-ref.d.ts +2 -2
- package/dist/editor/path-ref.d.ts.map +1 -1
- package/dist/editor/path-refs.d.ts +2 -2
- package/dist/editor/path-refs.d.ts.map +1 -1
- package/dist/editor/path.d.ts +2 -2
- package/dist/editor/path.d.ts.map +1 -1
- package/dist/editor/point-ref.d.ts +2 -2
- package/dist/editor/point-ref.d.ts.map +1 -1
- package/dist/editor/point-refs.d.ts +2 -2
- package/dist/editor/point-refs.d.ts.map +1 -1
- package/dist/editor/point.d.ts +2 -2
- package/dist/editor/point.d.ts.map +1 -1
- package/dist/editor/positions.d.ts +3 -3
- package/dist/editor/positions.d.ts.map +1 -1
- package/dist/editor/previous.d.ts +2 -2
- package/dist/editor/previous.d.ts.map +1 -1
- package/dist/editor/range-ref.d.ts +2 -2
- package/dist/editor/range-ref.d.ts.map +1 -1
- package/dist/editor/range-refs.d.ts +2 -2
- package/dist/editor/range-refs.d.ts.map +1 -1
- package/dist/editor/range.d.ts +2 -2
- package/dist/editor/range.d.ts.map +1 -1
- package/dist/editor/remove-mark.d.ts +2 -2
- package/dist/editor/remove-mark.d.ts.map +1 -1
- package/dist/editor/set-normalizing.d.ts +2 -2
- package/dist/editor/set-normalizing.d.ts.map +1 -1
- package/dist/editor/start.d.ts +2 -2
- package/dist/editor/start.d.ts.map +1 -1
- package/dist/editor/string.d.ts +2 -2
- package/dist/editor/string.d.ts.map +1 -1
- package/dist/editor/unhang-range.d.ts +2 -2
- package/dist/editor/unhang-range.d.ts.map +1 -1
- package/dist/editor/without-normalizing.d.ts +2 -2
- package/dist/editor/without-normalizing.d.ts.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +641 -1551
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1227 -2191
- package/dist/index.js.map +1 -1
- package/dist/interfaces/editor.d.ts +497 -497
- package/dist/interfaces/editor.d.ts.map +1 -1
- package/dist/interfaces/element.d.ts +46 -46
- package/dist/interfaces/element.d.ts.map +1 -1
- package/dist/interfaces/index.d.ts +14 -14
- package/dist/interfaces/index.d.ts.map +1 -1
- package/dist/interfaces/location.d.ts +29 -29
- package/dist/interfaces/location.d.ts.map +1 -1
- package/dist/interfaces/node.d.ts +173 -173
- package/dist/interfaces/node.d.ts.map +1 -1
- package/dist/interfaces/operation.d.ts +107 -107
- package/dist/interfaces/operation.d.ts.map +1 -1
- package/dist/interfaces/path-ref.d.ts +18 -18
- package/dist/interfaces/path-ref.d.ts.map +1 -1
- package/dist/interfaces/path.d.ts +132 -132
- package/dist/interfaces/path.d.ts.map +1 -1
- package/dist/interfaces/point-ref.d.ts +19 -19
- package/dist/interfaces/point-ref.d.ts.map +1 -1
- package/dist/interfaces/point.d.ts +49 -49
- package/dist/interfaces/point.d.ts.map +1 -1
- package/dist/interfaces/range-ref.d.ts +18 -18
- package/dist/interfaces/range-ref.d.ts.map +1 -1
- package/dist/interfaces/range.d.ts +80 -80
- package/dist/interfaces/range.d.ts.map +1 -1
- package/dist/interfaces/scrubber.d.ts +21 -21
- package/dist/interfaces/scrubber.d.ts.map +1 -1
- package/dist/interfaces/text.d.ts +47 -47
- package/dist/interfaces/text.d.ts.map +1 -1
- package/dist/interfaces/transforms/general.d.ts +8 -8
- package/dist/interfaces/transforms/general.d.ts.map +1 -1
- package/dist/interfaces/transforms/index.d.ts +5 -5
- package/dist/interfaces/transforms/index.d.ts.map +1 -1
- package/dist/interfaces/transforms/node.d.ts +117 -117
- package/dist/interfaces/transforms/node.d.ts.map +1 -1
- package/dist/interfaces/transforms/selection.d.ts +41 -41
- package/dist/interfaces/transforms/selection.d.ts.map +1 -1
- package/dist/interfaces/transforms/text.d.ts +36 -36
- package/dist/interfaces/transforms/text.d.ts.map +1 -1
- package/dist/slate.js +2152 -3123
- package/dist/slate.min.js +2 -2
- package/dist/transforms-node/index.d.ts +10 -10
- package/dist/transforms-node/index.d.ts.map +1 -1
- package/dist/transforms-node/insert-nodes.d.ts +2 -2
- package/dist/transforms-node/insert-nodes.d.ts.map +1 -1
- package/dist/transforms-node/lift-nodes.d.ts +2 -2
- package/dist/transforms-node/lift-nodes.d.ts.map +1 -1
- package/dist/transforms-node/merge-nodes.d.ts +2 -2
- package/dist/transforms-node/merge-nodes.d.ts.map +1 -1
- package/dist/transforms-node/move-nodes.d.ts +2 -2
- package/dist/transforms-node/move-nodes.d.ts.map +1 -1
- package/dist/transforms-node/remove-nodes.d.ts +2 -2
- package/dist/transforms-node/remove-nodes.d.ts.map +1 -1
- package/dist/transforms-node/set-nodes.d.ts +2 -2
- package/dist/transforms-node/set-nodes.d.ts.map +1 -1
- package/dist/transforms-node/split-nodes.d.ts +2 -2
- package/dist/transforms-node/split-nodes.d.ts.map +1 -1
- package/dist/transforms-node/unset-nodes.d.ts +2 -2
- package/dist/transforms-node/unset-nodes.d.ts.map +1 -1
- package/dist/transforms-node/unwrap-nodes.d.ts +2 -2
- package/dist/transforms-node/unwrap-nodes.d.ts.map +1 -1
- package/dist/transforms-node/wrap-nodes.d.ts +2 -2
- package/dist/transforms-node/wrap-nodes.d.ts.map +1 -1
- package/dist/transforms-selection/collapse.d.ts +2 -2
- package/dist/transforms-selection/collapse.d.ts.map +1 -1
- package/dist/transforms-selection/deselect.d.ts +2 -2
- package/dist/transforms-selection/deselect.d.ts.map +1 -1
- package/dist/transforms-selection/index.d.ts +6 -6
- package/dist/transforms-selection/index.d.ts.map +1 -1
- package/dist/transforms-selection/move.d.ts +2 -2
- package/dist/transforms-selection/move.d.ts.map +1 -1
- package/dist/transforms-selection/select.d.ts +2 -2
- package/dist/transforms-selection/select.d.ts.map +1 -1
- package/dist/transforms-selection/set-point.d.ts +2 -2
- package/dist/transforms-selection/set-point.d.ts.map +1 -1
- package/dist/transforms-selection/set-selection.d.ts +2 -2
- package/dist/transforms-selection/set-selection.d.ts.map +1 -1
- package/dist/transforms-text/delete-text.d.ts +2 -2
- package/dist/transforms-text/delete-text.d.ts.map +1 -1
- package/dist/transforms-text/index.d.ts +2 -2
- package/dist/transforms-text/index.d.ts.map +1 -1
- package/dist/transforms-text/insert-fragment.d.ts +2 -2
- package/dist/transforms-text/insert-fragment.d.ts.map +1 -1
- package/dist/types/custom-types.d.ts +9 -9
- package/dist/types/custom-types.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +10 -10
- package/dist/types/types.d.ts.map +1 -1
- package/dist/utils/deep-equal.d.ts +1 -1
- package/dist/utils/deep-equal.d.ts.map +1 -1
- package/dist/utils/get-default-insert-location.d.ts +8 -8
- package/dist/utils/get-default-insert-location.d.ts.map +1 -1
- package/dist/utils/index.d.ts +6 -6
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/match-path.d.ts +4 -4
- package/dist/utils/match-path.d.ts.map +1 -1
- package/dist/utils/string.d.ts +17 -17
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/types.d.ts +4 -4
- package/dist/utils/types.d.ts.map +1 -1
- package/dist/utils/weak-maps.d.ts +8 -8
- package/dist/utils/weak-maps.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1,498 +1,498 @@
|
|
|
1
|
-
import { Ancestor, Descendant, Element, ExtendedType, Location, Node, NodeEntry, Operation, Path, PathRef, Point, PointRef, Range, RangeRef, Span, Text, Transforms } from '..';
|
|
2
|
-
import { LeafEdge, MaximizeMode, RangeDirection, SelectionMode, TextDirection, TextUnit, TextUnitAdjustment } from '../types/types';
|
|
3
|
-
import { OmitFirstArg } from '../utils/types';
|
|
4
|
-
import { TextInsertFragmentOptions, TextInsertTextOptions } from './transforms/text';
|
|
5
|
-
import { NodeInsertNodesOptions } from './transforms/node';
|
|
6
|
-
/**
|
|
7
|
-
* The `Editor` interface stores all the state of a Slate editor. It is extended
|
|
8
|
-
* by plugins that wish to add their own helpers and implement new behaviors.
|
|
9
|
-
*/
|
|
10
|
-
export interface BaseEditor {
|
|
11
|
-
children: Descendant[];
|
|
12
|
-
selection: Selection;
|
|
13
|
-
operations: Operation[];
|
|
14
|
-
marks: EditorMarks | null;
|
|
15
|
-
apply: (operation: Operation) => void;
|
|
16
|
-
getDirtyPaths: (operation: Operation) => Path[];
|
|
17
|
-
getFragment: () => Descendant[];
|
|
18
|
-
isElementReadOnly: (element: Element) => boolean;
|
|
19
|
-
isSelectable: (element: Element) => boolean;
|
|
20
|
-
markableVoid: (element: Element) => boolean;
|
|
21
|
-
normalizeNode: (entry: NodeEntry, options?: {
|
|
22
|
-
operation?: Operation;
|
|
23
|
-
}) => void;
|
|
24
|
-
onChange: (options?: {
|
|
25
|
-
operation?: Operation;
|
|
26
|
-
}) => void;
|
|
27
|
-
shouldNormalize: ({ iteration, dirtyPaths, operation, }: {
|
|
28
|
-
iteration: number;
|
|
29
|
-
initialDirtyPathsLength: number;
|
|
30
|
-
dirtyPaths: Path[];
|
|
31
|
-
operation?: Operation;
|
|
32
|
-
}) => boolean;
|
|
33
|
-
addMark: OmitFirstArg<typeof Editor.addMark>;
|
|
34
|
-
collapse: OmitFirstArg<typeof Transforms.collapse>;
|
|
35
|
-
delete: OmitFirstArg<typeof Transforms.delete>;
|
|
36
|
-
deleteBackward: (unit: TextUnit) => void;
|
|
37
|
-
deleteForward: (unit: TextUnit) => void;
|
|
38
|
-
deleteFragment: OmitFirstArg<typeof Editor.deleteFragment>;
|
|
39
|
-
deselect: OmitFirstArg<typeof Transforms.deselect>;
|
|
40
|
-
insertBreak: OmitFirstArg<typeof Editor.insertBreak>;
|
|
41
|
-
insertFragment: OmitFirstArg<typeof Transforms.insertFragment>;
|
|
42
|
-
insertNode: OmitFirstArg<typeof Editor.insertNode>;
|
|
43
|
-
insertNodes: OmitFirstArg<typeof Transforms.insertNodes>;
|
|
44
|
-
insertSoftBreak: OmitFirstArg<typeof Editor.insertSoftBreak>;
|
|
45
|
-
insertText: OmitFirstArg<typeof Transforms.insertText>;
|
|
46
|
-
liftNodes: OmitFirstArg<typeof Transforms.liftNodes>;
|
|
47
|
-
mergeNodes: OmitFirstArg<typeof Transforms.mergeNodes>;
|
|
48
|
-
move: OmitFirstArg<typeof Transforms.move>;
|
|
49
|
-
moveNodes: OmitFirstArg<typeof Transforms.moveNodes>;
|
|
50
|
-
normalize: OmitFirstArg<typeof Editor.normalize>;
|
|
51
|
-
removeMark: OmitFirstArg<typeof Editor.removeMark>;
|
|
52
|
-
removeNodes: OmitFirstArg<typeof Transforms.removeNodes>;
|
|
53
|
-
select: OmitFirstArg<typeof Transforms.select>;
|
|
54
|
-
setNodes: <T extends Node>(props: Partial<T>, options?: {
|
|
55
|
-
at?: Location;
|
|
56
|
-
match?: NodeMatch<T>;
|
|
57
|
-
mode?: MaximizeMode;
|
|
58
|
-
hanging?: boolean;
|
|
59
|
-
split?: boolean;
|
|
60
|
-
voids?: boolean;
|
|
61
|
-
compare?: PropsCompare;
|
|
62
|
-
merge?: PropsMerge;
|
|
63
|
-
}) => void;
|
|
64
|
-
setNormalizing: OmitFirstArg<typeof Editor.setNormalizing>;
|
|
65
|
-
setPoint: OmitFirstArg<typeof Transforms.setPoint>;
|
|
66
|
-
setSelection: OmitFirstArg<typeof Transforms.setSelection>;
|
|
67
|
-
splitNodes: OmitFirstArg<typeof Transforms.splitNodes>;
|
|
68
|
-
unsetNodes: OmitFirstArg<typeof Transforms.unsetNodes>;
|
|
69
|
-
unwrapNodes: OmitFirstArg<typeof Transforms.unwrapNodes>;
|
|
70
|
-
withoutNormalizing: OmitFirstArg<typeof Editor.withoutNormalizing>;
|
|
71
|
-
wrapNodes: OmitFirstArg<typeof Transforms.wrapNodes>;
|
|
72
|
-
above: <T extends Ancestor>(options?: EditorAboveOptions<T>) => NodeEntry<T> | undefined;
|
|
73
|
-
after: OmitFirstArg<typeof Editor.after>;
|
|
74
|
-
before: OmitFirstArg<typeof Editor.before>;
|
|
75
|
-
edges: OmitFirstArg<typeof Editor.edges>;
|
|
76
|
-
elementReadOnly: OmitFirstArg<typeof Editor.elementReadOnly>;
|
|
77
|
-
end: OmitFirstArg<typeof Editor.end>;
|
|
78
|
-
first: OmitFirstArg<typeof Editor.first>;
|
|
79
|
-
fragment: OmitFirstArg<typeof Editor.fragment>;
|
|
80
|
-
getMarks: OmitFirstArg<typeof Editor.marks>;
|
|
81
|
-
hasBlocks: OmitFirstArg<typeof Editor.hasBlocks>;
|
|
82
|
-
hasInlines: OmitFirstArg<typeof Editor.hasInlines>;
|
|
83
|
-
hasPath: OmitFirstArg<typeof Editor.hasPath>;
|
|
84
|
-
hasTexts: OmitFirstArg<typeof Editor.hasTexts>;
|
|
85
|
-
isBlock: OmitFirstArg<typeof Editor.isBlock>;
|
|
86
|
-
isEdge: OmitFirstArg<typeof Editor.isEdge>;
|
|
87
|
-
isEmpty: OmitFirstArg<typeof Editor.isEmpty>;
|
|
88
|
-
isEnd: OmitFirstArg<typeof Editor.isEnd>;
|
|
89
|
-
isInline: OmitFirstArg<typeof Editor.isInline>;
|
|
90
|
-
isNormalizing: OmitFirstArg<typeof Editor.isNormalizing>;
|
|
91
|
-
isStart: OmitFirstArg<typeof Editor.isStart>;
|
|
92
|
-
isVoid: OmitFirstArg<typeof Editor.isVoid>;
|
|
93
|
-
last: OmitFirstArg<typeof Editor.last>;
|
|
94
|
-
leaf: OmitFirstArg<typeof Editor.leaf>;
|
|
95
|
-
levels: <T extends Node>(options?: EditorLevelsOptions<T>) => Generator<NodeEntry<T>, void, undefined>;
|
|
96
|
-
next: <T extends Descendant>(options?: EditorNextOptions<T>) => NodeEntry<T> | undefined;
|
|
97
|
-
node: OmitFirstArg<typeof Editor.node>;
|
|
98
|
-
nodes: <T extends Node>(options?: EditorNodesOptions<T>) => Generator<NodeEntry<T>, void, undefined>;
|
|
99
|
-
parent: OmitFirstArg<typeof Editor.parent>;
|
|
100
|
-
path: OmitFirstArg<typeof Editor.path>;
|
|
101
|
-
pathRef: OmitFirstArg<typeof Editor.pathRef>;
|
|
102
|
-
pathRefs: OmitFirstArg<typeof Editor.pathRefs>;
|
|
103
|
-
point: OmitFirstArg<typeof Editor.point>;
|
|
104
|
-
pointRef: OmitFirstArg<typeof Editor.pointRef>;
|
|
105
|
-
pointRefs: OmitFirstArg<typeof Editor.pointRefs>;
|
|
106
|
-
positions: OmitFirstArg<typeof Editor.positions>;
|
|
107
|
-
previous: <T extends Node>(options?: EditorPreviousOptions<T>) => NodeEntry<T> | undefined;
|
|
108
|
-
range: OmitFirstArg<typeof Editor.range>;
|
|
109
|
-
rangeRef: OmitFirstArg<typeof Editor.rangeRef>;
|
|
110
|
-
rangeRefs: OmitFirstArg<typeof Editor.rangeRefs>;
|
|
111
|
-
start: OmitFirstArg<typeof Editor.start>;
|
|
112
|
-
string: OmitFirstArg<typeof Editor.string>;
|
|
113
|
-
unhangRange: OmitFirstArg<typeof Editor.unhangRange>;
|
|
114
|
-
void: OmitFirstArg<typeof Editor.void>;
|
|
115
|
-
}
|
|
116
|
-
export
|
|
117
|
-
export
|
|
118
|
-
export
|
|
119
|
-
export
|
|
120
|
-
export interface EditorAboveOptions<T extends Ancestor> {
|
|
121
|
-
at?: Location;
|
|
122
|
-
match?: NodeMatch<T>;
|
|
123
|
-
mode?: MaximizeMode;
|
|
124
|
-
voids?: boolean;
|
|
125
|
-
}
|
|
126
|
-
export interface EditorAfterOptions {
|
|
127
|
-
distance?: number;
|
|
128
|
-
unit?: TextUnitAdjustment;
|
|
129
|
-
voids?: boolean;
|
|
130
|
-
}
|
|
131
|
-
export interface EditorBeforeOptions {
|
|
132
|
-
distance?: number;
|
|
133
|
-
unit?: TextUnitAdjustment;
|
|
134
|
-
voids?: boolean;
|
|
135
|
-
}
|
|
136
|
-
export interface EditorDirectedDeletionOptions {
|
|
137
|
-
unit?: TextUnit;
|
|
138
|
-
}
|
|
139
|
-
export interface EditorElementReadOnlyOptions {
|
|
140
|
-
at?: Location;
|
|
141
|
-
mode?: MaximizeMode;
|
|
142
|
-
voids?: boolean;
|
|
143
|
-
}
|
|
144
|
-
export interface EditorFragmentDeletionOptions {
|
|
145
|
-
direction?: TextDirection;
|
|
146
|
-
}
|
|
147
|
-
export interface EditorLeafOptions {
|
|
148
|
-
depth?: number;
|
|
149
|
-
edge?: LeafEdge;
|
|
150
|
-
}
|
|
151
|
-
export interface EditorLevelsOptions<T extends Node> {
|
|
152
|
-
at?: Location;
|
|
153
|
-
match?: NodeMatch<T>;
|
|
154
|
-
reverse?: boolean;
|
|
155
|
-
voids?: boolean;
|
|
156
|
-
}
|
|
157
|
-
export interface EditorNextOptions<T extends Descendant> {
|
|
158
|
-
at?: Location;
|
|
159
|
-
match?: NodeMatch<T>;
|
|
160
|
-
mode?: SelectionMode;
|
|
161
|
-
voids?: boolean;
|
|
162
|
-
}
|
|
163
|
-
export interface EditorNodeOptions {
|
|
164
|
-
depth?: number;
|
|
165
|
-
edge?: LeafEdge;
|
|
166
|
-
}
|
|
167
|
-
export interface EditorNodesOptions<T extends Node> {
|
|
168
|
-
at?: Location | Span;
|
|
169
|
-
match?: NodeMatch<T>;
|
|
170
|
-
mode?: SelectionMode;
|
|
171
|
-
universal?: boolean;
|
|
172
|
-
reverse?: boolean;
|
|
173
|
-
voids?: boolean;
|
|
174
|
-
ignoreNonSelectable?: boolean;
|
|
175
|
-
}
|
|
176
|
-
export interface EditorNormalizeOptions {
|
|
177
|
-
force?: boolean;
|
|
178
|
-
operation?: Operation;
|
|
179
|
-
}
|
|
180
|
-
export interface EditorParentOptions {
|
|
181
|
-
depth?: number;
|
|
182
|
-
edge?: LeafEdge;
|
|
183
|
-
}
|
|
184
|
-
export interface EditorPathOptions {
|
|
185
|
-
depth?: number;
|
|
186
|
-
edge?: LeafEdge;
|
|
187
|
-
}
|
|
188
|
-
export interface EditorPathRefOptions {
|
|
189
|
-
affinity?: TextDirection | null;
|
|
190
|
-
}
|
|
191
|
-
export interface EditorPointOptions {
|
|
192
|
-
edge?: LeafEdge;
|
|
193
|
-
}
|
|
194
|
-
export interface EditorPointRefOptions {
|
|
195
|
-
affinity?: TextDirection | null;
|
|
196
|
-
}
|
|
197
|
-
export interface EditorPositionsOptions {
|
|
198
|
-
at?: Location;
|
|
199
|
-
unit?: TextUnitAdjustment;
|
|
200
|
-
reverse?: boolean;
|
|
201
|
-
voids?: boolean;
|
|
202
|
-
ignoreNonSelectable?: boolean;
|
|
203
|
-
}
|
|
204
|
-
export interface EditorPreviousOptions<T extends Node> {
|
|
205
|
-
at?: Location;
|
|
206
|
-
match?: NodeMatch<T>;
|
|
207
|
-
mode?: SelectionMode;
|
|
208
|
-
voids?: boolean;
|
|
209
|
-
}
|
|
210
|
-
export interface EditorRangeRefOptions {
|
|
211
|
-
affinity?: RangeDirection | null;
|
|
212
|
-
}
|
|
213
|
-
export interface EditorStringOptions {
|
|
214
|
-
voids?: boolean;
|
|
215
|
-
}
|
|
216
|
-
export interface EditorUnhangRangeOptions {
|
|
217
|
-
voids?: boolean;
|
|
218
|
-
}
|
|
219
|
-
export interface EditorVoidOptions {
|
|
220
|
-
at?: Location;
|
|
221
|
-
mode?: MaximizeMode;
|
|
222
|
-
voids?: boolean;
|
|
223
|
-
}
|
|
224
|
-
export interface EditorInterface {
|
|
225
|
-
/**
|
|
226
|
-
* Get the ancestor above a location in the document.
|
|
227
|
-
*/
|
|
228
|
-
above: <T extends Ancestor>(editor: Editor, options?: EditorAboveOptions<T>) => NodeEntry<T> | undefined;
|
|
229
|
-
/**
|
|
230
|
-
* Add a custom property to the leaf text nodes in the current selection.
|
|
231
|
-
*
|
|
232
|
-
* If the selection is currently collapsed, the marks will be added to the
|
|
233
|
-
* `editor.marks` property instead, and applied when text is inserted next.
|
|
234
|
-
*/
|
|
235
|
-
addMark: (editor: Editor, key: string, value: any) => void;
|
|
236
|
-
/**
|
|
237
|
-
* Get the point after a location.
|
|
238
|
-
*/
|
|
239
|
-
after: (editor: Editor, at: Location, options?: EditorAfterOptions) => Point | undefined;
|
|
240
|
-
/**
|
|
241
|
-
* Get the point before a location.
|
|
242
|
-
*/
|
|
243
|
-
before: (editor: Editor, at: Location, options?: EditorBeforeOptions) => Point | undefined;
|
|
244
|
-
/**
|
|
245
|
-
* Delete content in the editor backward from the current selection.
|
|
246
|
-
*/
|
|
247
|
-
deleteBackward: (editor: Editor, options?: EditorDirectedDeletionOptions) => void;
|
|
248
|
-
/**
|
|
249
|
-
* Delete content in the editor forward from the current selection.
|
|
250
|
-
*/
|
|
251
|
-
deleteForward: (editor: Editor, options?: EditorDirectedDeletionOptions) => void;
|
|
252
|
-
/**
|
|
253
|
-
* Delete the content in the current selection.
|
|
254
|
-
*/
|
|
255
|
-
deleteFragment: (editor: Editor, options?: EditorFragmentDeletionOptions) => void;
|
|
256
|
-
/**
|
|
257
|
-
* Get the start and end points of a location.
|
|
258
|
-
*/
|
|
259
|
-
edges: (editor: Editor, at: Location) => [Point, Point];
|
|
260
|
-
/**
|
|
261
|
-
* Match a read-only element in the current branch of the editor.
|
|
262
|
-
*/
|
|
263
|
-
elementReadOnly: (editor: Editor, options?: EditorElementReadOnlyOptions) => NodeEntry<Element> | undefined;
|
|
264
|
-
/**
|
|
265
|
-
* Get the end point of a location.
|
|
266
|
-
*/
|
|
267
|
-
end: (editor: Editor, at: Location) => Point;
|
|
268
|
-
/**
|
|
269
|
-
* Get the first node at a location.
|
|
270
|
-
*/
|
|
271
|
-
first: (editor: Editor, at: Location) => NodeEntry;
|
|
272
|
-
/**
|
|
273
|
-
* Get the fragment at a location.
|
|
274
|
-
*/
|
|
275
|
-
fragment: (editor: Editor, at: Location) => Descendant[];
|
|
276
|
-
/**
|
|
277
|
-
* Check if a node has block children.
|
|
278
|
-
*/
|
|
279
|
-
hasBlocks: (editor: Editor, element: Element) => boolean;
|
|
280
|
-
/**
|
|
281
|
-
* Check if a node has inline and text children.
|
|
282
|
-
*/
|
|
283
|
-
hasInlines: (editor: Editor, element: Element) => boolean;
|
|
284
|
-
hasPath: (editor: Editor, path: Path) => boolean;
|
|
285
|
-
/**
|
|
286
|
-
* Check if a node has text children.
|
|
287
|
-
*/
|
|
288
|
-
hasTexts: (editor: Editor, element: Element) => boolean;
|
|
289
|
-
/**
|
|
290
|
-
* Insert a block break at the current selection.
|
|
291
|
-
*
|
|
292
|
-
* If the selection is currently expanded, it will be deleted first.
|
|
293
|
-
*/
|
|
294
|
-
insertBreak: (editor: Editor) => void;
|
|
295
|
-
/**
|
|
296
|
-
* Inserts a fragment
|
|
297
|
-
* at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
|
|
298
|
-
*/
|
|
299
|
-
insertFragment: (editor: Editor, fragment: Node[], options?: TextInsertFragmentOptions) => void;
|
|
300
|
-
/**
|
|
301
|
-
* Atomically inserts `nodes`
|
|
302
|
-
* at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
|
|
303
|
-
*/
|
|
304
|
-
insertNode: <T extends Node>(editor: Editor, node: Node, options?: NodeInsertNodesOptions<T>) => void;
|
|
305
|
-
/**
|
|
306
|
-
* Insert a soft break at the current selection.
|
|
307
|
-
*
|
|
308
|
-
* If the selection is currently expanded, it will be deleted first.
|
|
309
|
-
*/
|
|
310
|
-
insertSoftBreak: (editor: Editor) => void;
|
|
311
|
-
/**
|
|
312
|
-
* Insert a string of text
|
|
313
|
-
* at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
|
|
314
|
-
*/
|
|
315
|
-
insertText: (editor: Editor, text: string, options?: TextInsertTextOptions) => void;
|
|
316
|
-
/**
|
|
317
|
-
* Check if a value is a block `Element` object.
|
|
318
|
-
*/
|
|
319
|
-
isBlock: (editor: Editor, value: Element) => boolean;
|
|
320
|
-
/**
|
|
321
|
-
* Check if a point is an edge of a location.
|
|
322
|
-
*/
|
|
323
|
-
isEdge: (editor: Editor, point: Point, at: Location) => boolean;
|
|
324
|
-
/**
|
|
325
|
-
* Check if a value is an `Editor` object.
|
|
326
|
-
*/
|
|
327
|
-
isEditor: (value: any) => value is Editor;
|
|
328
|
-
/**
|
|
329
|
-
* Check if a value is a read-only `Element` object.
|
|
330
|
-
*/
|
|
331
|
-
isElementReadOnly: (editor: Editor, element: Element) => boolean;
|
|
332
|
-
/**
|
|
333
|
-
* Check if an element is empty, accounting for void nodes.
|
|
334
|
-
*/
|
|
335
|
-
isEmpty: (editor: Editor, element: Element) => boolean;
|
|
336
|
-
/**
|
|
337
|
-
* Check if a point is the end point of a location.
|
|
338
|
-
*/
|
|
339
|
-
isEnd: (editor: Editor, point: Point, at: Location) => boolean;
|
|
340
|
-
/**
|
|
341
|
-
* Check if a value is an inline `Element` object.
|
|
342
|
-
*/
|
|
343
|
-
isInline: (editor: Editor, value: Element) => boolean;
|
|
344
|
-
/**
|
|
345
|
-
* Check if the editor is currently normalizing after each operation.
|
|
346
|
-
*/
|
|
347
|
-
isNormalizing: (editor: Editor) => boolean;
|
|
348
|
-
/**
|
|
349
|
-
* Check if a value is a selectable `Element` object.
|
|
350
|
-
*/
|
|
351
|
-
isSelectable: (editor: Editor, element: Element) => boolean;
|
|
352
|
-
/**
|
|
353
|
-
* Check if a point is the start point of a location.
|
|
354
|
-
*/
|
|
355
|
-
isStart: (editor: Editor, point: Point, at: Location) => boolean;
|
|
356
|
-
/**
|
|
357
|
-
* Check if a value is a void `Element` object.
|
|
358
|
-
*/
|
|
359
|
-
isVoid: (editor: Editor, value: Element) => boolean;
|
|
360
|
-
/**
|
|
361
|
-
* Get the last node at a location.
|
|
362
|
-
*/
|
|
363
|
-
last: (editor: Editor, at: Location) => NodeEntry;
|
|
364
|
-
/**
|
|
365
|
-
* Get the leaf text node at a location.
|
|
366
|
-
*/
|
|
367
|
-
leaf: (editor: Editor, at: Location, options?: EditorLeafOptions) => NodeEntry<Text>;
|
|
368
|
-
/**
|
|
369
|
-
* Iterate through all of the levels at a location.
|
|
370
|
-
*/
|
|
371
|
-
levels: <T extends Node>(editor: Editor, options?: EditorLevelsOptions<T>) => Generator<NodeEntry<T>, void, undefined>;
|
|
372
|
-
/**
|
|
373
|
-
* Get the marks that would be added to text at the current selection.
|
|
374
|
-
*/
|
|
375
|
-
marks: (editor: Editor) => Omit<Text, 'text'> | null;
|
|
376
|
-
/**
|
|
377
|
-
* Get the matching node in the branch of the document after a location.
|
|
378
|
-
*/
|
|
379
|
-
next: <T extends Descendant>(editor: Editor, options?: EditorNextOptions<T>) => NodeEntry<T> | undefined;
|
|
380
|
-
/**
|
|
381
|
-
* Get the node at a location.
|
|
382
|
-
*/
|
|
383
|
-
node: (editor: Editor, at: Location, options?: EditorNodeOptions) => NodeEntry;
|
|
384
|
-
/**
|
|
385
|
-
* Iterate through all of the nodes in the Editor.
|
|
386
|
-
*/
|
|
387
|
-
nodes: <T extends Node>(editor: Editor, options?: EditorNodesOptions<T>) => Generator<NodeEntry<T>, void, undefined>;
|
|
388
|
-
/**
|
|
389
|
-
* Normalize any dirty objects in the editor.
|
|
390
|
-
*/
|
|
391
|
-
normalize: (editor: Editor, options?: EditorNormalizeOptions) => void;
|
|
392
|
-
/**
|
|
393
|
-
* Get the parent node of a location.
|
|
394
|
-
*/
|
|
395
|
-
parent: (editor: Editor, at: Location, options?: EditorParentOptions) => NodeEntry<Ancestor>;
|
|
396
|
-
/**
|
|
397
|
-
* Get the path of a location.
|
|
398
|
-
*/
|
|
399
|
-
path: (editor: Editor, at: Location, options?: EditorPathOptions) => Path;
|
|
400
|
-
/**
|
|
401
|
-
* Create a mutable ref for a `Path` object, which will stay in sync as new
|
|
402
|
-
* operations are applied to the editor.
|
|
403
|
-
*/
|
|
404
|
-
pathRef: (editor: Editor, path: Path, options?: EditorPathRefOptions) => PathRef;
|
|
405
|
-
/**
|
|
406
|
-
* Get the set of currently tracked path refs of the editor.
|
|
407
|
-
*/
|
|
408
|
-
pathRefs: (editor: Editor) => Set<PathRef>;
|
|
409
|
-
/**
|
|
410
|
-
* Get the start or end point of a location.
|
|
411
|
-
*/
|
|
412
|
-
point: (editor: Editor, at: Location, options?: EditorPointOptions) => Point;
|
|
413
|
-
/**
|
|
414
|
-
* Create a mutable ref for a `Point` object, which will stay in sync as new
|
|
415
|
-
* operations are applied to the editor.
|
|
416
|
-
*/
|
|
417
|
-
pointRef: (editor: Editor, point: Point, options?: EditorPointRefOptions) => PointRef;
|
|
418
|
-
/**
|
|
419
|
-
* Get the set of currently tracked point refs of the editor.
|
|
420
|
-
*/
|
|
421
|
-
pointRefs: (editor: Editor) => Set<PointRef>;
|
|
422
|
-
/**
|
|
423
|
-
* Return all the positions in `at` range where a `Point` can be placed.
|
|
424
|
-
*
|
|
425
|
-
* By default, moves forward by individual offsets at a time, but
|
|
426
|
-
* the `unit` option can be used to to move by character, word, line, or block.
|
|
427
|
-
*
|
|
428
|
-
* The `reverse` option can be used to change iteration direction.
|
|
429
|
-
*
|
|
430
|
-
* Note: By default void nodes are treated as a single point and iteration
|
|
431
|
-
* will not happen inside their content unless you pass in true for the
|
|
432
|
-
* `voids` option, then iteration will occur.
|
|
433
|
-
*/
|
|
434
|
-
positions: (editor: Editor, options?: EditorPositionsOptions) => Generator<Point, void, undefined>;
|
|
435
|
-
/**
|
|
436
|
-
* Get the matching node in the branch of the document before a location.
|
|
437
|
-
*/
|
|
438
|
-
previous: <T extends Node>(editor: Editor, options?: EditorPreviousOptions<T>) => NodeEntry<T> | undefined;
|
|
439
|
-
/**
|
|
440
|
-
* Get a range of a location.
|
|
441
|
-
*/
|
|
442
|
-
range: (editor: Editor, at: Location, to?: Location) => Range;
|
|
443
|
-
/**
|
|
444
|
-
* Create a mutable ref for a `Range` object, which will stay in sync as new
|
|
445
|
-
* operations are applied to the editor.
|
|
446
|
-
*/
|
|
447
|
-
rangeRef: (editor: Editor, range: Range, options?: EditorRangeRefOptions) => RangeRef;
|
|
448
|
-
/**
|
|
449
|
-
* Get the set of currently tracked range refs of the editor.
|
|
450
|
-
*/
|
|
451
|
-
rangeRefs: (editor: Editor) => Set<RangeRef>;
|
|
452
|
-
/**
|
|
453
|
-
* Remove a custom property from all of the leaf text nodes in the current
|
|
454
|
-
* selection.
|
|
455
|
-
*
|
|
456
|
-
* If the selection is currently collapsed, the removal will be stored on
|
|
457
|
-
* `editor.marks` and applied to the text inserted next.
|
|
458
|
-
*/
|
|
459
|
-
removeMark: (editor: Editor, key: string) => void;
|
|
460
|
-
/**
|
|
461
|
-
* Manually set if the editor should currently be normalizing.
|
|
462
|
-
*
|
|
463
|
-
* Note: Using this incorrectly can leave the editor in an invalid state.
|
|
464
|
-
*
|
|
465
|
-
*/
|
|
466
|
-
setNormalizing: (editor: Editor, isNormalizing: boolean) => void;
|
|
467
|
-
/**
|
|
468
|
-
* Get the start point of a location.
|
|
469
|
-
*/
|
|
470
|
-
start: (editor: Editor, at: Location) => Point;
|
|
471
|
-
/**
|
|
472
|
-
* Get the text string content of a location.
|
|
473
|
-
*
|
|
474
|
-
* Note: by default the text of void nodes is considered to be an empty
|
|
475
|
-
* string, regardless of content, unless you pass in true for the voids option
|
|
476
|
-
*/
|
|
477
|
-
string: (editor: Editor, at: Location, options?: EditorStringOptions) => string;
|
|
478
|
-
/**
|
|
479
|
-
* Convert a range into a non-hanging one.
|
|
480
|
-
*/
|
|
481
|
-
unhangRange: (editor: Editor, range: Range, options?: EditorUnhangRangeOptions) => Range;
|
|
482
|
-
/**
|
|
483
|
-
* Match a void node in the current branch of the editor.
|
|
484
|
-
*/
|
|
485
|
-
void: (editor: Editor, options?: EditorVoidOptions) => NodeEntry<Element> | undefined;
|
|
486
|
-
/**
|
|
487
|
-
* Call a function, deferring normalization until after it completes.
|
|
488
|
-
*/
|
|
489
|
-
withoutNormalizing: (editor: Editor, fn: () => void) => void;
|
|
490
|
-
}
|
|
491
|
-
export declare const Editor: EditorInterface;
|
|
492
|
-
/**
|
|
493
|
-
* A helper type for narrowing matched nodes with a predicate.
|
|
494
|
-
*/
|
|
495
|
-
export
|
|
496
|
-
export
|
|
497
|
-
export
|
|
1
|
+
import { Ancestor, Descendant, Element, ExtendedType, Location, Node, NodeEntry, Operation, Path, PathRef, Point, PointRef, Range, RangeRef, Span, Text, Transforms } from '..';
|
|
2
|
+
import { LeafEdge, MaximizeMode, RangeDirection, SelectionMode, TextDirection, TextUnit, TextUnitAdjustment } from '../types/types';
|
|
3
|
+
import { OmitFirstArg } from '../utils/types';
|
|
4
|
+
import { TextInsertFragmentOptions, TextInsertTextOptions } from './transforms/text';
|
|
5
|
+
import { NodeInsertNodesOptions } from './transforms/node';
|
|
6
|
+
/**
|
|
7
|
+
* The `Editor` interface stores all the state of a Slate editor. It is extended
|
|
8
|
+
* by plugins that wish to add their own helpers and implement new behaviors.
|
|
9
|
+
*/
|
|
10
|
+
export interface BaseEditor {
|
|
11
|
+
children: Descendant[];
|
|
12
|
+
selection: Selection;
|
|
13
|
+
operations: Operation[];
|
|
14
|
+
marks: EditorMarks | null;
|
|
15
|
+
apply: (operation: Operation) => void;
|
|
16
|
+
getDirtyPaths: (operation: Operation) => Path[];
|
|
17
|
+
getFragment: () => Descendant[];
|
|
18
|
+
isElementReadOnly: (element: Element) => boolean;
|
|
19
|
+
isSelectable: (element: Element) => boolean;
|
|
20
|
+
markableVoid: (element: Element) => boolean;
|
|
21
|
+
normalizeNode: (entry: NodeEntry, options?: {
|
|
22
|
+
operation?: Operation;
|
|
23
|
+
}) => void;
|
|
24
|
+
onChange: (options?: {
|
|
25
|
+
operation?: Operation;
|
|
26
|
+
}) => void;
|
|
27
|
+
shouldNormalize: ({ iteration, dirtyPaths, operation, }: {
|
|
28
|
+
iteration: number;
|
|
29
|
+
initialDirtyPathsLength: number;
|
|
30
|
+
dirtyPaths: Path[];
|
|
31
|
+
operation?: Operation;
|
|
32
|
+
}) => boolean;
|
|
33
|
+
addMark: OmitFirstArg<typeof Editor.addMark>;
|
|
34
|
+
collapse: OmitFirstArg<typeof Transforms.collapse>;
|
|
35
|
+
delete: OmitFirstArg<typeof Transforms.delete>;
|
|
36
|
+
deleteBackward: (unit: TextUnit) => void;
|
|
37
|
+
deleteForward: (unit: TextUnit) => void;
|
|
38
|
+
deleteFragment: OmitFirstArg<typeof Editor.deleteFragment>;
|
|
39
|
+
deselect: OmitFirstArg<typeof Transforms.deselect>;
|
|
40
|
+
insertBreak: OmitFirstArg<typeof Editor.insertBreak>;
|
|
41
|
+
insertFragment: OmitFirstArg<typeof Transforms.insertFragment>;
|
|
42
|
+
insertNode: OmitFirstArg<typeof Editor.insertNode>;
|
|
43
|
+
insertNodes: OmitFirstArg<typeof Transforms.insertNodes>;
|
|
44
|
+
insertSoftBreak: OmitFirstArg<typeof Editor.insertSoftBreak>;
|
|
45
|
+
insertText: OmitFirstArg<typeof Transforms.insertText>;
|
|
46
|
+
liftNodes: OmitFirstArg<typeof Transforms.liftNodes>;
|
|
47
|
+
mergeNodes: OmitFirstArg<typeof Transforms.mergeNodes>;
|
|
48
|
+
move: OmitFirstArg<typeof Transforms.move>;
|
|
49
|
+
moveNodes: OmitFirstArg<typeof Transforms.moveNodes>;
|
|
50
|
+
normalize: OmitFirstArg<typeof Editor.normalize>;
|
|
51
|
+
removeMark: OmitFirstArg<typeof Editor.removeMark>;
|
|
52
|
+
removeNodes: OmitFirstArg<typeof Transforms.removeNodes>;
|
|
53
|
+
select: OmitFirstArg<typeof Transforms.select>;
|
|
54
|
+
setNodes: <T extends Node>(props: Partial<T>, options?: {
|
|
55
|
+
at?: Location;
|
|
56
|
+
match?: NodeMatch<T>;
|
|
57
|
+
mode?: MaximizeMode;
|
|
58
|
+
hanging?: boolean;
|
|
59
|
+
split?: boolean;
|
|
60
|
+
voids?: boolean;
|
|
61
|
+
compare?: PropsCompare;
|
|
62
|
+
merge?: PropsMerge;
|
|
63
|
+
}) => void;
|
|
64
|
+
setNormalizing: OmitFirstArg<typeof Editor.setNormalizing>;
|
|
65
|
+
setPoint: OmitFirstArg<typeof Transforms.setPoint>;
|
|
66
|
+
setSelection: OmitFirstArg<typeof Transforms.setSelection>;
|
|
67
|
+
splitNodes: OmitFirstArg<typeof Transforms.splitNodes>;
|
|
68
|
+
unsetNodes: OmitFirstArg<typeof Transforms.unsetNodes>;
|
|
69
|
+
unwrapNodes: OmitFirstArg<typeof Transforms.unwrapNodes>;
|
|
70
|
+
withoutNormalizing: OmitFirstArg<typeof Editor.withoutNormalizing>;
|
|
71
|
+
wrapNodes: OmitFirstArg<typeof Transforms.wrapNodes>;
|
|
72
|
+
above: <T extends Ancestor>(options?: EditorAboveOptions<T>) => NodeEntry<T> | undefined;
|
|
73
|
+
after: OmitFirstArg<typeof Editor.after>;
|
|
74
|
+
before: OmitFirstArg<typeof Editor.before>;
|
|
75
|
+
edges: OmitFirstArg<typeof Editor.edges>;
|
|
76
|
+
elementReadOnly: OmitFirstArg<typeof Editor.elementReadOnly>;
|
|
77
|
+
end: OmitFirstArg<typeof Editor.end>;
|
|
78
|
+
first: OmitFirstArg<typeof Editor.first>;
|
|
79
|
+
fragment: OmitFirstArg<typeof Editor.fragment>;
|
|
80
|
+
getMarks: OmitFirstArg<typeof Editor.marks>;
|
|
81
|
+
hasBlocks: OmitFirstArg<typeof Editor.hasBlocks>;
|
|
82
|
+
hasInlines: OmitFirstArg<typeof Editor.hasInlines>;
|
|
83
|
+
hasPath: OmitFirstArg<typeof Editor.hasPath>;
|
|
84
|
+
hasTexts: OmitFirstArg<typeof Editor.hasTexts>;
|
|
85
|
+
isBlock: OmitFirstArg<typeof Editor.isBlock>;
|
|
86
|
+
isEdge: OmitFirstArg<typeof Editor.isEdge>;
|
|
87
|
+
isEmpty: OmitFirstArg<typeof Editor.isEmpty>;
|
|
88
|
+
isEnd: OmitFirstArg<typeof Editor.isEnd>;
|
|
89
|
+
isInline: OmitFirstArg<typeof Editor.isInline>;
|
|
90
|
+
isNormalizing: OmitFirstArg<typeof Editor.isNormalizing>;
|
|
91
|
+
isStart: OmitFirstArg<typeof Editor.isStart>;
|
|
92
|
+
isVoid: OmitFirstArg<typeof Editor.isVoid>;
|
|
93
|
+
last: OmitFirstArg<typeof Editor.last>;
|
|
94
|
+
leaf: OmitFirstArg<typeof Editor.leaf>;
|
|
95
|
+
levels: <T extends Node>(options?: EditorLevelsOptions<T>) => Generator<NodeEntry<T>, void, undefined>;
|
|
96
|
+
next: <T extends Descendant>(options?: EditorNextOptions<T>) => NodeEntry<T> | undefined;
|
|
97
|
+
node: OmitFirstArg<typeof Editor.node>;
|
|
98
|
+
nodes: <T extends Node>(options?: EditorNodesOptions<T>) => Generator<NodeEntry<T>, void, undefined>;
|
|
99
|
+
parent: OmitFirstArg<typeof Editor.parent>;
|
|
100
|
+
path: OmitFirstArg<typeof Editor.path>;
|
|
101
|
+
pathRef: OmitFirstArg<typeof Editor.pathRef>;
|
|
102
|
+
pathRefs: OmitFirstArg<typeof Editor.pathRefs>;
|
|
103
|
+
point: OmitFirstArg<typeof Editor.point>;
|
|
104
|
+
pointRef: OmitFirstArg<typeof Editor.pointRef>;
|
|
105
|
+
pointRefs: OmitFirstArg<typeof Editor.pointRefs>;
|
|
106
|
+
positions: OmitFirstArg<typeof Editor.positions>;
|
|
107
|
+
previous: <T extends Node>(options?: EditorPreviousOptions<T>) => NodeEntry<T> | undefined;
|
|
108
|
+
range: OmitFirstArg<typeof Editor.range>;
|
|
109
|
+
rangeRef: OmitFirstArg<typeof Editor.rangeRef>;
|
|
110
|
+
rangeRefs: OmitFirstArg<typeof Editor.rangeRefs>;
|
|
111
|
+
start: OmitFirstArg<typeof Editor.start>;
|
|
112
|
+
string: OmitFirstArg<typeof Editor.string>;
|
|
113
|
+
unhangRange: OmitFirstArg<typeof Editor.unhangRange>;
|
|
114
|
+
void: OmitFirstArg<typeof Editor.void>;
|
|
115
|
+
}
|
|
116
|
+
export type Editor = ExtendedType<'Editor', BaseEditor>;
|
|
117
|
+
export type BaseSelection = Range | null;
|
|
118
|
+
export type Selection = ExtendedType<'Selection', BaseSelection>;
|
|
119
|
+
export type EditorMarks = Omit<Text, 'text'>;
|
|
120
|
+
export interface EditorAboveOptions<T extends Ancestor> {
|
|
121
|
+
at?: Location;
|
|
122
|
+
match?: NodeMatch<T>;
|
|
123
|
+
mode?: MaximizeMode;
|
|
124
|
+
voids?: boolean;
|
|
125
|
+
}
|
|
126
|
+
export interface EditorAfterOptions {
|
|
127
|
+
distance?: number;
|
|
128
|
+
unit?: TextUnitAdjustment;
|
|
129
|
+
voids?: boolean;
|
|
130
|
+
}
|
|
131
|
+
export interface EditorBeforeOptions {
|
|
132
|
+
distance?: number;
|
|
133
|
+
unit?: TextUnitAdjustment;
|
|
134
|
+
voids?: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface EditorDirectedDeletionOptions {
|
|
137
|
+
unit?: TextUnit;
|
|
138
|
+
}
|
|
139
|
+
export interface EditorElementReadOnlyOptions {
|
|
140
|
+
at?: Location;
|
|
141
|
+
mode?: MaximizeMode;
|
|
142
|
+
voids?: boolean;
|
|
143
|
+
}
|
|
144
|
+
export interface EditorFragmentDeletionOptions {
|
|
145
|
+
direction?: TextDirection;
|
|
146
|
+
}
|
|
147
|
+
export interface EditorLeafOptions {
|
|
148
|
+
depth?: number;
|
|
149
|
+
edge?: LeafEdge;
|
|
150
|
+
}
|
|
151
|
+
export interface EditorLevelsOptions<T extends Node> {
|
|
152
|
+
at?: Location;
|
|
153
|
+
match?: NodeMatch<T>;
|
|
154
|
+
reverse?: boolean;
|
|
155
|
+
voids?: boolean;
|
|
156
|
+
}
|
|
157
|
+
export interface EditorNextOptions<T extends Descendant> {
|
|
158
|
+
at?: Location;
|
|
159
|
+
match?: NodeMatch<T>;
|
|
160
|
+
mode?: SelectionMode;
|
|
161
|
+
voids?: boolean;
|
|
162
|
+
}
|
|
163
|
+
export interface EditorNodeOptions {
|
|
164
|
+
depth?: number;
|
|
165
|
+
edge?: LeafEdge;
|
|
166
|
+
}
|
|
167
|
+
export interface EditorNodesOptions<T extends Node> {
|
|
168
|
+
at?: Location | Span;
|
|
169
|
+
match?: NodeMatch<T>;
|
|
170
|
+
mode?: SelectionMode;
|
|
171
|
+
universal?: boolean;
|
|
172
|
+
reverse?: boolean;
|
|
173
|
+
voids?: boolean;
|
|
174
|
+
ignoreNonSelectable?: boolean;
|
|
175
|
+
}
|
|
176
|
+
export interface EditorNormalizeOptions {
|
|
177
|
+
force?: boolean;
|
|
178
|
+
operation?: Operation;
|
|
179
|
+
}
|
|
180
|
+
export interface EditorParentOptions {
|
|
181
|
+
depth?: number;
|
|
182
|
+
edge?: LeafEdge;
|
|
183
|
+
}
|
|
184
|
+
export interface EditorPathOptions {
|
|
185
|
+
depth?: number;
|
|
186
|
+
edge?: LeafEdge;
|
|
187
|
+
}
|
|
188
|
+
export interface EditorPathRefOptions {
|
|
189
|
+
affinity?: TextDirection | null;
|
|
190
|
+
}
|
|
191
|
+
export interface EditorPointOptions {
|
|
192
|
+
edge?: LeafEdge;
|
|
193
|
+
}
|
|
194
|
+
export interface EditorPointRefOptions {
|
|
195
|
+
affinity?: TextDirection | null;
|
|
196
|
+
}
|
|
197
|
+
export interface EditorPositionsOptions {
|
|
198
|
+
at?: Location;
|
|
199
|
+
unit?: TextUnitAdjustment;
|
|
200
|
+
reverse?: boolean;
|
|
201
|
+
voids?: boolean;
|
|
202
|
+
ignoreNonSelectable?: boolean;
|
|
203
|
+
}
|
|
204
|
+
export interface EditorPreviousOptions<T extends Node> {
|
|
205
|
+
at?: Location;
|
|
206
|
+
match?: NodeMatch<T>;
|
|
207
|
+
mode?: SelectionMode;
|
|
208
|
+
voids?: boolean;
|
|
209
|
+
}
|
|
210
|
+
export interface EditorRangeRefOptions {
|
|
211
|
+
affinity?: RangeDirection | null;
|
|
212
|
+
}
|
|
213
|
+
export interface EditorStringOptions {
|
|
214
|
+
voids?: boolean;
|
|
215
|
+
}
|
|
216
|
+
export interface EditorUnhangRangeOptions {
|
|
217
|
+
voids?: boolean;
|
|
218
|
+
}
|
|
219
|
+
export interface EditorVoidOptions {
|
|
220
|
+
at?: Location;
|
|
221
|
+
mode?: MaximizeMode;
|
|
222
|
+
voids?: boolean;
|
|
223
|
+
}
|
|
224
|
+
export interface EditorInterface {
|
|
225
|
+
/**
|
|
226
|
+
* Get the ancestor above a location in the document.
|
|
227
|
+
*/
|
|
228
|
+
above: <T extends Ancestor>(editor: Editor, options?: EditorAboveOptions<T>) => NodeEntry<T> | undefined;
|
|
229
|
+
/**
|
|
230
|
+
* Add a custom property to the leaf text nodes in the current selection.
|
|
231
|
+
*
|
|
232
|
+
* If the selection is currently collapsed, the marks will be added to the
|
|
233
|
+
* `editor.marks` property instead, and applied when text is inserted next.
|
|
234
|
+
*/
|
|
235
|
+
addMark: (editor: Editor, key: string, value: any) => void;
|
|
236
|
+
/**
|
|
237
|
+
* Get the point after a location.
|
|
238
|
+
*/
|
|
239
|
+
after: (editor: Editor, at: Location, options?: EditorAfterOptions) => Point | undefined;
|
|
240
|
+
/**
|
|
241
|
+
* Get the point before a location.
|
|
242
|
+
*/
|
|
243
|
+
before: (editor: Editor, at: Location, options?: EditorBeforeOptions) => Point | undefined;
|
|
244
|
+
/**
|
|
245
|
+
* Delete content in the editor backward from the current selection.
|
|
246
|
+
*/
|
|
247
|
+
deleteBackward: (editor: Editor, options?: EditorDirectedDeletionOptions) => void;
|
|
248
|
+
/**
|
|
249
|
+
* Delete content in the editor forward from the current selection.
|
|
250
|
+
*/
|
|
251
|
+
deleteForward: (editor: Editor, options?: EditorDirectedDeletionOptions) => void;
|
|
252
|
+
/**
|
|
253
|
+
* Delete the content in the current selection.
|
|
254
|
+
*/
|
|
255
|
+
deleteFragment: (editor: Editor, options?: EditorFragmentDeletionOptions) => void;
|
|
256
|
+
/**
|
|
257
|
+
* Get the start and end points of a location.
|
|
258
|
+
*/
|
|
259
|
+
edges: (editor: Editor, at: Location) => [Point, Point];
|
|
260
|
+
/**
|
|
261
|
+
* Match a read-only element in the current branch of the editor.
|
|
262
|
+
*/
|
|
263
|
+
elementReadOnly: (editor: Editor, options?: EditorElementReadOnlyOptions) => NodeEntry<Element> | undefined;
|
|
264
|
+
/**
|
|
265
|
+
* Get the end point of a location.
|
|
266
|
+
*/
|
|
267
|
+
end: (editor: Editor, at: Location) => Point;
|
|
268
|
+
/**
|
|
269
|
+
* Get the first node at a location.
|
|
270
|
+
*/
|
|
271
|
+
first: (editor: Editor, at: Location) => NodeEntry;
|
|
272
|
+
/**
|
|
273
|
+
* Get the fragment at a location.
|
|
274
|
+
*/
|
|
275
|
+
fragment: (editor: Editor, at: Location) => Descendant[];
|
|
276
|
+
/**
|
|
277
|
+
* Check if a node has block children.
|
|
278
|
+
*/
|
|
279
|
+
hasBlocks: (editor: Editor, element: Element) => boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Check if a node has inline and text children.
|
|
282
|
+
*/
|
|
283
|
+
hasInlines: (editor: Editor, element: Element) => boolean;
|
|
284
|
+
hasPath: (editor: Editor, path: Path) => boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Check if a node has text children.
|
|
287
|
+
*/
|
|
288
|
+
hasTexts: (editor: Editor, element: Element) => boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Insert a block break at the current selection.
|
|
291
|
+
*
|
|
292
|
+
* If the selection is currently expanded, it will be deleted first.
|
|
293
|
+
*/
|
|
294
|
+
insertBreak: (editor: Editor) => void;
|
|
295
|
+
/**
|
|
296
|
+
* Inserts a fragment
|
|
297
|
+
* at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
|
|
298
|
+
*/
|
|
299
|
+
insertFragment: (editor: Editor, fragment: Node[], options?: TextInsertFragmentOptions) => void;
|
|
300
|
+
/**
|
|
301
|
+
* Atomically inserts `nodes`
|
|
302
|
+
* at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
|
|
303
|
+
*/
|
|
304
|
+
insertNode: <T extends Node>(editor: Editor, node: Node, options?: NodeInsertNodesOptions<T>) => void;
|
|
305
|
+
/**
|
|
306
|
+
* Insert a soft break at the current selection.
|
|
307
|
+
*
|
|
308
|
+
* If the selection is currently expanded, it will be deleted first.
|
|
309
|
+
*/
|
|
310
|
+
insertSoftBreak: (editor: Editor) => void;
|
|
311
|
+
/**
|
|
312
|
+
* Insert a string of text
|
|
313
|
+
* at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
|
|
314
|
+
*/
|
|
315
|
+
insertText: (editor: Editor, text: string, options?: TextInsertTextOptions) => void;
|
|
316
|
+
/**
|
|
317
|
+
* Check if a value is a block `Element` object.
|
|
318
|
+
*/
|
|
319
|
+
isBlock: (editor: Editor, value: Element) => boolean;
|
|
320
|
+
/**
|
|
321
|
+
* Check if a point is an edge of a location.
|
|
322
|
+
*/
|
|
323
|
+
isEdge: (editor: Editor, point: Point, at: Location) => boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Check if a value is an `Editor` object.
|
|
326
|
+
*/
|
|
327
|
+
isEditor: (value: any) => value is Editor;
|
|
328
|
+
/**
|
|
329
|
+
* Check if a value is a read-only `Element` object.
|
|
330
|
+
*/
|
|
331
|
+
isElementReadOnly: (editor: Editor, element: Element) => boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Check if an element is empty, accounting for void nodes.
|
|
334
|
+
*/
|
|
335
|
+
isEmpty: (editor: Editor, element: Element) => boolean;
|
|
336
|
+
/**
|
|
337
|
+
* Check if a point is the end point of a location.
|
|
338
|
+
*/
|
|
339
|
+
isEnd: (editor: Editor, point: Point, at: Location) => boolean;
|
|
340
|
+
/**
|
|
341
|
+
* Check if a value is an inline `Element` object.
|
|
342
|
+
*/
|
|
343
|
+
isInline: (editor: Editor, value: Element) => boolean;
|
|
344
|
+
/**
|
|
345
|
+
* Check if the editor is currently normalizing after each operation.
|
|
346
|
+
*/
|
|
347
|
+
isNormalizing: (editor: Editor) => boolean;
|
|
348
|
+
/**
|
|
349
|
+
* Check if a value is a selectable `Element` object.
|
|
350
|
+
*/
|
|
351
|
+
isSelectable: (editor: Editor, element: Element) => boolean;
|
|
352
|
+
/**
|
|
353
|
+
* Check if a point is the start point of a location.
|
|
354
|
+
*/
|
|
355
|
+
isStart: (editor: Editor, point: Point, at: Location) => boolean;
|
|
356
|
+
/**
|
|
357
|
+
* Check if a value is a void `Element` object.
|
|
358
|
+
*/
|
|
359
|
+
isVoid: (editor: Editor, value: Element) => boolean;
|
|
360
|
+
/**
|
|
361
|
+
* Get the last node at a location.
|
|
362
|
+
*/
|
|
363
|
+
last: (editor: Editor, at: Location) => NodeEntry;
|
|
364
|
+
/**
|
|
365
|
+
* Get the leaf text node at a location.
|
|
366
|
+
*/
|
|
367
|
+
leaf: (editor: Editor, at: Location, options?: EditorLeafOptions) => NodeEntry<Text>;
|
|
368
|
+
/**
|
|
369
|
+
* Iterate through all of the levels at a location.
|
|
370
|
+
*/
|
|
371
|
+
levels: <T extends Node>(editor: Editor, options?: EditorLevelsOptions<T>) => Generator<NodeEntry<T>, void, undefined>;
|
|
372
|
+
/**
|
|
373
|
+
* Get the marks that would be added to text at the current selection.
|
|
374
|
+
*/
|
|
375
|
+
marks: (editor: Editor) => Omit<Text, 'text'> | null;
|
|
376
|
+
/**
|
|
377
|
+
* Get the matching node in the branch of the document after a location.
|
|
378
|
+
*/
|
|
379
|
+
next: <T extends Descendant>(editor: Editor, options?: EditorNextOptions<T>) => NodeEntry<T> | undefined;
|
|
380
|
+
/**
|
|
381
|
+
* Get the node at a location.
|
|
382
|
+
*/
|
|
383
|
+
node: (editor: Editor, at: Location, options?: EditorNodeOptions) => NodeEntry;
|
|
384
|
+
/**
|
|
385
|
+
* Iterate through all of the nodes in the Editor.
|
|
386
|
+
*/
|
|
387
|
+
nodes: <T extends Node>(editor: Editor, options?: EditorNodesOptions<T>) => Generator<NodeEntry<T>, void, undefined>;
|
|
388
|
+
/**
|
|
389
|
+
* Normalize any dirty objects in the editor.
|
|
390
|
+
*/
|
|
391
|
+
normalize: (editor: Editor, options?: EditorNormalizeOptions) => void;
|
|
392
|
+
/**
|
|
393
|
+
* Get the parent node of a location.
|
|
394
|
+
*/
|
|
395
|
+
parent: (editor: Editor, at: Location, options?: EditorParentOptions) => NodeEntry<Ancestor>;
|
|
396
|
+
/**
|
|
397
|
+
* Get the path of a location.
|
|
398
|
+
*/
|
|
399
|
+
path: (editor: Editor, at: Location, options?: EditorPathOptions) => Path;
|
|
400
|
+
/**
|
|
401
|
+
* Create a mutable ref for a `Path` object, which will stay in sync as new
|
|
402
|
+
* operations are applied to the editor.
|
|
403
|
+
*/
|
|
404
|
+
pathRef: (editor: Editor, path: Path, options?: EditorPathRefOptions) => PathRef;
|
|
405
|
+
/**
|
|
406
|
+
* Get the set of currently tracked path refs of the editor.
|
|
407
|
+
*/
|
|
408
|
+
pathRefs: (editor: Editor) => Set<PathRef>;
|
|
409
|
+
/**
|
|
410
|
+
* Get the start or end point of a location.
|
|
411
|
+
*/
|
|
412
|
+
point: (editor: Editor, at: Location, options?: EditorPointOptions) => Point;
|
|
413
|
+
/**
|
|
414
|
+
* Create a mutable ref for a `Point` object, which will stay in sync as new
|
|
415
|
+
* operations are applied to the editor.
|
|
416
|
+
*/
|
|
417
|
+
pointRef: (editor: Editor, point: Point, options?: EditorPointRefOptions) => PointRef;
|
|
418
|
+
/**
|
|
419
|
+
* Get the set of currently tracked point refs of the editor.
|
|
420
|
+
*/
|
|
421
|
+
pointRefs: (editor: Editor) => Set<PointRef>;
|
|
422
|
+
/**
|
|
423
|
+
* Return all the positions in `at` range where a `Point` can be placed.
|
|
424
|
+
*
|
|
425
|
+
* By default, moves forward by individual offsets at a time, but
|
|
426
|
+
* the `unit` option can be used to to move by character, word, line, or block.
|
|
427
|
+
*
|
|
428
|
+
* The `reverse` option can be used to change iteration direction.
|
|
429
|
+
*
|
|
430
|
+
* Note: By default void nodes are treated as a single point and iteration
|
|
431
|
+
* will not happen inside their content unless you pass in true for the
|
|
432
|
+
* `voids` option, then iteration will occur.
|
|
433
|
+
*/
|
|
434
|
+
positions: (editor: Editor, options?: EditorPositionsOptions) => Generator<Point, void, undefined>;
|
|
435
|
+
/**
|
|
436
|
+
* Get the matching node in the branch of the document before a location.
|
|
437
|
+
*/
|
|
438
|
+
previous: <T extends Node>(editor: Editor, options?: EditorPreviousOptions<T>) => NodeEntry<T> | undefined;
|
|
439
|
+
/**
|
|
440
|
+
* Get a range of a location.
|
|
441
|
+
*/
|
|
442
|
+
range: (editor: Editor, at: Location, to?: Location) => Range;
|
|
443
|
+
/**
|
|
444
|
+
* Create a mutable ref for a `Range` object, which will stay in sync as new
|
|
445
|
+
* operations are applied to the editor.
|
|
446
|
+
*/
|
|
447
|
+
rangeRef: (editor: Editor, range: Range, options?: EditorRangeRefOptions) => RangeRef;
|
|
448
|
+
/**
|
|
449
|
+
* Get the set of currently tracked range refs of the editor.
|
|
450
|
+
*/
|
|
451
|
+
rangeRefs: (editor: Editor) => Set<RangeRef>;
|
|
452
|
+
/**
|
|
453
|
+
* Remove a custom property from all of the leaf text nodes in the current
|
|
454
|
+
* selection.
|
|
455
|
+
*
|
|
456
|
+
* If the selection is currently collapsed, the removal will be stored on
|
|
457
|
+
* `editor.marks` and applied to the text inserted next.
|
|
458
|
+
*/
|
|
459
|
+
removeMark: (editor: Editor, key: string) => void;
|
|
460
|
+
/**
|
|
461
|
+
* Manually set if the editor should currently be normalizing.
|
|
462
|
+
*
|
|
463
|
+
* Note: Using this incorrectly can leave the editor in an invalid state.
|
|
464
|
+
*
|
|
465
|
+
*/
|
|
466
|
+
setNormalizing: (editor: Editor, isNormalizing: boolean) => void;
|
|
467
|
+
/**
|
|
468
|
+
* Get the start point of a location.
|
|
469
|
+
*/
|
|
470
|
+
start: (editor: Editor, at: Location) => Point;
|
|
471
|
+
/**
|
|
472
|
+
* Get the text string content of a location.
|
|
473
|
+
*
|
|
474
|
+
* Note: by default the text of void nodes is considered to be an empty
|
|
475
|
+
* string, regardless of content, unless you pass in true for the voids option
|
|
476
|
+
*/
|
|
477
|
+
string: (editor: Editor, at: Location, options?: EditorStringOptions) => string;
|
|
478
|
+
/**
|
|
479
|
+
* Convert a range into a non-hanging one.
|
|
480
|
+
*/
|
|
481
|
+
unhangRange: (editor: Editor, range: Range, options?: EditorUnhangRangeOptions) => Range;
|
|
482
|
+
/**
|
|
483
|
+
* Match a void node in the current branch of the editor.
|
|
484
|
+
*/
|
|
485
|
+
void: (editor: Editor, options?: EditorVoidOptions) => NodeEntry<Element> | undefined;
|
|
486
|
+
/**
|
|
487
|
+
* Call a function, deferring normalization until after it completes.
|
|
488
|
+
*/
|
|
489
|
+
withoutNormalizing: (editor: Editor, fn: () => void) => void;
|
|
490
|
+
}
|
|
491
|
+
export declare const Editor: EditorInterface;
|
|
492
|
+
/**
|
|
493
|
+
* A helper type for narrowing matched nodes with a predicate.
|
|
494
|
+
*/
|
|
495
|
+
export type NodeMatch<T extends Node> = ((node: Node, path: Path) => node is T) | ((node: Node, path: Path) => boolean);
|
|
496
|
+
export type PropsCompare = (prop: Partial<Node>, node: Partial<Node>) => boolean;
|
|
497
|
+
export type PropsMerge = (prop: Partial<Node>, node: Partial<Node>) => object;
|
|
498
498
|
//# sourceMappingURL=editor.d.ts.map
|