@ckeditor/ckeditor5-engine 45.2.1-alpha.9 → 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/view/treewalker.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import { ViewTextProxy } from './textproxy.js';
|
|
6
|
+
import { ViewPosition } from './position.js';
|
|
7
7
|
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
8
8
|
/**
|
|
9
9
|
* Position iterator class. It allows to iterate forward and backward over the document.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export class ViewTreeWalker {
|
|
12
12
|
/**
|
|
13
13
|
* Walking direction. Defaults `'forward'`.
|
|
14
14
|
*/
|
|
@@ -23,8 +23,8 @@ export default class TreeWalker {
|
|
|
23
23
|
*/
|
|
24
24
|
boundaries;
|
|
25
25
|
/**
|
|
26
|
-
* Flag indicating whether all characters from {@link module:engine/view/text~
|
|
27
|
-
* {@link module:engine/view/text~
|
|
26
|
+
* Flag indicating whether all characters from {@link module:engine/view/text~ViewText} should be returned as one
|
|
27
|
+
* {@link module:engine/view/text~ViewText} or one by one as {@link module:engine/view/textproxy~ViewTextProxy}.
|
|
28
28
|
*/
|
|
29
29
|
singleCharacters;
|
|
30
30
|
/**
|
|
@@ -34,7 +34,7 @@ export default class TreeWalker {
|
|
|
34
34
|
shallow;
|
|
35
35
|
/**
|
|
36
36
|
* Flag indicating whether iterator should ignore `elementEnd` tags. If set to `true`, walker will not
|
|
37
|
-
* return a parent node of the start position. Each {@link module:engine/view/element~
|
|
37
|
+
* return a parent node of the start position. Each {@link module:engine/view/element~ViewElement} will be returned once.
|
|
38
38
|
* When set to `false` each element might be returned twice: for `'elementStart'` and `'elementEnd'`.
|
|
39
39
|
*/
|
|
40
40
|
ignoreElementEnd;
|
|
@@ -75,10 +75,10 @@ export default class TreeWalker {
|
|
|
75
75
|
}
|
|
76
76
|
this.boundaries = options.boundaries || null;
|
|
77
77
|
if (options.startPosition) {
|
|
78
|
-
this._position =
|
|
78
|
+
this._position = ViewPosition._createAt(options.startPosition);
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
|
-
this._position =
|
|
81
|
+
this._position = ViewPosition._createAt(options.boundaries[options.direction == 'backward' ? 'end' : 'start']);
|
|
82
82
|
}
|
|
83
83
|
this.direction = options.direction || 'forward';
|
|
84
84
|
this.singleCharacters = !!options.singleCharacters;
|
|
@@ -111,7 +111,7 @@ export default class TreeWalker {
|
|
|
111
111
|
* walker.skip( value => false ); // Do not move the position.
|
|
112
112
|
* ```
|
|
113
113
|
*
|
|
114
|
-
* @param skip Callback function. Gets {@link module:engine/view/treewalker~
|
|
114
|
+
* @param skip Callback function. Gets {@link module:engine/view/treewalker~ViewTreeWalkerValue} and should
|
|
115
115
|
* return `true` if the value should be skipped or `false` if not.
|
|
116
116
|
*/
|
|
117
117
|
skip(skip) {
|
|
@@ -129,9 +129,9 @@ export default class TreeWalker {
|
|
|
129
129
|
* Moves tree walker {@link #position} to provided `position`. Tree walker will
|
|
130
130
|
* continue traversing from that position.
|
|
131
131
|
*
|
|
132
|
-
* Note: in contrary to {@link ~
|
|
132
|
+
* Note: in contrary to {@link ~ViewTreeWalker#skip}, this method does not iterate over the nodes along the way.
|
|
133
133
|
* It simply sets the current tree walker position to a new one.
|
|
134
|
-
* From the performance standpoint, it is better to use {@link ~
|
|
134
|
+
* From the performance standpoint, it is better to use {@link ~ViewTreeWalker#jumpTo} rather than {@link ~ViewTreeWalker#skip}.
|
|
135
135
|
*
|
|
136
136
|
* If the provided position is before the start boundary, the position will be
|
|
137
137
|
* set to the start boundary. If the provided position is after the end boundary,
|
|
@@ -184,7 +184,7 @@ export default class TreeWalker {
|
|
|
184
184
|
if (parent && parent.is('view:$text')) {
|
|
185
185
|
if (position.isAtEnd) {
|
|
186
186
|
// Prevent returning "elementEnd" for Text node. Skip that value and return the next walker step.
|
|
187
|
-
this._position =
|
|
187
|
+
this._position = ViewPosition._createAfter(parent);
|
|
188
188
|
return this._next();
|
|
189
189
|
}
|
|
190
190
|
node = parent.data[position.offset];
|
|
@@ -202,14 +202,14 @@ export default class TreeWalker {
|
|
|
202
202
|
const endOffset = parent === this._boundaryEndParent ? this.boundaries.end.offset : parent.data.length;
|
|
203
203
|
textLength = endOffset - position.offset;
|
|
204
204
|
}
|
|
205
|
-
const textProxy = new
|
|
205
|
+
const textProxy = new ViewTextProxy(parent, position.offset, textLength);
|
|
206
206
|
position.offset += textLength;
|
|
207
207
|
this._position = position;
|
|
208
208
|
return this._formatReturnValue('text', textProxy, previousPosition, position, textLength);
|
|
209
209
|
}
|
|
210
210
|
if (node && node.is('view:element')) {
|
|
211
211
|
if (!this.shallow) {
|
|
212
|
-
position = new
|
|
212
|
+
position = new ViewPosition(node, 0);
|
|
213
213
|
}
|
|
214
214
|
else {
|
|
215
215
|
// We are past the walker boundaries.
|
|
@@ -223,20 +223,20 @@ export default class TreeWalker {
|
|
|
223
223
|
}
|
|
224
224
|
if (node && node.is('view:$text')) {
|
|
225
225
|
if (this.singleCharacters) {
|
|
226
|
-
position = new
|
|
226
|
+
position = new ViewPosition(node, 0);
|
|
227
227
|
this._position = position;
|
|
228
228
|
return this._next();
|
|
229
229
|
}
|
|
230
230
|
let charactersCount = node.data.length;
|
|
231
231
|
let item;
|
|
232
|
-
// If text stick out of walker range, we need to cut it and wrap in
|
|
232
|
+
// If text stick out of walker range, we need to cut it and wrap in ViewTextProxy.
|
|
233
233
|
if (node == this._boundaryEndParent) {
|
|
234
234
|
charactersCount = this.boundaries.end.offset;
|
|
235
|
-
item = new
|
|
236
|
-
position =
|
|
235
|
+
item = new ViewTextProxy(node, 0, charactersCount);
|
|
236
|
+
position = ViewPosition._createAfter(item);
|
|
237
237
|
}
|
|
238
238
|
else {
|
|
239
|
-
item = new
|
|
239
|
+
item = new ViewTextProxy(node, 0, node.data.length);
|
|
240
240
|
// If not just keep moving forward.
|
|
241
241
|
position.offset++;
|
|
242
242
|
}
|
|
@@ -244,7 +244,7 @@ export default class TreeWalker {
|
|
|
244
244
|
return this._formatReturnValue('text', item, previousPosition, position, charactersCount);
|
|
245
245
|
}
|
|
246
246
|
// `node` is not set, we reached the end of current `parent`.
|
|
247
|
-
position =
|
|
247
|
+
position = ViewPosition._createAfter(parent);
|
|
248
248
|
this._position = position;
|
|
249
249
|
if (this.ignoreElementEnd) {
|
|
250
250
|
return this._next();
|
|
@@ -268,11 +268,11 @@ export default class TreeWalker {
|
|
|
268
268
|
}
|
|
269
269
|
// Get node just before current position.
|
|
270
270
|
let node;
|
|
271
|
-
// Text {@link module:engine/view/text~
|
|
271
|
+
// Text {@link module:engine/view/text~ViewText} element is a specific parent because contains string instead of child nodes.
|
|
272
272
|
if (parent.is('view:$text')) {
|
|
273
273
|
if (position.isAtStart) {
|
|
274
274
|
// Prevent returning "elementStart" for Text node. Skip that value and return the next walker step.
|
|
275
|
-
this._position =
|
|
275
|
+
this._position = ViewPosition._createBefore(parent);
|
|
276
276
|
return this._previous();
|
|
277
277
|
}
|
|
278
278
|
node = parent.data[position.offset - 1];
|
|
@@ -291,7 +291,7 @@ export default class TreeWalker {
|
|
|
291
291
|
textLength = 1;
|
|
292
292
|
}
|
|
293
293
|
position.offset -= textLength;
|
|
294
|
-
const textProxy = new
|
|
294
|
+
const textProxy = new ViewTextProxy(parent, position.offset, textLength);
|
|
295
295
|
this._position = position;
|
|
296
296
|
return this._formatReturnValue('text', textProxy, previousPosition, position, textLength);
|
|
297
297
|
}
|
|
@@ -301,7 +301,7 @@ export default class TreeWalker {
|
|
|
301
301
|
this._position = position;
|
|
302
302
|
return this._formatReturnValue('elementStart', node, previousPosition, position, 1);
|
|
303
303
|
}
|
|
304
|
-
position = new
|
|
304
|
+
position = new ViewPosition(node, node.childCount);
|
|
305
305
|
this._position = position;
|
|
306
306
|
if (this.ignoreElementEnd) {
|
|
307
307
|
return this._previous();
|
|
@@ -310,21 +310,21 @@ export default class TreeWalker {
|
|
|
310
310
|
}
|
|
311
311
|
if (node && node.is('view:$text')) {
|
|
312
312
|
if (this.singleCharacters) {
|
|
313
|
-
position = new
|
|
313
|
+
position = new ViewPosition(node, node.data.length);
|
|
314
314
|
this._position = position;
|
|
315
315
|
return this._previous();
|
|
316
316
|
}
|
|
317
317
|
let charactersCount = node.data.length;
|
|
318
318
|
let item;
|
|
319
|
-
// If text stick out of walker range, we need to cut it and wrap in
|
|
319
|
+
// If text stick out of walker range, we need to cut it and wrap in ViewTextProxy.
|
|
320
320
|
if (node == this._boundaryStartParent) {
|
|
321
321
|
const offset = this.boundaries.start.offset;
|
|
322
|
-
item = new
|
|
322
|
+
item = new ViewTextProxy(node, offset, node.data.length - offset);
|
|
323
323
|
charactersCount = item.data.length;
|
|
324
|
-
position =
|
|
324
|
+
position = ViewPosition._createBefore(item);
|
|
325
325
|
}
|
|
326
326
|
else {
|
|
327
|
-
item = new
|
|
327
|
+
item = new ViewTextProxy(node, 0, node.data.length);
|
|
328
328
|
// If not just keep moving backward.
|
|
329
329
|
position.offset--;
|
|
330
330
|
}
|
|
@@ -332,12 +332,13 @@ export default class TreeWalker {
|
|
|
332
332
|
return this._formatReturnValue('text', item, previousPosition, position, charactersCount);
|
|
333
333
|
}
|
|
334
334
|
// `node` is not set, we reached the beginning of current `parent`.
|
|
335
|
-
position =
|
|
335
|
+
position = ViewPosition._createBefore(parent);
|
|
336
336
|
this._position = position;
|
|
337
337
|
return this._formatReturnValue('elementStart', parent, previousPosition, position, 1);
|
|
338
338
|
}
|
|
339
339
|
/**
|
|
340
|
-
* Format returned data and adjust `previousPosition` and `nextPosition` if
|
|
340
|
+
* Format returned data and adjust `previousPosition` and `nextPosition` if
|
|
341
|
+
* reach the bound of the {@link module:engine/view/text~ViewText}.
|
|
341
342
|
*
|
|
342
343
|
* @param type Type of step.
|
|
343
344
|
* @param item Item between old and new position.
|
|
@@ -354,23 +355,23 @@ export default class TreeWalker {
|
|
|
354
355
|
// Position is at the end of Text.
|
|
355
356
|
if (item.offsetInText + item.data.length == item.textNode.data.length) {
|
|
356
357
|
if (this.direction == 'forward' && !(this.boundaries && this.boundaries.end.isEqual(this.position))) {
|
|
357
|
-
nextPosition =
|
|
358
|
+
nextPosition = ViewPosition._createAfter(item.textNode);
|
|
358
359
|
// When we change nextPosition of returned value we need also update walker current position.
|
|
359
360
|
this._position = nextPosition;
|
|
360
361
|
}
|
|
361
362
|
else {
|
|
362
|
-
previousPosition =
|
|
363
|
+
previousPosition = ViewPosition._createAfter(item.textNode);
|
|
363
364
|
}
|
|
364
365
|
}
|
|
365
366
|
// Position is at the begining ot the text.
|
|
366
367
|
if (item.offsetInText === 0) {
|
|
367
368
|
if (this.direction == 'backward' && !(this.boundaries && this.boundaries.start.isEqual(this.position))) {
|
|
368
|
-
nextPosition =
|
|
369
|
+
nextPosition = ViewPosition._createBefore(item.textNode);
|
|
369
370
|
// When we change nextPosition of returned value we need also update walker current position.
|
|
370
371
|
this._position = nextPosition;
|
|
371
372
|
}
|
|
372
373
|
else {
|
|
373
|
-
previousPosition =
|
|
374
|
+
previousPosition = ViewPosition._createBefore(item.textNode);
|
|
374
375
|
}
|
|
375
376
|
}
|
|
376
377
|
}
|
|
@@ -2,31 +2,31 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
6
|
-
import type
|
|
7
|
-
import type
|
|
8
|
-
import type
|
|
9
|
-
import type
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
12
|
-
import type
|
|
13
|
-
import type
|
|
14
|
-
import type
|
|
15
|
-
import type
|
|
16
|
-
import type
|
|
17
|
-
import type
|
|
18
|
-
import type
|
|
19
|
-
import type
|
|
20
|
-
import type
|
|
5
|
+
import { type ViewAttributeElement } from './attributeelement.js';
|
|
6
|
+
import { type ViewContainerElement } from './containerelement.js';
|
|
7
|
+
import { type ViewDocumentFragment } from './documentfragment.js';
|
|
8
|
+
import { type ViewDocumentSelection } from './documentselection.js';
|
|
9
|
+
import { type ViewEditableElement } from './editableelement.js';
|
|
10
|
+
import { type ViewElement } from './element.js';
|
|
11
|
+
import { type ViewEmptyElement } from './emptyelement.js';
|
|
12
|
+
import { type ViewNode } from './node.js';
|
|
13
|
+
import { type ViewPosition } from './position.js';
|
|
14
|
+
import { type ViewRange } from './range.js';
|
|
15
|
+
import { type ViewRawElement } from './rawelement.js';
|
|
16
|
+
import { type ViewRootEditableElement } from './rooteditableelement.js';
|
|
17
|
+
import { type ViewSelection } from './selection.js';
|
|
18
|
+
import { type ViewText } from './text.js';
|
|
19
|
+
import { type ViewTextProxy } from './textproxy.js';
|
|
20
|
+
import { type ViewUIElement } from './uielement.js';
|
|
21
21
|
/**
|
|
22
22
|
* @module engine/view/typecheckable
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export declare abstract class ViewTypeCheckable {
|
|
25
25
|
/**
|
|
26
|
-
* Checks whether this object is of type {@link module:engine/view/node~
|
|
26
|
+
* Checks whether this object is of type {@link module:engine/view/node~ViewNode} or its subclass.
|
|
27
27
|
*
|
|
28
28
|
* This method is useful when processing view objects that are of unknown type. For example, a function
|
|
29
|
-
* may return a {@link module:engine/view/documentfragment~
|
|
29
|
+
* may return a {@link module:engine/view/documentfragment~ViewDocumentFragment} or a {@link module:engine/view/node~ViewNode}
|
|
30
30
|
* that can be either a text node or an element. This method can be used to check what kind of object is returned.
|
|
31
31
|
*
|
|
32
32
|
* ```ts
|
|
@@ -51,9 +51,9 @@ export default abstract class TypeCheckable {
|
|
|
51
51
|
* ```
|
|
52
52
|
* @label NODE
|
|
53
53
|
*/
|
|
54
|
-
is(type: 'node' | 'view:node'): this is (
|
|
54
|
+
is(type: 'node' | 'view:node'): this is (ViewNode | ViewText | ViewElement | ViewAttributeElement | ViewContainerElement | ViewEditableElement | ViewEmptyElement | ViewRawElement | ViewRootEditableElement | ViewUIElement);
|
|
55
55
|
/**
|
|
56
|
-
* Checks whether this object is of type {@link module:engine/view/element~
|
|
56
|
+
* Checks whether this object is of type {@link module:engine/view/element~ViewElement} or its subclass.
|
|
57
57
|
*
|
|
58
58
|
* ```ts
|
|
59
59
|
* element.is( 'element' ); // -> true
|
|
@@ -66,7 +66,7 @@ export default abstract class TypeCheckable {
|
|
|
66
66
|
* ```
|
|
67
67
|
*
|
|
68
68
|
* Assuming that the object being checked is an element, you can also check its
|
|
69
|
-
* {@link module:engine/view/element~
|
|
69
|
+
* {@link module:engine/view/element~ViewElement#name name}:
|
|
70
70
|
*
|
|
71
71
|
* ```ts
|
|
72
72
|
* element.is( 'element', 'img' ); // -> true if this is an <img> element
|
|
@@ -75,9 +75,9 @@ export default abstract class TypeCheckable {
|
|
|
75
75
|
*
|
|
76
76
|
* @label ELEMENT
|
|
77
77
|
*/
|
|
78
|
-
is(type: 'element' | 'view:element'): this is (
|
|
78
|
+
is(type: 'element' | 'view:element'): this is (ViewElement | ViewAttributeElement | ViewContainerElement | ViewEditableElement | ViewEmptyElement | ViewRawElement | ViewRootEditableElement | ViewUIElement);
|
|
79
79
|
/**
|
|
80
|
-
* Checks whether this object is of type {@link module:engine/view/attributeelement~
|
|
80
|
+
* Checks whether this object is of type {@link module:engine/view/attributeelement~ViewAttributeElement}.
|
|
81
81
|
*
|
|
82
82
|
* ```ts
|
|
83
83
|
* attributeElement.is( 'attributeElement' ); // -> true
|
|
@@ -92,7 +92,7 @@ export default abstract class TypeCheckable {
|
|
|
92
92
|
* ```
|
|
93
93
|
*
|
|
94
94
|
* Assuming that the object being checked is an attribute element, you can also check its
|
|
95
|
-
* {@link module:engine/view/attributeelement~
|
|
95
|
+
* {@link module:engine/view/attributeelement~ViewAttributeElement#name name}:
|
|
96
96
|
*
|
|
97
97
|
* ```ts
|
|
98
98
|
* attributeElement.is( 'element', 'b' ); // -> true if this is a bold element
|
|
@@ -102,9 +102,9 @@ export default abstract class TypeCheckable {
|
|
|
102
102
|
*
|
|
103
103
|
* @label ATTRIBUTE_ELEMENT
|
|
104
104
|
*/
|
|
105
|
-
is(type: 'attributeElement' | 'view:attributeElement'): this is
|
|
105
|
+
is(type: 'attributeElement' | 'view:attributeElement'): this is ViewAttributeElement;
|
|
106
106
|
/**
|
|
107
|
-
* Checks whether this object is of type {@link module:engine/view/containerelement~
|
|
107
|
+
* Checks whether this object is of type {@link module:engine/view/containerelement~ViewContainerElement} or its subclass.
|
|
108
108
|
*
|
|
109
109
|
* ```ts
|
|
110
110
|
* containerElement.is( 'containerElement' ); // -> true
|
|
@@ -119,7 +119,7 @@ export default abstract class TypeCheckable {
|
|
|
119
119
|
* ```
|
|
120
120
|
*
|
|
121
121
|
* Assuming that the object being checked is a container element, you can also check its
|
|
122
|
-
* {@link module:engine/view/containerelement~
|
|
122
|
+
* {@link module:engine/view/containerelement~ViewContainerElement#name name}:
|
|
123
123
|
*
|
|
124
124
|
* ```ts
|
|
125
125
|
* containerElement.is( 'element', 'div' ); // -> true if this is a div container element
|
|
@@ -129,9 +129,9 @@ export default abstract class TypeCheckable {
|
|
|
129
129
|
*
|
|
130
130
|
* @label CONTAINER_ELEMENT
|
|
131
131
|
*/
|
|
132
|
-
is(type: 'containerElement' | 'view:containerElement'): this is
|
|
132
|
+
is(type: 'containerElement' | 'view:containerElement'): this is ViewContainerElement | ViewEditableElement | ViewRootEditableElement;
|
|
133
133
|
/**
|
|
134
|
-
* Checks whether this object is of type {@link module:engine/view/editableelement~
|
|
134
|
+
* Checks whether this object is of type {@link module:engine/view/editableelement~ViewEditableElement} or its subclass.
|
|
135
135
|
*
|
|
136
136
|
* ```ts
|
|
137
137
|
* editableElement.is( 'editableElement' ); // -> true
|
|
@@ -146,7 +146,7 @@ export default abstract class TypeCheckable {
|
|
|
146
146
|
* ```
|
|
147
147
|
*
|
|
148
148
|
* Assuming that the object being checked is an editbale element, you can also check its
|
|
149
|
-
* {@link module:engine/view/editableelement~
|
|
149
|
+
* {@link module:engine/view/editableelement~ViewEditableElement#name name}:
|
|
150
150
|
*
|
|
151
151
|
* ```ts
|
|
152
152
|
* editableElement.is( 'element', 'div' ); // -> true if this is a div element
|
|
@@ -156,9 +156,9 @@ export default abstract class TypeCheckable {
|
|
|
156
156
|
*
|
|
157
157
|
* @label EDITABLE_ELEMENT
|
|
158
158
|
*/
|
|
159
|
-
is(type: 'editableElement' | 'view:editableElement'): this is
|
|
159
|
+
is(type: 'editableElement' | 'view:editableElement'): this is ViewEditableElement | ViewRootEditableElement;
|
|
160
160
|
/**
|
|
161
|
-
* Checks whether this object is of type {@link module:engine/view/emptyelement~
|
|
161
|
+
* Checks whether this object is of type {@link module:engine/view/emptyelement~ViewEmptyElement}.
|
|
162
162
|
*
|
|
163
163
|
* ```ts
|
|
164
164
|
* emptyElement.is( 'emptyElement' ); // -> true
|
|
@@ -173,7 +173,7 @@ export default abstract class TypeCheckable {
|
|
|
173
173
|
* ```
|
|
174
174
|
*
|
|
175
175
|
* Assuming that the object being checked is an empty element, you can also check its
|
|
176
|
-
* {@link module:engine/view/emptyelement~
|
|
176
|
+
* {@link module:engine/view/emptyelement~ViewEmptyElement#name name}:
|
|
177
177
|
*
|
|
178
178
|
* ```ts
|
|
179
179
|
* emptyElement.is( 'element', 'img' ); // -> true if this is a img element
|
|
@@ -183,9 +183,9 @@ export default abstract class TypeCheckable {
|
|
|
183
183
|
*
|
|
184
184
|
* @label EMPTY_ELEMENT
|
|
185
185
|
*/
|
|
186
|
-
is(type: 'emptyElement' | 'view:emptyElement'): this is
|
|
186
|
+
is(type: 'emptyElement' | 'view:emptyElement'): this is ViewEmptyElement;
|
|
187
187
|
/**
|
|
188
|
-
* Checks whether this object is of type {@link module:engine/view/rawelement~
|
|
188
|
+
* Checks whether this object is of type {@link module:engine/view/rawelement~ViewRawElement}.
|
|
189
189
|
*
|
|
190
190
|
* ```ts
|
|
191
191
|
* rawElement.is( 'rawElement' ); // -> true
|
|
@@ -200,7 +200,7 @@ export default abstract class TypeCheckable {
|
|
|
200
200
|
* ```
|
|
201
201
|
*
|
|
202
202
|
* Assuming that the object being checked is a raw element, you can also check its
|
|
203
|
-
* {@link module:engine/view/rawelement~
|
|
203
|
+
* {@link module:engine/view/rawelement~ViewRawElement#name name}:
|
|
204
204
|
*
|
|
205
205
|
* ```ts
|
|
206
206
|
* rawElement.is( 'img' ); // -> true if this is an img element
|
|
@@ -210,9 +210,9 @@ export default abstract class TypeCheckable {
|
|
|
210
210
|
*
|
|
211
211
|
* @label RAW_ELEMENT
|
|
212
212
|
*/
|
|
213
|
-
is(type: 'rawElement' | 'view:rawElement'): this is
|
|
213
|
+
is(type: 'rawElement' | 'view:rawElement'): this is ViewRawElement;
|
|
214
214
|
/**
|
|
215
|
-
* Checks whether this object is of type {@link module:engine/view/rooteditableelement~
|
|
215
|
+
* Checks whether this object is of type {@link module:engine/view/rooteditableelement~ViewRootEditableElement}.
|
|
216
216
|
*
|
|
217
217
|
* ```ts
|
|
218
218
|
* rootEditableElement.is( 'rootElement' ); // -> true
|
|
@@ -228,7 +228,7 @@ export default abstract class TypeCheckable {
|
|
|
228
228
|
* ```
|
|
229
229
|
*
|
|
230
230
|
* Assuming that the object being checked is a root editable element, you can also check its
|
|
231
|
-
* {@link module:engine/view/rooteditableelement~
|
|
231
|
+
* {@link module:engine/view/rooteditableelement~ViewRootEditableElement#name name}:
|
|
232
232
|
*
|
|
233
233
|
* ```ts
|
|
234
234
|
* rootEditableElement.is( 'element', 'div' ); // -> true if this is a div root editable element
|
|
@@ -238,9 +238,9 @@ export default abstract class TypeCheckable {
|
|
|
238
238
|
*
|
|
239
239
|
* @label ROOT_ELEMENT
|
|
240
240
|
*/
|
|
241
|
-
is(type: 'rootElement' | 'view:rootElement'): this is
|
|
241
|
+
is(type: 'rootElement' | 'view:rootElement'): this is ViewRootEditableElement;
|
|
242
242
|
/**
|
|
243
|
-
* Checks whether this object is of type {@link module:engine/view/uielement~
|
|
243
|
+
* Checks whether this object is of type {@link module:engine/view/uielement~ViewUIElement}.
|
|
244
244
|
*
|
|
245
245
|
* ```ts
|
|
246
246
|
* uiElement.is( 'uiElement' ); // -> true
|
|
@@ -255,7 +255,7 @@ export default abstract class TypeCheckable {
|
|
|
255
255
|
* ```
|
|
256
256
|
*
|
|
257
257
|
* Assuming that the object being checked is an ui element, you can also check its
|
|
258
|
-
* {@link module:engine/view/uielement~
|
|
258
|
+
* {@link module:engine/view/uielement~ViewUIElement#name name}:
|
|
259
259
|
*
|
|
260
260
|
* ```ts
|
|
261
261
|
* uiElement.is( 'element', 'span' ); // -> true if this is a span ui element
|
|
@@ -265,9 +265,9 @@ export default abstract class TypeCheckable {
|
|
|
265
265
|
*
|
|
266
266
|
* @label UI_ELEMENT
|
|
267
267
|
*/
|
|
268
|
-
is(type: 'uiElement' | 'view:uiElement'): this is
|
|
268
|
+
is(type: 'uiElement' | 'view:uiElement'): this is ViewUIElement;
|
|
269
269
|
/**
|
|
270
|
-
* Checks whether this object is of type {@link module:engine/view/text~
|
|
270
|
+
* Checks whether this object is of type {@link module:engine/view/text~ViewText}.
|
|
271
271
|
*
|
|
272
272
|
* ```ts
|
|
273
273
|
* text.is( '$text' ); // -> true
|
|
@@ -282,9 +282,9 @@ export default abstract class TypeCheckable {
|
|
|
282
282
|
*
|
|
283
283
|
* @label TEXT
|
|
284
284
|
*/
|
|
285
|
-
is(type: '$text' | 'view:$text'): this is
|
|
285
|
+
is(type: '$text' | 'view:$text'): this is ViewText;
|
|
286
286
|
/**
|
|
287
|
-
* hecks whether this object is of type {@link module:engine/view/documentfragment~
|
|
287
|
+
* hecks whether this object is of type {@link module:engine/view/documentfragment~ViewDocumentFragment}.
|
|
288
288
|
*
|
|
289
289
|
* ```ts
|
|
290
290
|
* docFrag.is( 'documentFragment' ); // -> true
|
|
@@ -297,9 +297,9 @@ export default abstract class TypeCheckable {
|
|
|
297
297
|
*
|
|
298
298
|
* @label DOCUMENT_FRAGMENT
|
|
299
299
|
*/
|
|
300
|
-
is(type: 'documentFragment' | 'view:documentFragment'): this is
|
|
300
|
+
is(type: 'documentFragment' | 'view:documentFragment'): this is ViewDocumentFragment;
|
|
301
301
|
/**
|
|
302
|
-
* Checks whether this object is of type {@link module:engine/view/textproxy~
|
|
302
|
+
* Checks whether this object is of type {@link module:engine/view/textproxy~ViewTextProxy}.
|
|
303
303
|
*
|
|
304
304
|
* ```ts
|
|
305
305
|
* textProxy.is( '$textProxy' ); // -> true
|
|
@@ -315,9 +315,9 @@ export default abstract class TypeCheckable {
|
|
|
315
315
|
*
|
|
316
316
|
* @label TEXT_PROXY
|
|
317
317
|
*/
|
|
318
|
-
is(type: '$textProxy' | 'view:$textProxy'): this is
|
|
318
|
+
is(type: '$textProxy' | 'view:$textProxy'): this is ViewTextProxy;
|
|
319
319
|
/**
|
|
320
|
-
* Checks whether this object is of type {@link module:engine/view/position~
|
|
320
|
+
* Checks whether this object is of type {@link module:engine/view/position~ViewPosition}.
|
|
321
321
|
*
|
|
322
322
|
* ```ts
|
|
323
323
|
* position.is( 'position' ); // -> true
|
|
@@ -330,9 +330,9 @@ export default abstract class TypeCheckable {
|
|
|
330
330
|
*
|
|
331
331
|
* @label POSITION
|
|
332
332
|
*/
|
|
333
|
-
is(type: 'position' | 'view:position'): this is
|
|
333
|
+
is(type: 'position' | 'view:position'): this is ViewPosition;
|
|
334
334
|
/**
|
|
335
|
-
* Checks whether this object is of type {@link module:engine/view/range~
|
|
335
|
+
* Checks whether this object is of type {@link module:engine/view/range~ViewRange}.
|
|
336
336
|
*
|
|
337
337
|
* ```ts
|
|
338
338
|
* range.is( 'range' ); // -> true
|
|
@@ -345,10 +345,10 @@ export default abstract class TypeCheckable {
|
|
|
345
345
|
*
|
|
346
346
|
* @label RANGE
|
|
347
347
|
*/
|
|
348
|
-
is(type: 'range' | 'view:range'): this is
|
|
348
|
+
is(type: 'range' | 'view:range'): this is ViewRange;
|
|
349
349
|
/**
|
|
350
|
-
* Checks whether this object is of type {@link module:engine/view/selection~
|
|
351
|
-
* {@link module:engine/view/documentselection~
|
|
350
|
+
* Checks whether this object is of type {@link module:engine/view/selection~ViewSelection} or
|
|
351
|
+
* {@link module:engine/view/documentselection~ViewDocumentSelection}.
|
|
352
352
|
*
|
|
353
353
|
* ```ts
|
|
354
354
|
* selection.is( 'selection' ); // -> true
|
|
@@ -361,9 +361,9 @@ export default abstract class TypeCheckable {
|
|
|
361
361
|
*
|
|
362
362
|
* @label SELECTION
|
|
363
363
|
*/
|
|
364
|
-
is(type: 'selection' | 'view:selection'): this is
|
|
364
|
+
is(type: 'selection' | 'view:selection'): this is ViewSelection | ViewDocumentSelection;
|
|
365
365
|
/**
|
|
366
|
-
* Checks whether this object is of type {@link module:engine/view/documentselection~
|
|
366
|
+
* Checks whether this object is of type {@link module:engine/view/documentselection~ViewDocumentSelection}.
|
|
367
367
|
*
|
|
368
368
|
* ```ts
|
|
369
369
|
* `docSelection.is( 'selection' ); // -> true
|
|
@@ -378,71 +378,72 @@ export default abstract class TypeCheckable {
|
|
|
378
378
|
*
|
|
379
379
|
* @label DOCUMENT_SELECTION
|
|
380
380
|
*/
|
|
381
|
-
is(type: 'documentSelection' | 'view:documentSelection'): this is
|
|
381
|
+
is(type: 'documentSelection' | 'view:documentSelection'): this is ViewDocumentSelection;
|
|
382
382
|
/**
|
|
383
|
-
* Checks whether the object is of type {@link module:engine/view/element~
|
|
383
|
+
* Checks whether the object is of type {@link module:engine/view/element~ViewElement} or its subclass and has the specified `name`.
|
|
384
384
|
*
|
|
385
385
|
* @label ELEMENT_NAME
|
|
386
386
|
*/
|
|
387
|
-
is<N extends string>(type: 'element' | 'view:element', name: N): this is (
|
|
387
|
+
is<N extends string>(type: 'element' | 'view:element', name: N): this is (ViewElement | ViewAttributeElement | ViewContainerElement | ViewEditableElement | ViewEmptyElement | ViewRawElement | ViewRootEditableElement | ViewUIElement) & {
|
|
388
388
|
name: N;
|
|
389
389
|
};
|
|
390
390
|
/**
|
|
391
|
-
* Checks whether the object is of type {@link module:engine/view/attributeelement~
|
|
391
|
+
* Checks whether the object is of type {@link module:engine/view/attributeelement~ViewAttributeElement} and has the specified `name`.
|
|
392
392
|
*
|
|
393
393
|
* @label ATTRIBUTE_ELEMENT_NAME
|
|
394
394
|
*/
|
|
395
|
-
is<N extends string>(type: 'attributeElement' | 'view:attributeElement', name: N): this is
|
|
395
|
+
is<N extends string>(type: 'attributeElement' | 'view:attributeElement', name: N): this is ViewAttributeElement & {
|
|
396
396
|
name: N;
|
|
397
397
|
};
|
|
398
398
|
/**
|
|
399
|
-
* Checks whether the object is of type {@link module:engine/view/containerelement~
|
|
399
|
+
* Checks whether the object is of type {@link module:engine/view/containerelement~ViewContainerElement}
|
|
400
400
|
* or its subclass and has the specified `name`.
|
|
401
401
|
*
|
|
402
402
|
* @label CONTAINER_ELEMENT_NAME
|
|
403
403
|
*/
|
|
404
|
-
is<N extends string>(type: 'containerElement' | 'view:containerElement', name: N): this is (
|
|
404
|
+
is<N extends string>(type: 'containerElement' | 'view:containerElement', name: N): this is (ViewContainerElement | ViewEditableElement | ViewRootEditableElement) & {
|
|
405
405
|
name: N;
|
|
406
406
|
};
|
|
407
407
|
/**
|
|
408
|
-
* Checks whether the object is of type {@link module:engine/view/editableelement~
|
|
408
|
+
* Checks whether the object is of type {@link module:engine/view/editableelement~ViewEditableElement}
|
|
409
409
|
* or its subclass and has the specified `name`.
|
|
410
410
|
*
|
|
411
411
|
* @label EDITABLE_ELEMENT_NAME
|
|
412
412
|
*/
|
|
413
|
-
is<N extends string>(type: 'editableElement' | 'view:editableElement', name: N): this is (
|
|
413
|
+
is<N extends string>(type: 'editableElement' | 'view:editableElement', name: N): this is (ViewEditableElement | ViewRootEditableElement) & {
|
|
414
414
|
name: N;
|
|
415
415
|
};
|
|
416
416
|
/**
|
|
417
|
-
* Checks whether the object is of type {@link module:engine/view/emptyelement~
|
|
417
|
+
* Checks whether the object is of type {@link module:engine/view/emptyelement~ViewEmptyElement} has the specified `name`.
|
|
418
418
|
*
|
|
419
419
|
* @label EMPTY_ELEMENT_NAME
|
|
420
420
|
*/
|
|
421
|
-
is<N extends string>(type: 'emptyElement' | 'view:emptyElement', name: N): this is
|
|
421
|
+
is<N extends string>(type: 'emptyElement' | 'view:emptyElement', name: N): this is ViewEmptyElement & {
|
|
422
422
|
name: N;
|
|
423
423
|
};
|
|
424
424
|
/**
|
|
425
|
-
* Checks whether the object is of type {@link module:engine/view/rawelement~
|
|
425
|
+
* Checks whether the object is of type {@link module:engine/view/rawelement~ViewRawElement} and has the specified `name`.
|
|
426
426
|
*
|
|
427
427
|
* @label RAW_ELEMENT_NAME
|
|
428
428
|
*/
|
|
429
|
-
is<N extends string>(type: 'rawElement' | 'view:rawElement', name: N): this is
|
|
429
|
+
is<N extends string>(type: 'rawElement' | 'view:rawElement', name: N): this is ViewRawElement & {
|
|
430
430
|
name: N;
|
|
431
431
|
};
|
|
432
432
|
/**
|
|
433
|
-
* Checks whether the object is of type {@link module:engine/view/rooteditableelement~
|
|
433
|
+
* Checks whether the object is of type {@link module:engine/view/rooteditableelement~ViewRootEditableElement}
|
|
434
|
+
* and has the specified `name`.
|
|
434
435
|
*
|
|
435
436
|
* @label ROOT_ELEMENT_NAME
|
|
436
437
|
*/
|
|
437
|
-
is<N extends string>(type: 'rootElement' | 'view:rootElement', name: N): this is
|
|
438
|
+
is<N extends string>(type: 'rootElement' | 'view:rootElement', name: N): this is ViewRootEditableElement & {
|
|
438
439
|
name: N;
|
|
439
440
|
};
|
|
440
441
|
/**
|
|
441
|
-
* Checks whether the object is of type {@link module:engine/view/uielement~
|
|
442
|
+
* Checks whether the object is of type {@link module:engine/view/uielement~ViewUIElement} and has the specified `name`.
|
|
442
443
|
*
|
|
443
444
|
* @label UI_ELEMENT_NAME
|
|
444
445
|
*/
|
|
445
|
-
is<N extends string>(type: 'uiElement' | 'view:uiElement', name: N): this is
|
|
446
|
+
is<N extends string>(type: 'uiElement' | 'view:uiElement', name: N): this is ViewUIElement & {
|
|
446
447
|
name: N;
|
|
447
448
|
};
|
|
448
449
|
}
|