@ckeditor/ckeditor5-engine 34.2.0 → 35.1.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/CHANGELOG.md +823 -0
- package/LICENSE.md +4 -0
- package/package.json +32 -25
- package/src/controller/datacontroller.js +467 -561
- package/src/controller/editingcontroller.js +168 -204
- package/src/conversion/conversion.js +541 -565
- package/src/conversion/conversionhelpers.js +24 -28
- package/src/conversion/downcastdispatcher.js +457 -686
- package/src/conversion/downcasthelpers.js +1583 -1965
- package/src/conversion/mapper.js +518 -707
- package/src/conversion/modelconsumable.js +240 -283
- package/src/conversion/upcastdispatcher.js +372 -718
- package/src/conversion/upcasthelpers.js +707 -818
- package/src/conversion/viewconsumable.js +524 -581
- package/src/dataprocessor/basichtmlwriter.js +12 -16
- package/src/dataprocessor/dataprocessor.js +5 -0
- package/src/dataprocessor/htmldataprocessor.js +101 -117
- package/src/dataprocessor/htmlwriter.js +1 -18
- package/src/dataprocessor/xmldataprocessor.js +117 -138
- package/src/dev-utils/model.js +260 -352
- package/src/dev-utils/operationreplayer.js +106 -126
- package/src/dev-utils/utils.js +34 -51
- package/src/dev-utils/view.js +632 -753
- package/src/index.js +0 -11
- package/src/model/batch.js +111 -127
- package/src/model/differ.js +988 -1233
- package/src/model/document.js +340 -449
- package/src/model/documentfragment.js +327 -364
- package/src/model/documentselection.js +996 -1189
- package/src/model/element.js +306 -410
- package/src/model/history.js +224 -262
- package/src/model/item.js +5 -0
- package/src/model/liveposition.js +84 -145
- package/src/model/liverange.js +108 -185
- package/src/model/markercollection.js +379 -480
- package/src/model/model.js +883 -1034
- package/src/model/node.js +419 -463
- package/src/model/nodelist.js +175 -201
- package/src/model/operation/attributeoperation.js +153 -182
- package/src/model/operation/detachoperation.js +64 -83
- package/src/model/operation/insertoperation.js +135 -166
- package/src/model/operation/markeroperation.js +114 -140
- package/src/model/operation/mergeoperation.js +163 -191
- package/src/model/operation/moveoperation.js +157 -187
- package/src/model/operation/nooperation.js +28 -38
- package/src/model/operation/operation.js +106 -125
- package/src/model/operation/operationfactory.js +30 -34
- package/src/model/operation/renameoperation.js +109 -135
- package/src/model/operation/rootattributeoperation.js +155 -188
- package/src/model/operation/splitoperation.js +196 -232
- package/src/model/operation/transform.js +1833 -2204
- package/src/model/operation/utils.js +140 -204
- package/src/model/position.js +899 -1053
- package/src/model/range.js +910 -1028
- package/src/model/rootelement.js +77 -97
- package/src/model/schema.js +1189 -1835
- package/src/model/selection.js +745 -862
- package/src/model/text.js +90 -114
- package/src/model/textproxy.js +204 -240
- package/src/model/treewalker.js +316 -397
- package/src/model/typecheckable.js +16 -0
- package/src/model/utils/autoparagraphing.js +32 -44
- package/src/model/utils/deletecontent.js +334 -418
- package/src/model/utils/findoptimalinsertionrange.js +25 -36
- package/src/model/utils/getselectedcontent.js +96 -118
- package/src/model/utils/insertcontent.js +654 -773
- package/src/model/utils/insertobject.js +96 -119
- package/src/model/utils/modifyselection.js +120 -158
- package/src/model/utils/selection-post-fixer.js +153 -201
- package/src/model/writer.js +1305 -1474
- package/src/view/attributeelement.js +189 -225
- package/src/view/containerelement.js +75 -85
- package/src/view/document.js +172 -215
- package/src/view/documentfragment.js +200 -249
- package/src/view/documentselection.js +338 -367
- package/src/view/domconverter.js +1371 -1613
- package/src/view/downcastwriter.js +1747 -2076
- package/src/view/editableelement.js +81 -97
- package/src/view/element.js +739 -890
- package/src/view/elementdefinition.js +5 -0
- package/src/view/emptyelement.js +82 -92
- package/src/view/filler.js +35 -50
- package/src/view/item.js +5 -0
- package/src/view/matcher.js +260 -559
- package/src/view/node.js +274 -360
- package/src/view/observer/arrowkeysobserver.js +19 -28
- package/src/view/observer/bubblingemittermixin.js +120 -263
- package/src/view/observer/bubblingeventinfo.js +47 -55
- package/src/view/observer/clickobserver.js +7 -13
- package/src/view/observer/compositionobserver.js +14 -24
- package/src/view/observer/domeventdata.js +57 -67
- package/src/view/observer/domeventobserver.js +40 -64
- package/src/view/observer/fakeselectionobserver.js +81 -96
- package/src/view/observer/focusobserver.js +45 -61
- package/src/view/observer/inputobserver.js +7 -13
- package/src/view/observer/keyobserver.js +17 -27
- package/src/view/observer/mouseobserver.js +7 -14
- package/src/view/observer/mutationobserver.js +220 -315
- package/src/view/observer/observer.js +81 -102
- package/src/view/observer/selectionobserver.js +191 -246
- package/src/view/observer/tabobserver.js +23 -36
- package/src/view/placeholder.js +128 -173
- package/src/view/position.js +350 -401
- package/src/view/range.js +453 -513
- package/src/view/rawelement.js +85 -112
- package/src/view/renderer.js +874 -1014
- package/src/view/rooteditableelement.js +80 -90
- package/src/view/selection.js +608 -689
- package/src/view/styles/background.js +43 -44
- package/src/view/styles/border.js +220 -276
- package/src/view/styles/margin.js +8 -17
- package/src/view/styles/padding.js +8 -16
- package/src/view/styles/utils.js +127 -160
- package/src/view/stylesmap.js +728 -905
- package/src/view/text.js +102 -126
- package/src/view/textproxy.js +144 -170
- package/src/view/treewalker.js +383 -479
- package/src/view/typecheckable.js +19 -0
- package/src/view/uielement.js +166 -187
- package/src/view/upcastwriter.js +395 -449
- package/src/view/view.js +569 -664
- package/src/dataprocessor/dataprocessor.jsdoc +0 -64
- package/src/model/item.jsdoc +0 -14
- package/src/view/elementdefinition.jsdoc +0 -59
- package/src/view/item.jsdoc +0 -14
package/src/model/textproxy.js
CHANGED
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module engine/model/textproxy
|
|
8
7
|
*/
|
|
9
|
-
|
|
8
|
+
import TypeCheckable from './typecheckable';
|
|
10
9
|
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
11
|
-
|
|
12
10
|
// @if CK_DEBUG_ENGINE // const { convertMapToStringifiedObject } = require( '../dev-utils/utils' );
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* `TextProxy` represents a part of {@link module:engine/model/text~Text text node}.
|
|
16
13
|
*
|
|
@@ -40,240 +37,207 @@ import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
|
40
37
|
* `TextProxy` instances are created by {@link module:engine/model/treewalker~TreeWalker model tree walker}. You should not need to create
|
|
41
38
|
* an instance of this class by your own.
|
|
42
39
|
*/
|
|
43
|
-
export default class TextProxy {
|
|
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
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Checks if this text proxy has an attribute for given key.
|
|
228
|
-
*
|
|
229
|
-
* @param {String} key Key of attribute to check.
|
|
230
|
-
* @returns {Boolean} `true` if attribute with given key is set on text proxy, `false` otherwise.
|
|
231
|
-
*/
|
|
232
|
-
hasAttribute( key ) {
|
|
233
|
-
return this.textNode.hasAttribute( key );
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Gets an attribute value for given key or `undefined` if that attribute is not set on text proxy.
|
|
238
|
-
*
|
|
239
|
-
* @param {String} key Key of attribute to look for.
|
|
240
|
-
* @returns {*} Attribute value or `undefined`.
|
|
241
|
-
*/
|
|
242
|
-
getAttribute( key ) {
|
|
243
|
-
return this.textNode.getAttribute( key );
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Returns iterator that iterates over this node's attributes. Attributes are returned as arrays containing two
|
|
248
|
-
* items. First one is attribute key and second is attribute value.
|
|
249
|
-
*
|
|
250
|
-
* This format is accepted by native `Map` object and also can be passed in `Node` constructor.
|
|
251
|
-
*
|
|
252
|
-
* @returns {Iterable.<*>}
|
|
253
|
-
*/
|
|
254
|
-
getAttributes() {
|
|
255
|
-
return this.textNode.getAttributes();
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Returns iterator that iterates over this node's attribute keys.
|
|
260
|
-
*
|
|
261
|
-
* @returns {Iterable.<String>}
|
|
262
|
-
*/
|
|
263
|
-
getAttributeKeys() {
|
|
264
|
-
return this.textNode.getAttributeKeys();
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// @if CK_DEBUG_ENGINE // toString() {
|
|
268
|
-
// @if CK_DEBUG_ENGINE // return `#${ this.data }`;
|
|
269
|
-
// @if CK_DEBUG_ENGINE // }
|
|
270
|
-
|
|
271
|
-
// @if CK_DEBUG_ENGINE // log() {
|
|
272
|
-
// @if CK_DEBUG_ENGINE // console.log( 'ModelTextProxy: ' + this );
|
|
273
|
-
// @if CK_DEBUG_ENGINE // }
|
|
274
|
-
|
|
275
|
-
// @if CK_DEBUG_ENGINE // logExtended() {
|
|
276
|
-
// @if CK_DEBUG_ENGINE // console.log( `ModelTextProxy: ${ this }, ` +
|
|
277
|
-
// @if CK_DEBUG_ENGINE // `attrs: ${ convertMapToStringifiedObject( this.getAttributes() ) }` );
|
|
278
|
-
// @if CK_DEBUG_ENGINE // }
|
|
40
|
+
export default class TextProxy extends TypeCheckable {
|
|
41
|
+
/**
|
|
42
|
+
* Creates a text proxy.
|
|
43
|
+
*
|
|
44
|
+
* @protected
|
|
45
|
+
* @param {module:engine/model/text~Text} textNode Text node which part is represented by this text proxy.
|
|
46
|
+
* @param {Number} offsetInText Offset in {@link module:engine/model/textproxy~TextProxy#textNode text node} from which the text proxy
|
|
47
|
+
* starts.
|
|
48
|
+
* @param {Number} length Text proxy length, that is how many text node's characters, starting from `offsetInText` it represents.
|
|
49
|
+
* @constructor
|
|
50
|
+
*/
|
|
51
|
+
constructor(textNode, offsetInText, length) {
|
|
52
|
+
super();
|
|
53
|
+
/**
|
|
54
|
+
* Text node which part is represented by this text proxy.
|
|
55
|
+
*
|
|
56
|
+
* @readonly
|
|
57
|
+
* @member {module:engine/model/text~Text}
|
|
58
|
+
*/
|
|
59
|
+
this.textNode = textNode;
|
|
60
|
+
if (offsetInText < 0 || offsetInText > textNode.offsetSize) {
|
|
61
|
+
/**
|
|
62
|
+
* Given `offsetInText` value is incorrect.
|
|
63
|
+
*
|
|
64
|
+
* @error model-textproxy-wrong-offsetintext
|
|
65
|
+
*/
|
|
66
|
+
throw new CKEditorError('model-textproxy-wrong-offsetintext', this);
|
|
67
|
+
}
|
|
68
|
+
if (length < 0 || offsetInText + length > textNode.offsetSize) {
|
|
69
|
+
/**
|
|
70
|
+
* Given `length` value is incorrect.
|
|
71
|
+
*
|
|
72
|
+
* @error model-textproxy-wrong-length
|
|
73
|
+
*/
|
|
74
|
+
throw new CKEditorError('model-textproxy-wrong-length', this);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Text data represented by this text proxy.
|
|
78
|
+
*
|
|
79
|
+
* @readonly
|
|
80
|
+
* @member {String}
|
|
81
|
+
*/
|
|
82
|
+
this.data = textNode.data.substring(offsetInText, offsetInText + length);
|
|
83
|
+
/**
|
|
84
|
+
* Offset in {@link module:engine/model/textproxy~TextProxy#textNode text node} from which the text proxy starts.
|
|
85
|
+
*
|
|
86
|
+
* @readonly
|
|
87
|
+
* @member {Number}
|
|
88
|
+
*/
|
|
89
|
+
this.offsetInText = offsetInText;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Offset at which this text proxy starts in it's parent.
|
|
93
|
+
*
|
|
94
|
+
* @see module:engine/model/node~Node#startOffset
|
|
95
|
+
* @readonly
|
|
96
|
+
* @type {Number|null}
|
|
97
|
+
*/
|
|
98
|
+
get startOffset() {
|
|
99
|
+
return this.textNode.startOffset !== null ? this.textNode.startOffset + this.offsetInText : null;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Offset size of this text proxy. Equal to the number of characters represented by the text proxy.
|
|
103
|
+
*
|
|
104
|
+
* @see module:engine/model/node~Node#offsetSize
|
|
105
|
+
* @readonly
|
|
106
|
+
* @type {Number}
|
|
107
|
+
*/
|
|
108
|
+
get offsetSize() {
|
|
109
|
+
return this.data.length;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Offset at which this text proxy ends in it's parent.
|
|
113
|
+
*
|
|
114
|
+
* @see module:engine/model/node~Node#endOffset
|
|
115
|
+
* @readonly
|
|
116
|
+
* @type {Number|null}
|
|
117
|
+
*/
|
|
118
|
+
get endOffset() {
|
|
119
|
+
return this.startOffset !== null ? this.startOffset + this.offsetSize : null;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Flag indicating whether `TextProxy` instance covers only part of the original {@link module:engine/model/text~Text text node}
|
|
123
|
+
* (`true`) or the whole text node (`false`).
|
|
124
|
+
*
|
|
125
|
+
* This is `false` when text proxy starts at the very beginning of {@link module:engine/model/textproxy~TextProxy#textNode textNode}
|
|
126
|
+
* ({@link module:engine/model/textproxy~TextProxy#offsetInText offsetInText} equals `0`) and text proxy sizes is equal to
|
|
127
|
+
* text node size.
|
|
128
|
+
*
|
|
129
|
+
* @readonly
|
|
130
|
+
* @type {Boolean}
|
|
131
|
+
*/
|
|
132
|
+
get isPartial() {
|
|
133
|
+
return this.offsetSize !== this.textNode.offsetSize;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Parent of this text proxy, which is same as parent of text node represented by this text proxy.
|
|
137
|
+
*
|
|
138
|
+
* @readonly
|
|
139
|
+
* @type {module:engine/model/element~Element|module:engine/model/documentfragment~DocumentFragment|null}
|
|
140
|
+
*/
|
|
141
|
+
get parent() {
|
|
142
|
+
return this.textNode.parent;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Root of this text proxy, which is same as root of text node represented by this text proxy.
|
|
146
|
+
*
|
|
147
|
+
* @readonly
|
|
148
|
+
* @type {module:engine/model/node~Node|module:engine/model/documentfragment~DocumentFragment}
|
|
149
|
+
*/
|
|
150
|
+
get root() {
|
|
151
|
+
return this.textNode.root;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Gets path to this text proxy.
|
|
155
|
+
*
|
|
156
|
+
* @see module:engine/model/node~Node#getPath
|
|
157
|
+
* @returns {Array.<Number>}
|
|
158
|
+
*/
|
|
159
|
+
getPath() {
|
|
160
|
+
const path = this.textNode.getPath();
|
|
161
|
+
if (path.length > 0) {
|
|
162
|
+
path[path.length - 1] += this.offsetInText;
|
|
163
|
+
}
|
|
164
|
+
return path;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Returns ancestors array of this text proxy.
|
|
168
|
+
*
|
|
169
|
+
* @param {Object} options Options object.
|
|
170
|
+
* @param {Boolean} [options.includeSelf=false] When set to `true` this text proxy will be also included in parent's array.
|
|
171
|
+
* @param {Boolean} [options.parentFirst=false] When set to `true`, array will be sorted from text proxy parent to root element,
|
|
172
|
+
* otherwise root element will be the first item in the array.
|
|
173
|
+
* @returns {Array} Array with ancestors.
|
|
174
|
+
*/
|
|
175
|
+
getAncestors(options = {}) {
|
|
176
|
+
const ancestors = [];
|
|
177
|
+
let parent = options.includeSelf ? this : this.parent;
|
|
178
|
+
while (parent) {
|
|
179
|
+
ancestors[options.parentFirst ? 'push' : 'unshift'](parent);
|
|
180
|
+
parent = parent.parent;
|
|
181
|
+
}
|
|
182
|
+
return ancestors;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Checks if this text proxy has an attribute for given key.
|
|
186
|
+
*
|
|
187
|
+
* @param {String} key Key of attribute to check.
|
|
188
|
+
* @returns {Boolean} `true` if attribute with given key is set on text proxy, `false` otherwise.
|
|
189
|
+
*/
|
|
190
|
+
hasAttribute(key) {
|
|
191
|
+
return this.textNode.hasAttribute(key);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Gets an attribute value for given key or `undefined` if that attribute is not set on text proxy.
|
|
195
|
+
*
|
|
196
|
+
* @param {String} key Key of attribute to look for.
|
|
197
|
+
* @returns {*} Attribute value or `undefined`.
|
|
198
|
+
*/
|
|
199
|
+
getAttribute(key) {
|
|
200
|
+
return this.textNode.getAttribute(key);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Returns iterator that iterates over this node's attributes. Attributes are returned as arrays containing two
|
|
204
|
+
* items. First one is attribute key and second is attribute value.
|
|
205
|
+
*
|
|
206
|
+
* This format is accepted by native `Map` object and also can be passed in `Node` constructor.
|
|
207
|
+
*
|
|
208
|
+
* @returns {Iterable.<*>}
|
|
209
|
+
*/
|
|
210
|
+
getAttributes() {
|
|
211
|
+
return this.textNode.getAttributes();
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Returns iterator that iterates over this node's attribute keys.
|
|
215
|
+
*
|
|
216
|
+
* @returns {Iterable.<String>}
|
|
217
|
+
*/
|
|
218
|
+
getAttributeKeys() {
|
|
219
|
+
return this.textNode.getAttributeKeys();
|
|
220
|
+
}
|
|
279
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Checks whether this object is of the given.
|
|
224
|
+
*
|
|
225
|
+
* textProxy.is( '$textProxy' ); // -> true
|
|
226
|
+
* textProxy.is( 'model:$textProxy' ); // -> true
|
|
227
|
+
*
|
|
228
|
+
* textProxy.is( 'view:$textProxy' ); // -> false
|
|
229
|
+
* textProxy.is( 'range' ); // -> false
|
|
230
|
+
*
|
|
231
|
+
* {@link module:engine/model/node~Node#is Check the entire list of model objects} which implement the `is()` method.
|
|
232
|
+
*
|
|
233
|
+
* **Note:** Until version 20.0.0 this method wasn't accepting `'$textProxy'` type. The legacy `'textProxt'` type is still
|
|
234
|
+
* accepted for backward compatibility.
|
|
235
|
+
*
|
|
236
|
+
* @param {String} type Type to check.
|
|
237
|
+
* @returns {Boolean}
|
|
238
|
+
*/
|
|
239
|
+
TextProxy.prototype.is = function (type) {
|
|
240
|
+
return type === '$textProxy' || type === 'model:$textProxy' ||
|
|
241
|
+
// This are legacy values kept for backward compatibility.
|
|
242
|
+
type === 'textProxy' || type === 'model:textProxy';
|
|
243
|
+
};
|