@ckeditor/ckeditor5-engine 48.2.0 → 48.3.0-alpha.1
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/controller/datacontroller.d.ts +329 -328
- package/dist/controller/editingcontroller.d.ts +95 -94
- package/dist/conversion/comparemarkers.d.ts +45 -45
- package/dist/conversion/conversion.d.ts +474 -474
- package/dist/conversion/conversionhelpers.d.ts +21 -21
- package/dist/conversion/downcastdispatcher.d.ts +539 -538
- package/dist/conversion/downcasthelpers.d.ts +1129 -1129
- package/dist/conversion/mapper.d.ts +692 -697
- package/dist/conversion/modelconsumable.d.ts +196 -196
- package/dist/conversion/upcastdispatcher.d.ts +483 -482
- package/dist/conversion/upcasthelpers.d.ts +491 -491
- package/dist/conversion/viewconsumable.d.ts +330 -330
- package/dist/dataprocessor/basichtmlwriter.d.ts +15 -15
- package/dist/dataprocessor/dataprocessor.d.ts +57 -57
- package/dist/dataprocessor/htmldataprocessor.d.ts +72 -72
- package/dist/dataprocessor/htmlwriter.d.ts +11 -11
- package/dist/dataprocessor/xmldataprocessor.d.ts +86 -86
- package/dist/dev-utils/model.d.ts +128 -123
- package/dist/dev-utils/operationreplayer.d.ts +49 -49
- package/dist/dev-utils/utils.d.ts +33 -33
- package/dist/dev-utils/view.d.ts +314 -309
- package/dist/engineconfig.d.ts +39 -39
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +150 -150
- package/dist/index.js +34026 -40107
- package/dist/index.js.map +1 -1
- package/dist/legacyerrors.d.ts +0 -4
- package/dist/model/batch.d.ts +86 -86
- package/dist/model/differ.d.ts +504 -504
- package/dist/model/document.d.ts +265 -268
- package/dist/model/documentfragment.d.ts +214 -214
- package/dist/model/documentselection.d.ts +406 -410
- package/dist/model/element.d.ts +182 -182
- package/dist/model/history.d.ts +109 -109
- package/dist/model/item.d.ts +9 -9
- package/dist/model/liveposition.d.ts +70 -69
- package/dist/model/liverange.d.ts +93 -92
- package/dist/model/markercollection.d.ts +317 -324
- package/dist/model/model.d.ts +889 -909
- package/dist/model/node.d.ts +254 -254
- package/dist/model/nodelist.d.ts +110 -110
- package/dist/model/operation/attributeoperation.d.ts +98 -98
- package/dist/model/operation/detachoperation.d.ts +57 -57
- package/dist/model/operation/insertoperation.d.ts +85 -85
- package/dist/model/operation/markeroperation.d.ts +87 -87
- package/dist/model/operation/mergeoperation.d.ts +95 -95
- package/dist/model/operation/moveoperation.d.ts +97 -97
- package/dist/model/operation/nooperation.d.ts +33 -33
- package/dist/model/operation/operation.d.ts +94 -94
- package/dist/model/operation/operationfactory.d.ts +14 -14
- package/dist/model/operation/renameoperation.d.ts +78 -78
- package/dist/model/operation/rootattributeoperation.d.ts +93 -93
- package/dist/model/operation/rootoperation.d.ts +71 -71
- package/dist/model/operation/splitoperation.d.ts +104 -104
- package/dist/model/operation/transform.d.ts +91 -91
- package/dist/model/operation/utils.d.ts +58 -58
- package/dist/model/position.d.ts +535 -535
- package/dist/model/range.d.ts +458 -453
- package/dist/model/rootelement.d.ts +55 -55
- package/dist/model/schema.d.ts +1325 -1327
- package/dist/model/selection.d.ts +452 -471
- package/dist/model/text.d.ts +62 -62
- package/dist/model/textproxy.d.ts +140 -140
- package/dist/model/treewalker.d.ts +190 -190
- package/dist/model/typecheckable.d.ts +281 -281
- package/dist/model/utils/autoparagraphing.d.ts +29 -29
- package/dist/model/utils/deletecontent.d.ts +68 -68
- package/dist/model/utils/getselectedcontent.d.ts +27 -27
- package/dist/model/utils/insertcontent.d.ts +42 -42
- package/dist/model/utils/insertobject.d.ts +41 -41
- package/dist/model/utils/modifyselection.d.ts +44 -44
- package/dist/model/utils/selection-post-fixer.d.ts +71 -71
- package/dist/model/writer.d.ts +854 -854
- package/dist/view/attributeelement.d.ts +123 -123
- package/dist/view/containerelement.d.ts +49 -49
- package/dist/view/datatransfer.d.ts +70 -70
- package/dist/view/document.d.ts +175 -177
- package/dist/view/documentfragment.d.ts +158 -157
- package/dist/view/documentselection.d.ts +308 -307
- package/dist/view/domconverter.d.ts +612 -657
- package/dist/view/downcastwriter.d.ts +1006 -1006
- package/dist/view/editableelement.d.ts +64 -63
- package/dist/view/element.d.ts +754 -754
- package/dist/view/elementdefinition.d.ts +79 -79
- package/dist/view/emptyelement.d.ts +42 -42
- package/dist/view/filler.d.ts +75 -75
- package/dist/view/item.d.ts +9 -9
- package/dist/view/matcher.d.ts +412 -487
- package/dist/view/node.d.ts +164 -163
- package/dist/view/observer/arrowkeysobserver.d.ts +37 -37
- package/dist/view/observer/bubblingemittermixin.d.ts +163 -153
- package/dist/view/observer/bubblingeventinfo.d.ts +45 -42
- package/dist/view/observer/clickobserver.d.ts +36 -36
- package/dist/view/observer/compositionobserver.d.ts +67 -67
- package/dist/view/observer/domeventdata.d.ts +46 -46
- package/dist/view/observer/domeventobserver.d.ts +77 -74
- package/dist/view/observer/fakeselectionobserver.d.ts +42 -42
- package/dist/view/observer/focusobserver.d.ts +84 -84
- package/dist/view/observer/inputobserver.d.ts +76 -76
- package/dist/view/observer/keyobserver.d.ts +53 -53
- package/dist/view/observer/mouseobserver.d.ts +73 -73
- package/dist/view/observer/mutationobserver.d.ts +101 -101
- package/dist/view/observer/observer.d.ts +84 -83
- package/dist/view/observer/pointerobserver.d.ts +63 -63
- package/dist/view/observer/selectionobserver.d.ts +136 -136
- package/dist/view/observer/tabobserver.d.ts +38 -38
- package/dist/view/observer/touchobserver.d.ts +60 -60
- package/dist/view/placeholder.d.ts +80 -80
- package/dist/view/position.d.ts +187 -187
- package/dist/view/range.d.ts +282 -282
- package/dist/view/rawelement.d.ts +72 -72
- package/dist/view/renderer.d.ts +270 -272
- package/dist/view/rooteditableelement.d.ts +43 -43
- package/dist/view/selection.d.ts +356 -369
- package/dist/view/styles/background.d.ts +15 -15
- package/dist/view/styles/border.d.ts +27 -27
- package/dist/view/styles/margin.d.ts +12 -12
- package/dist/view/styles/padding.d.ts +12 -12
- package/dist/view/styles/utils.d.ts +72 -72
- package/dist/view/stylesmap.d.ts +715 -715
- package/dist/view/text.d.ts +75 -75
- package/dist/view/textproxy.d.ts +92 -92
- package/dist/view/tokenlist.d.ts +104 -104
- package/dist/view/treewalker.d.ts +201 -201
- package/dist/view/typecheckable.d.ts +445 -445
- package/dist/view/uielement.d.ts +93 -93
- package/dist/view/upcastwriter.d.ts +412 -412
- package/dist/view/view.d.ts +466 -469
- package/package.json +2 -2
package/dist/model/element.d.ts
CHANGED
|
@@ -1,187 +1,187 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { ModelNode, type ModelNodeAttributes } from
|
|
9
|
-
import { type ModelItem } from
|
|
6
|
+
* @module engine/model/element
|
|
7
|
+
*/
|
|
8
|
+
import { ModelNode, type ModelNodeAttributes } from "./node.js";
|
|
9
|
+
import { type ModelItem } from "./item.js";
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
* Model element. Type of {@link module:engine/model/node~ModelNode node} that has a
|
|
12
|
+
* {@link module:engine/model/element~ModelElement#name name} and {@link module:engine/model/element~ModelElement#getChildren child nodes}.
|
|
13
|
+
*
|
|
14
|
+
* **Important**: see {@link module:engine/model/node~ModelNode} to read about restrictions using `Element` and `Node` API.
|
|
15
|
+
*/
|
|
16
16
|
export declare class ModelElement extends ModelNode {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Element name.
|
|
19
|
+
*/
|
|
20
|
+
readonly name: string;
|
|
21
|
+
/**
|
|
22
|
+
* List of children nodes.
|
|
23
|
+
*/
|
|
24
|
+
private readonly _children;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a model element.
|
|
27
|
+
*
|
|
28
|
+
* **Note:** Constructor of this class shouldn't be used directly in the code.
|
|
29
|
+
* Use the {@link module:engine/model/writer~ModelWriter#createElement} method instead.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
* @param name Element's name.
|
|
33
|
+
* @param attrs Element's attributes. See {@link module:utils/tomap~toMap} for a list of accepted values.
|
|
34
|
+
* @param children One or more nodes to be inserted as children of created element.
|
|
35
|
+
*/
|
|
36
|
+
constructor(name: string, attrs?: ModelNodeAttributes, children?: string | ModelItem | Iterable<string | ModelItem>);
|
|
37
|
+
/**
|
|
38
|
+
* Number of this element's children.
|
|
39
|
+
*/
|
|
40
|
+
get childCount(): number;
|
|
41
|
+
/**
|
|
42
|
+
* Sum of {@link module:engine/model/node~ModelNode#offsetSize offset sizes} of all of this element's children.
|
|
43
|
+
*/
|
|
44
|
+
get maxOffset(): number;
|
|
45
|
+
/**
|
|
46
|
+
* Is `true` if there are no nodes inside this element, `false` otherwise.
|
|
47
|
+
*/
|
|
48
|
+
get isEmpty(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the child at the given index. Returns `null` if incorrect index was passed.
|
|
51
|
+
*
|
|
52
|
+
* @param index Index in this element.
|
|
53
|
+
* @returns Child node.
|
|
54
|
+
*/
|
|
55
|
+
getChild(index: number): ModelNode | null;
|
|
56
|
+
/**
|
|
57
|
+
* Gets the child at the given offset. Returns `null` if incorrect index was passed.
|
|
58
|
+
*
|
|
59
|
+
* @param offset Offset in this element.
|
|
60
|
+
* @returns Child node.
|
|
61
|
+
*/
|
|
62
|
+
getChildAtOffset(offset: number): ModelNode | null;
|
|
63
|
+
/**
|
|
64
|
+
* Returns an iterator that iterates over all of this element's children.
|
|
65
|
+
*/
|
|
66
|
+
getChildren(): IterableIterator<ModelNode>;
|
|
67
|
+
/**
|
|
68
|
+
* Returns an index of the given child node. Returns `null` if given node is not a child of this element.
|
|
69
|
+
*
|
|
70
|
+
* @param node Child node to look for.
|
|
71
|
+
* @returns Child node's index in this element.
|
|
72
|
+
*/
|
|
73
|
+
getChildIndex(node: ModelNode): number | null;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the starting offset of given child. Starting offset is equal to the sum of
|
|
76
|
+
* {@link module:engine/model/node~ModelNode#offsetSize offset sizes} of all node's siblings that are before it. Returns `null` if
|
|
77
|
+
* given node is not a child of this element.
|
|
78
|
+
*
|
|
79
|
+
* @param node Child node to look for.
|
|
80
|
+
* @returns Child node's starting offset.
|
|
81
|
+
*/
|
|
82
|
+
getChildStartOffset(node: ModelNode): number | null;
|
|
83
|
+
/**
|
|
84
|
+
* Returns index of a node that occupies given offset. If given offset is too low, returns `0`. If given offset is
|
|
85
|
+
* too high, returns {@link module:engine/model/element~ModelElement#getChildIndex index after last child}.
|
|
86
|
+
*
|
|
87
|
+
* ```ts
|
|
88
|
+
* const textNode = new Text( 'foo' );
|
|
89
|
+
* const pElement = new Element( 'p' );
|
|
90
|
+
* const divElement = new Element( [ textNode, pElement ] );
|
|
91
|
+
* divElement.offsetToIndex( -1 ); // Returns 0, because offset is too low.
|
|
92
|
+
* divElement.offsetToIndex( 0 ); // Returns 0, because offset 0 is taken by `textNode` which is at index 0.
|
|
93
|
+
* divElement.offsetToIndex( 1 ); // Returns 0, because `textNode` has `offsetSize` equal to 3, so it occupies offset 1 too.
|
|
94
|
+
* divElement.offsetToIndex( 2 ); // Returns 0.
|
|
95
|
+
* divElement.offsetToIndex( 3 ); // Returns 1.
|
|
96
|
+
* divElement.offsetToIndex( 4 ); // Returns 2. There are no nodes at offset 4, so last available index is returned.
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
offsetToIndex(offset: number): number;
|
|
100
|
+
/**
|
|
101
|
+
* Returns a descendant node by its path relative to this element.
|
|
102
|
+
*
|
|
103
|
+
* ```ts
|
|
104
|
+
* // <this>a<b>c</b></this>
|
|
105
|
+
* this.getNodeByPath( [ 0 ] ); // -> "a"
|
|
106
|
+
* this.getNodeByPath( [ 1 ] ); // -> <b>
|
|
107
|
+
* this.getNodeByPath( [ 1, 0 ] ); // -> "c"
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @param relativePath Path of the node to find, relative to this element.
|
|
111
|
+
*/
|
|
112
|
+
getNodeByPath(relativePath: Array<number>): ModelNode;
|
|
113
|
+
/**
|
|
114
|
+
* Returns the parent element of the given name. Returns null if the element is not inside the desired parent.
|
|
115
|
+
*
|
|
116
|
+
* @param parentName The name of the parent element to find.
|
|
117
|
+
* @param options Options object.
|
|
118
|
+
* @param options.includeSelf When set to `true` this node will be also included while searching.
|
|
119
|
+
*/
|
|
120
|
+
findAncestor(parentName: string, options?: {
|
|
121
|
+
includeSelf?: boolean;
|
|
122
|
+
}): ModelElement | null;
|
|
123
|
+
/**
|
|
124
|
+
* Converts `Element` instance to plain object and returns it. Takes care of converting all of this element's children.
|
|
125
|
+
*
|
|
126
|
+
* @returns `Element` instance converted to plain object.
|
|
127
|
+
*/
|
|
128
|
+
override toJSON(): unknown;
|
|
129
|
+
/**
|
|
130
|
+
* Creates a copy of this element and returns it. Created element has the same name and attributes as the original element.
|
|
131
|
+
* If clone is deep, the original element's children are also cloned. If not, then empty element is returned.
|
|
132
|
+
*
|
|
133
|
+
* @internal
|
|
134
|
+
* @param deep If set to `true` clones element and all its children recursively. When set to `false`,
|
|
135
|
+
* element will be cloned without any child.
|
|
136
|
+
*/
|
|
137
|
+
override _clone(deep?: boolean): ModelElement;
|
|
138
|
+
/**
|
|
139
|
+
* {@link module:engine/model/element~ModelElement#_insertChild Inserts} one or more nodes at the end of this element.
|
|
140
|
+
*
|
|
141
|
+
* @see module:engine/model/writer~ModelWriter#append
|
|
142
|
+
* @internal
|
|
143
|
+
* @param nodes Nodes to be inserted.
|
|
144
|
+
*/
|
|
145
|
+
_appendChild(nodes: string | ModelItem | Iterable<string | ModelItem>): void;
|
|
146
|
+
/**
|
|
147
|
+
* Inserts one or more nodes at the given index and sets {@link module:engine/model/node~ModelNode#parent parent} of these nodes
|
|
148
|
+
* to this element.
|
|
149
|
+
*
|
|
150
|
+
* @see module:engine/model/writer~ModelWriter#insert
|
|
151
|
+
* @internal
|
|
152
|
+
* @param index Index at which nodes should be inserted.
|
|
153
|
+
* @param items Items to be inserted.
|
|
154
|
+
*/
|
|
155
|
+
_insertChild(index: number, items: string | ModelItem | Iterable<string | ModelItem>): void;
|
|
156
|
+
/**
|
|
157
|
+
* Removes one or more nodes starting at the given index and sets
|
|
158
|
+
* {@link module:engine/model/node~ModelNode#parent parent} of these nodes to `null`.
|
|
159
|
+
*
|
|
160
|
+
* @see module:engine/model/writer~ModelWriter#remove
|
|
161
|
+
* @internal
|
|
162
|
+
* @param index Index of the first node to remove.
|
|
163
|
+
* @param howMany Number of nodes to remove.
|
|
164
|
+
* @returns Array containing removed nodes.
|
|
165
|
+
*/
|
|
166
|
+
_removeChildren(index: number, howMany?: number): Array<ModelNode>;
|
|
167
|
+
/**
|
|
168
|
+
* Removes children nodes provided as an array and sets
|
|
169
|
+
* the {@link module:engine/model/node~ModelNode#parent parent} of these nodes to `null`.
|
|
170
|
+
*
|
|
171
|
+
* These nodes do not need to be direct siblings.
|
|
172
|
+
*
|
|
173
|
+
* This method is faster than removing nodes one by one, as it recalculates offsets only once.
|
|
174
|
+
*
|
|
175
|
+
* @internal
|
|
176
|
+
* @param nodes Array of nodes.
|
|
177
|
+
*/
|
|
178
|
+
_removeChildrenArray(nodes: Array<ModelNode>): void;
|
|
179
|
+
/**
|
|
180
|
+
* Creates an `Element` instance from given plain object (i.e. parsed JSON string).
|
|
181
|
+
* Converts `Element` children to proper nodes.
|
|
182
|
+
*
|
|
183
|
+
* @param json Plain object to be converted to `Element`.
|
|
184
|
+
* @returns `Element` instance created using given plain object.
|
|
185
|
+
*/
|
|
186
|
+
static fromJSON(json: any): ModelElement;
|
|
187
187
|
}
|
package/dist/model/history.d.ts
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { type Operation } from
|
|
6
|
+
* @module engine/model/history
|
|
7
|
+
*/
|
|
8
|
+
import { type Operation } from "./operation/operation.js";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* `History` keeps the track of all the operations applied to the {@link module:engine/model/document~ModelDocument document}.
|
|
11
|
+
*/
|
|
12
12
|
export declare class History {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Operations added to the history.
|
|
15
|
+
*/
|
|
16
|
+
private _operations;
|
|
17
|
+
/**
|
|
18
|
+
* Holds an information which {@link module:engine/model/operation/operation~Operation operation} undoes which
|
|
19
|
+
* {@link module:engine/model/operation/operation~Operation operation}.
|
|
20
|
+
*
|
|
21
|
+
* Keys of the map are "undoing operations", that is operations that undone some other operations. For each key, the
|
|
22
|
+
* value is an operation that has been undone by the "undoing operation".
|
|
23
|
+
*/
|
|
24
|
+
private _undoPairs;
|
|
25
|
+
/**
|
|
26
|
+
* Holds all undone operations.
|
|
27
|
+
*/
|
|
28
|
+
private _undoneOperations;
|
|
29
|
+
/**
|
|
30
|
+
* A map that allows retrieving the operations fast based on the given base version.
|
|
31
|
+
*/
|
|
32
|
+
private _baseVersionToOperationIndex;
|
|
33
|
+
/**
|
|
34
|
+
* The history version.
|
|
35
|
+
*/
|
|
36
|
+
private _version;
|
|
37
|
+
/**
|
|
38
|
+
* The gap pairs kept in the <from,to> format.
|
|
39
|
+
*
|
|
40
|
+
* Anytime the `history.version` is set to a version larger than `history.version + 1`,
|
|
41
|
+
* a new <lastHistoryVersion, newHistoryVersion> entry is added to the map.
|
|
42
|
+
*/
|
|
43
|
+
private _gaps;
|
|
44
|
+
/**
|
|
45
|
+
* The version of the last operation in the history.
|
|
46
|
+
*
|
|
47
|
+
* The history version is incremented automatically when a new operation is added to the history.
|
|
48
|
+
* Setting the version manually should be done only in rare circumstances when a gap is planned
|
|
49
|
+
* between history versions. When doing so, a gap will be created and the history will accept adding
|
|
50
|
+
* an operation with base version equal to the new history version.
|
|
51
|
+
*/
|
|
52
|
+
get version(): number;
|
|
53
|
+
set version(version: number);
|
|
54
|
+
/**
|
|
55
|
+
* The last history operation.
|
|
56
|
+
*/
|
|
57
|
+
get lastOperation(): Operation | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Adds an operation to the history and increments the history version.
|
|
60
|
+
*
|
|
61
|
+
* The operation's base version should be equal to the history version. Otherwise an error is thrown.
|
|
62
|
+
*/
|
|
63
|
+
addOperation(operation: Operation): void;
|
|
64
|
+
/**
|
|
65
|
+
* Returns operations from the given range of operation base versions that were added to the history.
|
|
66
|
+
*
|
|
67
|
+
* Note that there may be gaps in operations base versions.
|
|
68
|
+
*
|
|
69
|
+
* @param fromBaseVersion Base version from which operations should be returned (inclusive).
|
|
70
|
+
* @param toBaseVersion Base version up to which operations should be returned (exclusive).
|
|
71
|
+
* @returns History operations for the given range, in chronological order.
|
|
72
|
+
*/
|
|
73
|
+
getOperations(fromBaseVersion?: number, toBaseVersion?: number): Array<Operation>;
|
|
74
|
+
/**
|
|
75
|
+
* Returns operation from the history that bases on given `baseVersion`.
|
|
76
|
+
*
|
|
77
|
+
* @param baseVersion Base version of the operation to get.
|
|
78
|
+
* @returns Operation with given base version or `undefined` if there is no such operation in history.
|
|
79
|
+
*/
|
|
80
|
+
getOperation(baseVersion: number): Operation | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Marks in history that one operation is an operation that is undoing the other operation. By marking operation this way,
|
|
83
|
+
* history is keeping more context information about operations, which helps in operational transformation.
|
|
84
|
+
*
|
|
85
|
+
* @param undoneOperation Operation which is undone by `undoingOperation`.
|
|
86
|
+
* @param undoingOperation Operation which undoes `undoneOperation`.
|
|
87
|
+
*/
|
|
88
|
+
setOperationAsUndone(undoneOperation: Operation, undoingOperation: Operation): void;
|
|
89
|
+
/**
|
|
90
|
+
* Checks whether given `operation` is undoing any other operation.
|
|
91
|
+
*
|
|
92
|
+
* @param operation Operation to check.
|
|
93
|
+
* @returns `true` if given `operation` is undoing any other operation, `false` otherwise.
|
|
94
|
+
*/
|
|
95
|
+
isUndoingOperation(operation: Operation): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Checks whether given `operation` has been undone by any other operation.
|
|
98
|
+
*
|
|
99
|
+
* @param operation Operation to check.
|
|
100
|
+
* @returns `true` if given `operation` has been undone any other operation, `false` otherwise.
|
|
101
|
+
*/
|
|
102
|
+
isUndoneOperation(operation: Operation): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* For given `undoingOperation`, returns the operation which has been undone by it.
|
|
105
|
+
*
|
|
106
|
+
* @returns Operation that has been undone by given `undoingOperation` or `undefined`
|
|
107
|
+
* if given `undoingOperation` is not undoing any other operation.
|
|
108
|
+
*/
|
|
109
|
+
getUndoneOperation(undoingOperation: Operation): Operation | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Resets the history of operations.
|
|
112
|
+
*/
|
|
113
|
+
reset(): void;
|
|
114
114
|
}
|
package/dist/model/item.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { type ModelNode } from
|
|
9
|
-
import { type ModelTextProxy } from
|
|
6
|
+
* @module engine/model/item
|
|
7
|
+
*/
|
|
8
|
+
import { type ModelNode } from "./node.js";
|
|
9
|
+
import { type ModelTextProxy } from "./textproxy.js";
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
* Item is a {@link module:engine/model/node~ModelNode} or {@link module:engine/model/textproxy~ModelTextProxy}.
|
|
12
|
+
*/
|
|
13
13
|
export type ModelItem = ModelNode | ModelTextProxy;
|