@ckeditor/ckeditor5-engine 45.2.1 → 46.0.0-alpha.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/index.js +2563 -2257
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/controller/datacontroller.d.ts +33 -32
- package/src/controller/datacontroller.js +29 -28
- package/src/controller/editingcontroller.d.ts +8 -8
- package/src/controller/editingcontroller.js +10 -10
- package/src/conversion/conversion.d.ts +18 -19
- package/src/conversion/conversion.js +4 -4
- package/src/conversion/conversionhelpers.d.ts +1 -1
- package/src/conversion/conversionhelpers.js +1 -1
- package/src/conversion/downcastdispatcher.d.ts +63 -69
- package/src/conversion/downcastdispatcher.js +16 -16
- package/src/conversion/downcasthelpers.d.ts +94 -83
- package/src/conversion/downcasthelpers.js +63 -53
- package/src/conversion/mapper.d.ts +27 -27
- package/src/conversion/mapper.js +15 -15
- package/src/conversion/modelconsumable.d.ts +26 -26
- package/src/conversion/modelconsumable.js +23 -23
- package/src/conversion/upcastdispatcher.d.ts +33 -32
- package/src/conversion/upcastdispatcher.js +19 -19
- package/src/conversion/upcasthelpers.d.ts +46 -38
- package/src/conversion/upcasthelpers.js +33 -24
- package/src/conversion/viewconsumable.d.ts +50 -45
- package/src/conversion/viewconsumable.js +32 -27
- package/src/dataprocessor/basichtmlwriter.d.ts +4 -2
- package/src/dataprocessor/basichtmlwriter.js +3 -1
- package/src/dataprocessor/dataprocessor.d.ts +7 -6
- package/src/dataprocessor/htmldataprocessor.d.ts +10 -10
- package/src/dataprocessor/htmldataprocessor.js +6 -6
- package/src/dataprocessor/htmlwriter.d.ts +1 -1
- package/src/dataprocessor/xmldataprocessor.d.ts +10 -10
- package/src/dataprocessor/xmldataprocessor.js +6 -6
- package/src/dev-utils/model.d.ts +25 -26
- package/src/dev-utils/model.js +35 -36
- package/src/dev-utils/operationreplayer.d.ts +5 -3
- package/src/dev-utils/operationreplayer.js +4 -2
- package/src/dev-utils/utils.d.ts +8 -0
- package/src/dev-utils/utils.js +8 -0
- package/src/dev-utils/view.d.ts +66 -63
- package/src/dev-utils/view.js +144 -134
- package/src/index.d.ts +135 -106
- package/src/index.js +120 -71
- package/src/legacyerrors.d.ts +5 -0
- package/src/legacyerrors.js +17 -0
- package/src/model/batch.d.ts +2 -15
- package/src/model/batch.js +1 -23
- package/src/model/differ.d.ts +54 -31
- package/src/model/differ.js +15 -15
- package/src/model/document.d.ts +31 -31
- package/src/model/document.js +13 -13
- package/src/model/documentfragment.d.ts +45 -45
- package/src/model/documentfragment.js +40 -40
- package/src/model/documentselection.d.ts +92 -92
- package/src/model/documentselection.js +71 -70
- package/src/model/element.d.ts +31 -31
- package/src/model/element.js +29 -29
- package/src/model/history.d.ts +3 -3
- package/src/model/history.js +2 -2
- package/src/model/item.d.ts +4 -5
- package/src/model/liveposition.d.ts +31 -31
- package/src/model/liveposition.js +18 -18
- package/src/model/liverange.d.ts +42 -38
- package/src/model/liverange.js +17 -16
- package/src/model/markercollection.d.ts +41 -40
- package/src/model/markercollection.js +22 -20
- package/src/model/model.d.ts +82 -81
- package/src/model/model.js +54 -54
- package/src/model/node.d.ts +48 -48
- package/src/model/node.js +31 -31
- package/src/model/nodelist.d.ts +17 -17
- package/src/model/nodelist.js +11 -11
- package/src/model/operation/attributeoperation.d.ts +10 -10
- package/src/model/operation/attributeoperation.js +7 -7
- package/src/model/operation/detachoperation.d.ts +11 -9
- package/src/model/operation/detachoperation.js +8 -6
- package/src/model/operation/insertoperation.d.ts +13 -13
- package/src/model/operation/insertoperation.js +15 -15
- package/src/model/operation/markeroperation.d.ts +12 -12
- package/src/model/operation/markeroperation.js +5 -5
- package/src/model/operation/mergeoperation.d.ts +16 -16
- package/src/model/operation/mergeoperation.js +18 -18
- package/src/model/operation/moveoperation.d.ts +16 -16
- package/src/model/operation/moveoperation.js +18 -15
- package/src/model/operation/nooperation.d.ts +4 -4
- package/src/model/operation/nooperation.js +2 -2
- package/src/model/operation/operation.d.ts +10 -10
- package/src/model/operation/operation.js +5 -5
- package/src/model/operation/operationfactory.d.ts +4 -4
- package/src/model/operation/operationfactory.js +12 -12
- package/src/model/operation/renameoperation.d.ts +10 -10
- package/src/model/operation/renameoperation.js +7 -7
- package/src/model/operation/rootattributeoperation.d.ts +12 -12
- package/src/model/operation/rootattributeoperation.js +8 -8
- package/src/model/operation/rootoperation.d.ts +8 -8
- package/src/model/operation/rootoperation.js +3 -3
- package/src/model/operation/splitoperation.d.ts +17 -17
- package/src/model/operation/splitoperation.js +19 -19
- package/src/model/operation/transform.d.ts +11 -8
- package/src/model/operation/transform.js +66 -49
- package/src/model/operation/utils.d.ts +24 -23
- package/src/model/operation/utils.js +20 -20
- package/src/model/position.d.ts +101 -97
- package/src/model/position.js +69 -64
- package/src/model/range.d.ts +90 -90
- package/src/model/range.js +87 -87
- package/src/model/rootelement.d.ts +11 -11
- package/src/model/rootelement.js +9 -9
- package/src/model/schema.d.ts +158 -154
- package/src/model/schema.js +93 -90
- package/src/model/selection.d.ts +73 -73
- package/src/model/selection.js +62 -62
- package/src/model/text.d.ts +11 -10
- package/src/model/text.js +11 -10
- package/src/model/textproxy.d.ts +39 -38
- package/src/model/textproxy.js +31 -30
- package/src/model/treewalker.d.ts +37 -37
- package/src/model/treewalker.js +14 -14
- package/src/model/typecheckable.d.ts +45 -45
- package/src/model/typecheckable.js +1 -1
- package/src/model/utils/autoparagraphing.d.ts +7 -7
- package/src/model/utils/deletecontent.d.ts +7 -5
- package/src/model/utils/deletecontent.js +13 -11
- package/src/model/utils/getselectedcontent.d.ts +6 -5
- package/src/model/utils/getselectedcontent.js +2 -1
- package/src/model/utils/insertcontent.d.ts +9 -8
- package/src/model/utils/insertcontent.js +41 -40
- package/src/model/utils/insertobject.d.ts +9 -9
- package/src/model/utils/insertobject.js +4 -4
- package/src/model/utils/modifyselection.d.ts +5 -4
- package/src/model/utils/modifyselection.js +12 -11
- package/src/model/utils/selection-post-fixer.d.ts +12 -8
- package/src/model/utils/selection-post-fixer.js +15 -11
- package/src/model/writer.d.ts +102 -101
- package/src/model/writer.js +99 -98
- package/src/view/attributeelement.d.ts +29 -29
- package/src/view/attributeelement.js +25 -25
- package/src/view/containerelement.d.ts +16 -15
- package/src/view/containerelement.js +15 -14
- package/src/view/datatransfer.d.ts +7 -7
- package/src/view/datatransfer.js +1 -1
- package/src/view/document.d.ts +25 -25
- package/src/view/document.js +15 -15
- package/src/view/documentfragment.d.ts +21 -21
- package/src/view/documentfragment.js +14 -14
- package/src/view/documentselection.d.ts +65 -63
- package/src/view/documentselection.js +27 -25
- package/src/view/domconverter.d.ts +94 -89
- package/src/view/domconverter.js +78 -73
- package/src/view/downcastwriter.d.ts +185 -181
- package/src/view/downcastwriter.js +222 -210
- package/src/view/editableelement.d.ts +13 -13
- package/src/view/editableelement.js +8 -8
- package/src/view/element.d.ts +75 -74
- package/src/view/element.js +58 -58
- package/src/view/elementdefinition.d.ts +3 -4
- package/src/view/emptyelement.d.ts +13 -13
- package/src/view/emptyelement.js +13 -13
- package/src/view/filler.d.ts +14 -3
- package/src/view/filler.js +12 -1
- package/src/view/item.d.ts +4 -5
- package/src/view/matcher.d.ts +22 -19
- package/src/view/matcher.js +6 -6
- package/src/view/node.d.ts +33 -33
- package/src/view/node.js +9 -9
- package/src/view/observer/arrowkeysobserver.d.ts +10 -10
- package/src/view/observer/arrowkeysobserver.js +5 -5
- package/src/view/observer/bubblingemittermixin.d.ts +5 -5
- package/src/view/observer/bubblingemittermixin.js +2 -9
- package/src/view/observer/bubblingeventinfo.d.ts +9 -9
- package/src/view/observer/bubblingeventinfo.js +1 -1
- package/src/view/observer/clickobserver.d.ts +8 -8
- package/src/view/observer/clickobserver.js +4 -4
- package/src/view/observer/compositionobserver.d.ts +19 -19
- package/src/view/observer/compositionobserver.js +6 -6
- package/src/view/observer/domeventdata.d.ts +9 -9
- package/src/view/observer/domeventdata.js +2 -2
- package/src/view/observer/domeventobserver.d.ts +3 -3
- package/src/view/observer/domeventobserver.js +5 -5
- package/src/view/observer/fakeselectionobserver.d.ts +9 -9
- package/src/view/observer/fakeselectionobserver.js +8 -8
- package/src/view/observer/focusobserver.d.ts +16 -16
- package/src/view/observer/focusobserver.js +7 -7
- package/src/view/observer/inputobserver.d.ts +18 -18
- package/src/view/observer/inputobserver.js +5 -5
- package/src/view/observer/keyobserver.d.ts +11 -11
- package/src/view/observer/keyobserver.js +3 -3
- package/src/view/observer/mouseobserver.d.ts +16 -16
- package/src/view/observer/mouseobserver.js +3 -3
- package/src/view/observer/mutationobserver.d.ts +21 -21
- package/src/view/observer/mutationobserver.js +7 -7
- package/src/view/observer/observer.d.ts +12 -12
- package/src/view/observer/observer.js +6 -6
- package/src/view/observer/selectionobserver.d.ts +33 -33
- package/src/view/observer/selectionobserver.js +14 -14
- package/src/view/observer/tabobserver.d.ts +10 -10
- package/src/view/observer/tabobserver.js +5 -5
- package/src/view/observer/touchobserver.d.ts +13 -13
- package/src/view/observer/touchobserver.js +3 -3
- package/src/view/placeholder.d.ts +21 -21
- package/src/view/placeholder.js +23 -23
- package/src/view/position.d.ts +49 -49
- package/src/view/position.js +42 -42
- package/src/view/range.d.ts +76 -74
- package/src/view/range.js +67 -65
- package/src/view/rawelement.d.ts +19 -19
- package/src/view/rawelement.js +16 -16
- package/src/view/renderer.d.ts +14 -14
- package/src/view/renderer.js +7 -7
- package/src/view/rooteditableelement.d.ts +8 -7
- package/src/view/rooteditableelement.js +7 -6
- package/src/view/selection.d.ts +66 -64
- package/src/view/selection.js +50 -48
- package/src/view/styles/background.d.ts +2 -2
- package/src/view/styles/background.js +9 -9
- package/src/view/styles/border.d.ts +2 -2
- package/src/view/styles/border.js +13 -13
- package/src/view/styles/margin.d.ts +2 -2
- package/src/view/styles/margin.js +5 -5
- package/src/view/styles/padding.d.ts +2 -2
- package/src/view/styles/padding.js +5 -5
- package/src/view/styles/utils.d.ts +24 -24
- package/src/view/styles/utils.js +25 -25
- package/src/view/stylesmap.d.ts +28 -32
- package/src/view/stylesmap.js +52 -39
- package/src/view/text.d.ts +11 -11
- package/src/view/text.js +10 -10
- package/src/view/textproxy.d.ts +33 -32
- package/src/view/textproxy.js +23 -22
- package/src/view/tokenlist.d.ts +14 -14
- package/src/view/tokenlist.js +10 -10
- package/src/view/treewalker.d.ts +42 -40
- package/src/view/treewalker.js +36 -35
- package/src/view/typecheckable.d.ts +76 -75
- package/src/view/typecheckable.js +1 -1
- package/src/view/uielement.d.ts +22 -21
- package/src/view/uielement.js +17 -16
- package/src/view/upcastwriter.d.ts +70 -70
- package/src/view/upcastwriter.js +42 -42
- package/src/view/view.d.ts +70 -69
- package/src/view/view.js +56 -55
package/src/model/node.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module engine/model/node
|
|
8
8
|
*/
|
|
9
|
-
import
|
|
9
|
+
import { ModelTypeCheckable } from './typecheckable.js';
|
|
10
10
|
import { compareArrays, toMap } from '@ckeditor/ckeditor5-utils';
|
|
11
11
|
/**
|
|
12
12
|
* Model node. Most basic structure of model tree.
|
|
@@ -15,12 +15,12 @@ import { compareArrays, toMap } from '@ckeditor/ckeditor5-utils';
|
|
|
15
15
|
*
|
|
16
16
|
* **Note:** If a node is detached from the model tree, you can manipulate it using it's API.
|
|
17
17
|
* However, it is **very important** that nodes already attached to model tree should be only changed through
|
|
18
|
-
* {@link module:engine/model/writer~
|
|
18
|
+
* {@link module:engine/model/writer~ModelWriter Writer API}.
|
|
19
19
|
*
|
|
20
|
-
* Changes done by `Node` methods, like {@link module:engine/model/element~
|
|
21
|
-
* {@link module:engine/model/node~
|
|
20
|
+
* Changes done by `Node` methods, like {@link module:engine/model/element~ModelElement#_insertChild _insertChild} or
|
|
21
|
+
* {@link module:engine/model/node~ModelNode#_setAttribute _setAttribute}
|
|
22
22
|
* do not generate {@link module:engine/model/operation/operation~Operation operations}
|
|
23
|
-
* which are essential for correct editor work if you modify nodes in {@link module:engine/model/document~
|
|
23
|
+
* which are essential for correct editor work if you modify nodes in {@link module:engine/model/document~ModelDocument document} root.
|
|
24
24
|
*
|
|
25
25
|
* The flow of working on `Node` (and classes that inherits from it) is as such:
|
|
26
26
|
* 1. You can create a `Node` instance, modify it using it's API.
|
|
@@ -28,18 +28,18 @@ import { compareArrays, toMap } from '@ckeditor/ckeditor5-utils';
|
|
|
28
28
|
* 3. Change `Node` that was already added to the model using `Batch` API.
|
|
29
29
|
*
|
|
30
30
|
* Similarly, you cannot use `Batch` API on a node that has not been added to the model tree, with the exception
|
|
31
|
-
* of {@link module:engine/model/writer~
|
|
31
|
+
* of {@link module:engine/model/writer~ModelWriter#insert inserting} that node to the model tree.
|
|
32
32
|
*
|
|
33
|
-
* Be aware that using {@link module:engine/model/writer~
|
|
33
|
+
* Be aware that using {@link module:engine/model/writer~ModelWriter#remove remove from Batch API} does not allow to use `Node` API because
|
|
34
34
|
* the information about `Node` is still kept in model document.
|
|
35
35
|
*
|
|
36
|
-
* In case of {@link module:engine/model/element~
|
|
36
|
+
* In case of {@link module:engine/model/element~ModelElement element node}, adding and removing children also counts as changing a node and
|
|
37
37
|
* follows same rules.
|
|
38
38
|
*/
|
|
39
|
-
export
|
|
39
|
+
export class ModelNode extends ModelTypeCheckable {
|
|
40
40
|
/**
|
|
41
|
-
* Parent of this node. It could be {@link module:engine/model/element~
|
|
42
|
-
* or {@link module:engine/model/documentfragment~
|
|
41
|
+
* Parent of this node. It could be {@link module:engine/model/element~ModelElement}
|
|
42
|
+
* or {@link module:engine/model/documentfragment~ModelDocumentFragment}.
|
|
43
43
|
* Equals to `null` if the node has no parent.
|
|
44
44
|
*/
|
|
45
45
|
parent = null;
|
|
@@ -71,7 +71,7 @@ export default class Node extends TypeCheckable {
|
|
|
71
71
|
this._attrs = toMap(attrs);
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
* {@link module:engine/model/document~
|
|
74
|
+
* {@link module:engine/model/document~ModelDocument Document} that owns this root element.
|
|
75
75
|
*/
|
|
76
76
|
get document() {
|
|
77
77
|
return null;
|
|
@@ -93,16 +93,16 @@ export default class Node extends TypeCheckable {
|
|
|
93
93
|
* Offset size of this node.
|
|
94
94
|
*
|
|
95
95
|
* Represents how much "offset space" is occupied by the node in its parent. It is important for
|
|
96
|
-
* {@link module:engine/model/position~
|
|
97
|
-
* that node start and end. `offsetSize` greater than `1` is for
|
|
98
|
-
* a {@link module:engine/model/text~
|
|
96
|
+
* {@link module:engine/model/position~ModelPosition position}. When node has `offsetSize` greater
|
|
97
|
+
* than `1`, position can be placed between that node start and end. `offsetSize` greater than `1` is for
|
|
98
|
+
* nodes that represents more than one entity, i.e. a {@link module:engine/model/text~ModelText text node}.
|
|
99
99
|
*/
|
|
100
100
|
get offsetSize() {
|
|
101
101
|
return 1;
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Offset at which this node ends in its parent. It is equal to the sum of this node's
|
|
105
|
-
* {@link module:engine/model/node~
|
|
105
|
+
* {@link module:engine/model/node~ModelNode#startOffset start offset} and {@link #offsetSize offset size}.
|
|
106
106
|
* Equals to `null` if the node has no parent.
|
|
107
107
|
*/
|
|
108
108
|
get endOffset() {
|
|
@@ -127,7 +127,7 @@ export default class Node extends TypeCheckable {
|
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
129
|
* The top-most ancestor of the node. If node has no parent it is the root itself. If the node is a part
|
|
130
|
-
* of {@link module:engine/model/documentfragment~
|
|
130
|
+
* of {@link module:engine/model/documentfragment~ModelDocumentFragment}, it's `root` is equal to that `DocumentFragment`.
|
|
131
131
|
*/
|
|
132
132
|
get root() {
|
|
133
133
|
// eslint-disable-next-line @typescript-eslint/no-this-alias, consistent-this
|
|
@@ -149,15 +149,15 @@ export default class Node extends TypeCheckable {
|
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
151
|
* Gets path to the node. The path is an array containing starting offsets of consecutive ancestors of this node,
|
|
152
|
-
* beginning from {@link module:engine/model/node~
|
|
153
|
-
* create {@link module:engine/model/position~
|
|
152
|
+
* beginning from {@link module:engine/model/node~ModelNode#root root}, down to this node's starting offset. The path can be used to
|
|
153
|
+
* create {@link module:engine/model/position~ModelPosition Position} instance.
|
|
154
154
|
*
|
|
155
155
|
* ```ts
|
|
156
156
|
* const abc = new Text( 'abc' );
|
|
157
157
|
* const foo = new Text( 'foo' );
|
|
158
|
-
* const h1 = new
|
|
159
|
-
* const p = new
|
|
160
|
-
* const div = new
|
|
158
|
+
* const h1 = new ModelElement( 'h1', null, new Text( 'header' ) );
|
|
159
|
+
* const p = new ModelElement( 'p', null, [ abc, foo ] );
|
|
160
|
+
* const div = new ModelElement( 'div', null, [ h1, p ] );
|
|
161
161
|
* foo.getPath(); // Returns [ 1, 3 ]. `foo` is in `p` which is in `div`. `p` starts at offset 1, while `foo` at 3.
|
|
162
162
|
* h1.getPath(); // Returns [ 0 ].
|
|
163
163
|
* div.getPath(); // Returns [].
|
|
@@ -192,7 +192,7 @@ export default class Node extends TypeCheckable {
|
|
|
192
192
|
return ancestors;
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
|
-
* Returns a {@link module:engine/model/element~
|
|
195
|
+
* Returns a {@link module:engine/model/element~ModelElement} or {@link module:engine/model/documentfragment~ModelDocumentFragment}
|
|
196
196
|
* which is a common ancestor of both nodes.
|
|
197
197
|
*
|
|
198
198
|
* @param node The second node.
|
|
@@ -211,7 +211,7 @@ export default class Node extends TypeCheckable {
|
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
213
|
* Returns whether this node is before given node. `false` is returned if nodes are in different trees (for example,
|
|
214
|
-
* in different {@link module:engine/model/documentfragment~
|
|
214
|
+
* in different {@link module:engine/model/documentfragment~ModelDocumentFragment}s).
|
|
215
215
|
*
|
|
216
216
|
* @param node Node to compare with.
|
|
217
217
|
*/
|
|
@@ -238,7 +238,7 @@ export default class Node extends TypeCheckable {
|
|
|
238
238
|
}
|
|
239
239
|
/**
|
|
240
240
|
* Returns whether this node is after given node. `false` is returned if nodes are in different trees (for example,
|
|
241
|
-
* in different {@link module:engine/model/documentfragment~
|
|
241
|
+
* in different {@link module:engine/model/documentfragment~ModelDocumentFragment}s).
|
|
242
242
|
*
|
|
243
243
|
* @param node Node to compare with.
|
|
244
244
|
*/
|
|
@@ -317,7 +317,7 @@ export default class Node extends TypeCheckable {
|
|
|
317
317
|
* Removes this node from its parent.
|
|
318
318
|
*
|
|
319
319
|
* @internal
|
|
320
|
-
* @see module:engine/model/writer~
|
|
320
|
+
* @see module:engine/model/writer~ModelWriter#remove
|
|
321
321
|
*/
|
|
322
322
|
_remove() {
|
|
323
323
|
this.parent._removeChildren(this.index);
|
|
@@ -325,7 +325,7 @@ export default class Node extends TypeCheckable {
|
|
|
325
325
|
/**
|
|
326
326
|
* Sets attribute on the node. If attribute with the same key already is set, it's value is overwritten.
|
|
327
327
|
*
|
|
328
|
-
* @see module:engine/model/writer~
|
|
328
|
+
* @see module:engine/model/writer~ModelWriter#setAttribute
|
|
329
329
|
* @internal
|
|
330
330
|
* @param key Key of attribute to set.
|
|
331
331
|
* @param value Attribute value.
|
|
@@ -336,7 +336,7 @@ export default class Node extends TypeCheckable {
|
|
|
336
336
|
/**
|
|
337
337
|
* Removes all attributes from the node and sets given attributes.
|
|
338
338
|
*
|
|
339
|
-
* @see module:engine/model/writer~
|
|
339
|
+
* @see module:engine/model/writer~ModelWriter#setAttributes
|
|
340
340
|
* @internal
|
|
341
341
|
* @param attrs Attributes to set. See {@link module:utils/tomap~toMap} for a list of accepted values.
|
|
342
342
|
*/
|
|
@@ -346,7 +346,7 @@ export default class Node extends TypeCheckable {
|
|
|
346
346
|
/**
|
|
347
347
|
* Removes an attribute with given key from the node.
|
|
348
348
|
*
|
|
349
|
-
* @see module:engine/model/writer~
|
|
349
|
+
* @see module:engine/model/writer~ModelWriter#removeAttribute
|
|
350
350
|
* @internal
|
|
351
351
|
* @param key Key of attribute to remove.
|
|
352
352
|
* @returns `true` if the attribute was set on the element, `false` otherwise.
|
|
@@ -357,7 +357,7 @@ export default class Node extends TypeCheckable {
|
|
|
357
357
|
/**
|
|
358
358
|
* Removes all attributes from the node.
|
|
359
359
|
*
|
|
360
|
-
* @see module:engine/model/writer~
|
|
360
|
+
* @see module:engine/model/writer~ModelWriter#clearAttributes
|
|
361
361
|
* @internal
|
|
362
362
|
*/
|
|
363
363
|
_clearAttributes() {
|
|
@@ -366,6 +366,6 @@ export default class Node extends TypeCheckable {
|
|
|
366
366
|
}
|
|
367
367
|
// The magic of type inference using `is` method is centralized in `TypeCheckable` class.
|
|
368
368
|
// Proper overload would interfere with that.
|
|
369
|
-
|
|
369
|
+
ModelNode.prototype.is = function (type) {
|
|
370
370
|
return type === 'node' || type === 'model:node';
|
|
371
371
|
};
|
package/src/model/nodelist.d.ts
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/nodelist
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import { ModelNode } from './node.js';
|
|
9
9
|
/**
|
|
10
|
-
* Provides an interface to operate on a list of {@link module:engine/model/node~
|
|
11
|
-
* in classes like {@link module:engine/model/element~
|
|
12
|
-
* or {@link module:engine/model/documentfragment~
|
|
10
|
+
* Provides an interface to operate on a list of {@link module:engine/model/node~ModelNode nodes}. `NodeList` is used internally
|
|
11
|
+
* in classes like {@link module:engine/model/element~ModelElement Element}
|
|
12
|
+
* or {@link module:engine/model/documentfragment~ModelDocumentFragment ModelDocumentFragment}.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export declare class ModelNodeList implements Iterable<ModelNode> {
|
|
15
15
|
/**
|
|
16
16
|
* Nodes contained in this node list.
|
|
17
17
|
*/
|
|
@@ -30,41 +30,41 @@ export default class NodeList implements Iterable<Node> {
|
|
|
30
30
|
* @internal
|
|
31
31
|
* @param nodes Nodes contained in this node list.
|
|
32
32
|
*/
|
|
33
|
-
constructor(nodes?: Iterable<
|
|
33
|
+
constructor(nodes?: Iterable<ModelNode>);
|
|
34
34
|
/**
|
|
35
35
|
* Iterable interface.
|
|
36
36
|
*
|
|
37
37
|
* Iterates over all nodes contained inside this node list.
|
|
38
38
|
*/
|
|
39
|
-
[Symbol.iterator](): IterableIterator<
|
|
39
|
+
[Symbol.iterator](): IterableIterator<ModelNode>;
|
|
40
40
|
/**
|
|
41
41
|
* Number of nodes contained inside this node list.
|
|
42
42
|
*/
|
|
43
43
|
get length(): number;
|
|
44
44
|
/**
|
|
45
|
-
* Sum of {@link module:engine/model/node~
|
|
45
|
+
* Sum of {@link module:engine/model/node~ModelNode#offsetSize offset sizes} of all nodes contained inside this node list.
|
|
46
46
|
*/
|
|
47
47
|
get maxOffset(): number;
|
|
48
48
|
/**
|
|
49
49
|
* Gets the node at the given index. Returns `null` if incorrect index was passed.
|
|
50
50
|
*/
|
|
51
|
-
getNode(index: number):
|
|
51
|
+
getNode(index: number): ModelNode | null;
|
|
52
52
|
/**
|
|
53
53
|
* Gets the node at the given offset. Returns `null` if incorrect offset was passed.
|
|
54
54
|
*/
|
|
55
|
-
getNodeAtOffset(offset: number):
|
|
55
|
+
getNodeAtOffset(offset: number): ModelNode | null;
|
|
56
56
|
/**
|
|
57
57
|
* Returns an index of the given node or `null` if given node does not have a parent.
|
|
58
58
|
*
|
|
59
|
-
* This is an alias to {@link module:engine/model/node~
|
|
59
|
+
* This is an alias to {@link module:engine/model/node~ModelNode#index}.
|
|
60
60
|
*/
|
|
61
|
-
getNodeIndex(node:
|
|
61
|
+
getNodeIndex(node: ModelNode): number | null;
|
|
62
62
|
/**
|
|
63
63
|
* Returns the offset at which given node is placed in its parent or `null` if given node does not have a parent.
|
|
64
64
|
*
|
|
65
|
-
* This is an alias to {@link module:engine/model/node~
|
|
65
|
+
* This is an alias to {@link module:engine/model/node~ModelNode#startOffset}.
|
|
66
66
|
*/
|
|
67
|
-
getNodeStartOffset(node:
|
|
67
|
+
getNodeStartOffset(node: ModelNode): number | null;
|
|
68
68
|
/**
|
|
69
69
|
* Converts index to offset in node list.
|
|
70
70
|
*
|
|
@@ -86,7 +86,7 @@ export default class NodeList implements Iterable<Node> {
|
|
|
86
86
|
* @param index Index at which nodes should be inserted.
|
|
87
87
|
* @param nodes Nodes to be inserted.
|
|
88
88
|
*/
|
|
89
|
-
_insertNodes(index: number, nodes: Iterable<
|
|
89
|
+
_insertNodes(index: number, nodes: Iterable<ModelNode>): void;
|
|
90
90
|
/**
|
|
91
91
|
* Removes one or more nodes starting at the given index.
|
|
92
92
|
*
|
|
@@ -95,7 +95,7 @@ export default class NodeList implements Iterable<Node> {
|
|
|
95
95
|
* @param howMany Number of nodes to remove.
|
|
96
96
|
* @returns Array containing removed nodes.
|
|
97
97
|
*/
|
|
98
|
-
_removeNodes(indexStart: number, howMany?: number): Array<
|
|
98
|
+
_removeNodes(indexStart: number, howMany?: number): Array<ModelNode>;
|
|
99
99
|
/**
|
|
100
100
|
* Removes children nodes provided as an array. These nodes do not need to be direct siblings.
|
|
101
101
|
*
|
|
@@ -104,7 +104,7 @@ export default class NodeList implements Iterable<Node> {
|
|
|
104
104
|
* @internal
|
|
105
105
|
* @param nodes Array of nodes.
|
|
106
106
|
*/
|
|
107
|
-
_removeNodesArray(nodes: Array<
|
|
107
|
+
_removeNodesArray(nodes: Array<ModelNode>): void;
|
|
108
108
|
/**
|
|
109
109
|
* Converts `NodeList` instance to an array containing nodes that were inserted in the node list. Nodes
|
|
110
110
|
* are also converted to their plain object representation.
|
package/src/model/nodelist.js
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/nodelist
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import { ModelNode } from './node.js';
|
|
9
9
|
import { CKEditorError, spliceArray } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
/**
|
|
11
|
-
* Provides an interface to operate on a list of {@link module:engine/model/node~
|
|
12
|
-
* in classes like {@link module:engine/model/element~
|
|
13
|
-
* or {@link module:engine/model/documentfragment~
|
|
11
|
+
* Provides an interface to operate on a list of {@link module:engine/model/node~ModelNode nodes}. `NodeList` is used internally
|
|
12
|
+
* in classes like {@link module:engine/model/element~ModelElement Element}
|
|
13
|
+
* or {@link module:engine/model/documentfragment~ModelDocumentFragment ModelDocumentFragment}.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export class ModelNodeList {
|
|
16
16
|
/**
|
|
17
17
|
* Nodes contained in this node list.
|
|
18
18
|
*/
|
|
@@ -51,7 +51,7 @@ export default class NodeList {
|
|
|
51
51
|
return this._nodes.length;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
* Sum of {@link module:engine/model/node~
|
|
54
|
+
* Sum of {@link module:engine/model/node~ModelNode#offsetSize offset sizes} of all nodes contained inside this node list.
|
|
55
55
|
*/
|
|
56
56
|
get maxOffset() {
|
|
57
57
|
return this._offsetToNode.length;
|
|
@@ -71,7 +71,7 @@ export default class NodeList {
|
|
|
71
71
|
/**
|
|
72
72
|
* Returns an index of the given node or `null` if given node does not have a parent.
|
|
73
73
|
*
|
|
74
|
-
* This is an alias to {@link module:engine/model/node~
|
|
74
|
+
* This is an alias to {@link module:engine/model/node~ModelNode#index}.
|
|
75
75
|
*/
|
|
76
76
|
getNodeIndex(node) {
|
|
77
77
|
return node.index;
|
|
@@ -79,7 +79,7 @@ export default class NodeList {
|
|
|
79
79
|
/**
|
|
80
80
|
* Returns the offset at which given node is placed in its parent or `null` if given node does not have a parent.
|
|
81
81
|
*
|
|
82
|
-
* This is an alias to {@link module:engine/model/node~
|
|
82
|
+
* This is an alias to {@link module:engine/model/node~ModelNode#startOffset}.
|
|
83
83
|
*/
|
|
84
84
|
getNodeStartOffset(node) {
|
|
85
85
|
return node.startOffset;
|
|
@@ -122,7 +122,7 @@ export default class NodeList {
|
|
|
122
122
|
*
|
|
123
123
|
* @error model-nodelist-offset-out-of-bounds
|
|
124
124
|
* @param {number} offset The offset value.
|
|
125
|
-
* @param {module:engine/model/nodelist~
|
|
125
|
+
* @param {module:engine/model/nodelist~ModelNodeList} nodeList Stringified node list.
|
|
126
126
|
*/
|
|
127
127
|
throw new CKEditorError('model-nodelist-offset-out-of-bounds', this, {
|
|
128
128
|
offset,
|
|
@@ -142,7 +142,7 @@ export default class NodeList {
|
|
|
142
142
|
const nodesArray = [];
|
|
143
143
|
// Validation.
|
|
144
144
|
for (const node of nodes) {
|
|
145
|
-
if (!(node instanceof
|
|
145
|
+
if (!(node instanceof ModelNode)) {
|
|
146
146
|
/**
|
|
147
147
|
* Trying to insert an object which is not a Node instance.
|
|
148
148
|
*
|
|
@@ -229,7 +229,7 @@ export default class NodeList {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
|
-
* Creates an array of nodes in the format as in {@link module:engine/model/nodelist~
|
|
232
|
+
* Creates an array of nodes in the format as in {@link module:engine/model/nodelist~ModelNodeList#_offsetToNode}, i.e. one node will
|
|
233
233
|
* occupy multiple items if its offset size is greater than one.
|
|
234
234
|
*/
|
|
235
235
|
function makeOffsetsArray(nodes) {
|
|
@@ -5,22 +5,22 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/attributeoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
9
|
-
import
|
|
10
|
-
import type
|
|
11
|
-
import type {
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
|
+
import { ModelRange } from '../range.js';
|
|
10
|
+
import { type ModelDocument } from '../document.js';
|
|
11
|
+
import type { ModelSelectable } from '../selection.js';
|
|
12
12
|
/**
|
|
13
13
|
* Operation to change nodes' attribute.
|
|
14
14
|
*
|
|
15
15
|
* Using this class you can add, remove or change value of the attribute.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export declare class AttributeOperation extends Operation {
|
|
18
18
|
/**
|
|
19
19
|
* Range on which operation should be applied.
|
|
20
20
|
*
|
|
21
21
|
* @readonly
|
|
22
22
|
*/
|
|
23
|
-
range:
|
|
23
|
+
range: ModelRange;
|
|
24
24
|
/**
|
|
25
25
|
* Key of an attribute to change or remove.
|
|
26
26
|
*
|
|
@@ -55,10 +55,10 @@ export default class AttributeOperation extends Operation {
|
|
|
55
55
|
* @param key Key of an attribute to change or remove.
|
|
56
56
|
* @param oldValue Old value of the attribute with given key or `null`, if attribute was not set before.
|
|
57
57
|
* @param newValue New value of the attribute with given key or `null`, if operation should remove attribute.
|
|
58
|
-
* @param baseVersion Document {@link module:engine/model/document~
|
|
58
|
+
* @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
|
|
59
59
|
* can be applied or `null` if the operation operates on detached (non-document) tree.
|
|
60
60
|
*/
|
|
61
|
-
constructor(range:
|
|
61
|
+
constructor(range: ModelRange, key: string, oldValue: unknown, newValue: unknown, baseVersion: number | null);
|
|
62
62
|
/**
|
|
63
63
|
* @inheritDoc
|
|
64
64
|
*/
|
|
@@ -66,7 +66,7 @@ export default class AttributeOperation extends Operation {
|
|
|
66
66
|
/**
|
|
67
67
|
* @inheritDoc
|
|
68
68
|
*/
|
|
69
|
-
get affectedSelectable():
|
|
69
|
+
get affectedSelectable(): ModelSelectable;
|
|
70
70
|
/**
|
|
71
71
|
* Creates and returns an operation that has the same parameters as this operation.
|
|
72
72
|
*/
|
|
@@ -99,5 +99,5 @@ export default class AttributeOperation extends Operation {
|
|
|
99
99
|
* @param json Deserialized JSON object.
|
|
100
100
|
* @param document Document on which this operation will be applied.
|
|
101
101
|
*/
|
|
102
|
-
static fromJSON(json: any, document:
|
|
102
|
+
static fromJSON(json: any, document: ModelDocument): AttributeOperation;
|
|
103
103
|
}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/attributeoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
9
|
import { _setAttribute } from './utils.js';
|
|
10
|
-
import
|
|
10
|
+
import { ModelRange } from '../range.js';
|
|
11
11
|
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
12
12
|
import { isEqual } from 'es-toolkit/compat';
|
|
13
13
|
/**
|
|
@@ -15,7 +15,7 @@ import { isEqual } from 'es-toolkit/compat';
|
|
|
15
15
|
*
|
|
16
16
|
* Using this class you can add, remove or change value of the attribute.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export class AttributeOperation extends Operation {
|
|
19
19
|
/**
|
|
20
20
|
* Range on which operation should be applied.
|
|
21
21
|
*
|
|
@@ -56,7 +56,7 @@ export default class AttributeOperation extends Operation {
|
|
|
56
56
|
* @param key Key of an attribute to change or remove.
|
|
57
57
|
* @param oldValue Old value of the attribute with given key or `null`, if attribute was not set before.
|
|
58
58
|
* @param newValue New value of the attribute with given key or `null`, if operation should remove attribute.
|
|
59
|
-
* @param baseVersion Document {@link module:engine/model/document~
|
|
59
|
+
* @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
|
|
60
60
|
* can be applied or `null` if the operation operates on detached (non-document) tree.
|
|
61
61
|
*/
|
|
62
62
|
constructor(range, key, oldValue, newValue, baseVersion) {
|
|
@@ -125,7 +125,7 @@ export default class AttributeOperation extends Operation {
|
|
|
125
125
|
* Changed node has different attribute value than operation's old attribute value.
|
|
126
126
|
*
|
|
127
127
|
* @error attribute-operation-wrong-old-value
|
|
128
|
-
* @param {module:engine/model/item~
|
|
128
|
+
* @param {module:engine/model/item~ModelItem} root The item element.
|
|
129
129
|
* @param {string} key The key of the attribute.
|
|
130
130
|
* @param {never} value The value.
|
|
131
131
|
*/
|
|
@@ -136,7 +136,7 @@ export default class AttributeOperation extends Operation {
|
|
|
136
136
|
* The attribute with given key already exists for the given node.
|
|
137
137
|
*
|
|
138
138
|
* @error attribute-operation-attribute-exists
|
|
139
|
-
* @param {module:engine/model/item~
|
|
139
|
+
* @param {module:engine/model/item~ModelItem} root The item element.
|
|
140
140
|
* @param {string} key The key of the attribute.
|
|
141
141
|
*/
|
|
142
142
|
throw new CKEditorError('attribute-operation-attribute-exists', this, { node: item, key: this.key });
|
|
@@ -167,6 +167,6 @@ export default class AttributeOperation extends Operation {
|
|
|
167
167
|
* @param document Document on which this operation will be applied.
|
|
168
168
|
*/
|
|
169
169
|
static fromJSON(json, document) {
|
|
170
|
-
return new AttributeOperation(
|
|
170
|
+
return new AttributeOperation(ModelRange.fromJSON(json.range, document), json.key, json.oldValue, json.newValue, json.baseVersion);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
@@ -5,18 +5,20 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/detachoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
9
|
-
import type
|
|
10
|
-
import type {
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
|
+
import { type ModelPosition } from '../position.js';
|
|
10
|
+
import type { ModelSelectable } from '../selection.js';
|
|
11
11
|
/**
|
|
12
12
|
* Operation to permanently remove node from detached root.
|
|
13
13
|
* Note this operation is only a local operation and won't be send to the other clients.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
14
16
|
*/
|
|
15
|
-
export
|
|
17
|
+
export declare class DetachOperation extends Operation {
|
|
16
18
|
/**
|
|
17
|
-
* Position before the first {@link module:engine/model/item~
|
|
19
|
+
* Position before the first {@link module:engine/model/item~ModelItem model item} to detach.
|
|
18
20
|
*/
|
|
19
|
-
sourcePosition:
|
|
21
|
+
sourcePosition: ModelPosition;
|
|
20
22
|
/**
|
|
21
23
|
* Offset size of moved range.
|
|
22
24
|
*/
|
|
@@ -26,11 +28,11 @@ export default class DetachOperation extends Operation {
|
|
|
26
28
|
/**
|
|
27
29
|
* Creates an insert operation.
|
|
28
30
|
*
|
|
29
|
-
* @param sourcePosition Position before the first {@link module:engine/model/item~
|
|
31
|
+
* @param sourcePosition Position before the first {@link module:engine/model/item~ModelItem model item} to move.
|
|
30
32
|
* @param howMany Offset size of moved range. Moved range will start from `sourcePosition` and end at
|
|
31
33
|
* `sourcePosition` with offset shifted by `howMany`.
|
|
32
34
|
*/
|
|
33
|
-
constructor(sourcePosition:
|
|
35
|
+
constructor(sourcePosition: ModelPosition, howMany: number);
|
|
34
36
|
/**
|
|
35
37
|
* @inheritDoc
|
|
36
38
|
*/
|
|
@@ -38,7 +40,7 @@ export default class DetachOperation extends Operation {
|
|
|
38
40
|
/**
|
|
39
41
|
* @inheritDoc
|
|
40
42
|
*/
|
|
41
|
-
get affectedSelectable():
|
|
43
|
+
get affectedSelectable(): ModelSelectable;
|
|
42
44
|
/**
|
|
43
45
|
* @inheritDoc
|
|
44
46
|
*/
|
|
@@ -5,18 +5,20 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/detachoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
9
|
-
import
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
|
+
import { ModelRange } from '../range.js';
|
|
10
10
|
import { _remove } from './utils.js';
|
|
11
11
|
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
12
12
|
// @if CK_DEBUG_ENGINE // const ModelRange = require( '../range' ).default;
|
|
13
13
|
/**
|
|
14
14
|
* Operation to permanently remove node from detached root.
|
|
15
15
|
* Note this operation is only a local operation and won't be send to the other clients.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
16
18
|
*/
|
|
17
|
-
export
|
|
19
|
+
export class DetachOperation extends Operation {
|
|
18
20
|
/**
|
|
19
|
-
* Position before the first {@link module:engine/model/item~
|
|
21
|
+
* Position before the first {@link module:engine/model/item~ModelItem model item} to detach.
|
|
20
22
|
*/
|
|
21
23
|
sourcePosition;
|
|
22
24
|
/**
|
|
@@ -26,7 +28,7 @@ export default class DetachOperation extends Operation {
|
|
|
26
28
|
/**
|
|
27
29
|
* Creates an insert operation.
|
|
28
30
|
*
|
|
29
|
-
* @param sourcePosition Position before the first {@link module:engine/model/item~
|
|
31
|
+
* @param sourcePosition Position before the first {@link module:engine/model/item~ModelItem model item} to move.
|
|
30
32
|
* @param howMany Offset size of moved range. Moved range will start from `sourcePosition` and end at
|
|
31
33
|
* `sourcePosition` with offset shifted by `howMany`.
|
|
32
34
|
*/
|
|
@@ -74,7 +76,7 @@ export default class DetachOperation extends Operation {
|
|
|
74
76
|
* @internal
|
|
75
77
|
*/
|
|
76
78
|
_execute() {
|
|
77
|
-
_remove(
|
|
79
|
+
_remove(ModelRange._createFromPositionAndShift(this.sourcePosition, this.howMany));
|
|
78
80
|
}
|
|
79
81
|
/**
|
|
80
82
|
* @inheritDoc
|
|
@@ -5,28 +5,28 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/insertoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { type
|
|
12
|
-
import type {
|
|
13
|
-
import type
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
|
+
import { ModelPosition } from '../position.js';
|
|
10
|
+
import { ModelNodeList } from '../nodelist.js';
|
|
11
|
+
import { type ModelNodeSet } from './utils.js';
|
|
12
|
+
import type { ModelSelectable } from '../selection.js';
|
|
13
|
+
import { type ModelDocument } from '../document.js';
|
|
14
14
|
/**
|
|
15
15
|
* Operation to insert one or more nodes at given position in the model.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export declare class InsertOperation extends Operation {
|
|
18
18
|
/**
|
|
19
19
|
* Position of insertion.
|
|
20
20
|
*
|
|
21
21
|
* @readonly
|
|
22
22
|
*/
|
|
23
|
-
position:
|
|
23
|
+
position: ModelPosition;
|
|
24
24
|
/**
|
|
25
25
|
* List of nodes to insert.
|
|
26
26
|
*
|
|
27
27
|
* @readonly
|
|
28
28
|
*/
|
|
29
|
-
nodes:
|
|
29
|
+
nodes: ModelNodeList;
|
|
30
30
|
/**
|
|
31
31
|
* Flag deciding how the operation should be transformed. If set to `true`, nodes might get additional attributes
|
|
32
32
|
* during operational transformation. This happens when the operation insertion position is inside of a range
|
|
@@ -38,10 +38,10 @@ export default class InsertOperation extends Operation {
|
|
|
38
38
|
*
|
|
39
39
|
* @param position Position of insertion.
|
|
40
40
|
* @param nodes The list of nodes to be inserted.
|
|
41
|
-
* @param baseVersion Document {@link module:engine/model/document~
|
|
41
|
+
* @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
|
|
42
42
|
* can be applied or `null` if the operation operates on detached (non-document) tree.
|
|
43
43
|
*/
|
|
44
|
-
constructor(position:
|
|
44
|
+
constructor(position: ModelPosition, nodes: ModelNodeSet, baseVersion: number | null);
|
|
45
45
|
/**
|
|
46
46
|
* @inheritDoc
|
|
47
47
|
*/
|
|
@@ -53,7 +53,7 @@ export default class InsertOperation extends Operation {
|
|
|
53
53
|
/**
|
|
54
54
|
* @inheritDoc
|
|
55
55
|
*/
|
|
56
|
-
get affectedSelectable():
|
|
56
|
+
get affectedSelectable(): ModelSelectable;
|
|
57
57
|
/**
|
|
58
58
|
* Creates and returns an operation that has the same parameters as this operation.
|
|
59
59
|
*/
|
|
@@ -86,5 +86,5 @@ export default class InsertOperation extends Operation {
|
|
|
86
86
|
* @param json Deserialized JSON object.
|
|
87
87
|
* @param document Document on which this operation will be applied.
|
|
88
88
|
*/
|
|
89
|
-
static fromJSON(json: any, document:
|
|
89
|
+
static fromJSON(json: any, document: ModelDocument): InsertOperation;
|
|
90
90
|
}
|