@ckeditor/ckeditor5-engine 36.0.1 → 37.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/README.md +1 -1
- package/package.json +24 -23
- package/src/controller/datacontroller.d.ts +331 -0
- package/src/controller/datacontroller.js +62 -109
- package/src/controller/editingcontroller.d.ts +98 -0
- package/src/controller/editingcontroller.js +22 -46
- package/src/conversion/conversion.d.ts +476 -0
- package/src/conversion/conversion.js +328 -347
- package/src/conversion/conversionhelpers.d.ts +26 -0
- package/src/conversion/conversionhelpers.js +1 -5
- package/src/conversion/downcastdispatcher.d.ts +547 -0
- package/src/conversion/downcastdispatcher.js +74 -152
- package/src/conversion/downcasthelpers.d.ts +1226 -0
- package/src/conversion/downcasthelpers.js +843 -762
- package/src/conversion/mapper.d.ts +499 -0
- package/src/conversion/mapper.js +84 -99
- package/src/conversion/modelconsumable.d.ts +201 -0
- package/src/conversion/modelconsumable.js +96 -99
- package/src/conversion/upcastdispatcher.d.ts +492 -0
- package/src/conversion/upcastdispatcher.js +73 -100
- package/src/conversion/upcasthelpers.d.ts +499 -0
- package/src/conversion/upcasthelpers.js +406 -373
- package/src/conversion/viewconsumable.d.ts +177 -0
- package/src/conversion/viewconsumable.js +157 -162
- package/src/dataprocessor/basichtmlwriter.d.ts +18 -0
- package/src/dataprocessor/basichtmlwriter.js +0 -9
- package/src/dataprocessor/dataprocessor.d.ts +61 -0
- package/src/dataprocessor/htmldataprocessor.d.ts +76 -0
- package/src/dataprocessor/htmldataprocessor.js +6 -28
- package/src/dataprocessor/htmlwriter.d.ts +16 -0
- package/src/dataprocessor/xmldataprocessor.d.ts +90 -0
- package/src/dataprocessor/xmldataprocessor.js +8 -40
- package/src/dev-utils/model.d.ts +124 -0
- package/src/dev-utils/model.js +41 -38
- package/src/dev-utils/operationreplayer.d.ts +51 -0
- package/src/dev-utils/operationreplayer.js +6 -14
- package/src/dev-utils/utils.d.ts +37 -0
- package/src/dev-utils/utils.js +5 -18
- package/src/dev-utils/view.d.ts +319 -0
- package/src/dev-utils/view.js +205 -226
- package/src/index.d.ts +105 -0
- package/src/index.js +1 -0
- package/src/model/batch.d.ts +106 -0
- package/src/model/differ.d.ts +329 -0
- package/src/model/document.d.ts +245 -0
- package/src/model/document.js +1 -1
- package/src/model/documentfragment.d.ts +196 -0
- package/src/model/documentfragment.js +2 -2
- package/src/model/documentselection.d.ts +420 -0
- package/src/model/element.d.ts +165 -0
- package/src/model/history.d.ts +114 -0
- package/src/model/item.d.ts +14 -0
- package/src/model/liveposition.d.ts +77 -0
- package/src/model/liverange.d.ts +102 -0
- package/src/model/markercollection.d.ts +335 -0
- package/src/model/model.d.ts +812 -0
- package/src/model/model.js +59 -30
- package/src/model/node.d.ts +256 -0
- package/src/model/nodelist.d.ts +91 -0
- package/src/model/operation/attributeoperation.d.ts +98 -0
- package/src/model/operation/detachoperation.d.ts +55 -0
- package/src/model/operation/insertoperation.d.ts +85 -0
- package/src/model/operation/markeroperation.d.ts +86 -0
- package/src/model/operation/mergeoperation.d.ts +95 -0
- package/src/model/operation/moveoperation.d.ts +91 -0
- package/src/model/operation/nooperation.d.ts +33 -0
- package/src/model/operation/operation.d.ts +89 -0
- package/src/model/operation/operationfactory.d.ts +18 -0
- package/src/model/operation/renameoperation.d.ts +78 -0
- package/src/model/operation/rootattributeoperation.d.ts +97 -0
- package/src/model/operation/rootattributeoperation.js +1 -1
- package/src/model/operation/splitoperation.d.ts +104 -0
- package/src/model/operation/transform.d.ts +100 -0
- package/src/model/operation/utils.d.ts +71 -0
- package/src/model/position.d.ts +539 -0
- package/src/model/position.js +1 -1
- package/src/model/range.d.ts +458 -0
- package/src/model/range.js +1 -1
- package/src/model/rootelement.d.ts +40 -0
- package/src/model/schema.d.ts +1176 -0
- package/src/model/schema.js +15 -15
- package/src/model/selection.d.ts +472 -0
- package/src/model/text.d.ts +66 -0
- package/src/model/text.js +0 -2
- package/src/model/textproxy.d.ts +144 -0
- package/src/model/treewalker.d.ts +186 -0
- package/src/model/treewalker.js +19 -10
- package/src/model/typecheckable.d.ts +255 -0
- package/src/model/utils/autoparagraphing.d.ts +37 -0
- package/src/model/utils/deletecontent.d.ts +58 -0
- package/src/model/utils/findoptimalinsertionrange.d.ts +32 -0
- package/src/model/utils/getselectedcontent.d.ts +30 -0
- package/src/model/utils/insertcontent.d.ts +46 -0
- package/src/model/utils/insertcontent.js +2 -12
- package/src/model/utils/insertobject.d.ts +44 -0
- package/src/model/utils/insertobject.js +3 -14
- package/src/model/utils/modifyselection.d.ts +48 -0
- package/src/model/utils/selection-post-fixer.d.ts +65 -0
- package/src/model/writer.d.ts +726 -0
- package/src/model/writer.js +6 -4
- package/src/view/attributeelement.d.ts +108 -0
- package/src/view/attributeelement.js +25 -69
- package/src/view/containerelement.d.ts +49 -0
- package/src/view/containerelement.js +10 -43
- package/src/view/datatransfer.d.ts +75 -0
- package/src/view/document.d.ts +184 -0
- package/src/view/document.js +15 -84
- package/src/view/documentfragment.d.ts +150 -0
- package/src/view/documentfragment.js +40 -81
- package/src/view/documentselection.d.ts +219 -0
- package/src/view/documentselection.js +75 -121
- package/src/view/domconverter.d.ts +620 -0
- package/src/view/domconverter.js +159 -276
- package/src/view/downcastwriter.d.ts +804 -0
- package/src/view/downcastwriter.js +336 -380
- package/src/view/editableelement.d.ts +52 -0
- package/src/view/editableelement.js +9 -49
- package/src/view/element.d.ts +466 -0
- package/src/view/element.js +150 -222
- package/src/view/elementdefinition.d.ts +87 -0
- package/src/view/emptyelement.d.ts +41 -0
- package/src/view/emptyelement.js +11 -44
- package/src/view/filler.d.ts +111 -0
- package/src/view/filler.js +24 -21
- package/src/view/item.d.ts +14 -0
- package/src/view/matcher.d.ts +486 -0
- package/src/view/matcher.js +247 -218
- package/src/view/node.d.ts +160 -0
- package/src/view/node.js +26 -100
- package/src/view/observer/arrowkeysobserver.d.ts +41 -0
- package/src/view/observer/arrowkeysobserver.js +0 -13
- package/src/view/observer/bubblingemittermixin.d.ts +166 -0
- package/src/view/observer/bubblingemittermixin.js +36 -25
- package/src/view/observer/bubblingeventinfo.d.ts +47 -0
- package/src/view/observer/bubblingeventinfo.js +3 -29
- package/src/view/observer/clickobserver.d.ts +43 -0
- package/src/view/observer/clickobserver.js +9 -19
- package/src/view/observer/compositionobserver.d.ts +82 -0
- package/src/view/observer/compositionobserver.js +13 -42
- package/src/view/observer/domeventdata.d.ts +50 -0
- package/src/view/observer/domeventdata.js +5 -30
- package/src/view/observer/domeventobserver.d.ts +69 -0
- package/src/view/observer/domeventobserver.js +19 -21
- package/src/view/observer/fakeselectionobserver.d.ts +46 -0
- package/src/view/observer/fakeselectionobserver.js +2 -15
- package/src/view/observer/focusobserver.d.ts +82 -0
- package/src/view/observer/focusobserver.js +14 -40
- package/src/view/observer/inputobserver.d.ts +86 -0
- package/src/view/observer/inputobserver.js +18 -64
- package/src/view/observer/keyobserver.d.ts +67 -0
- package/src/view/observer/keyobserver.js +8 -42
- package/src/view/observer/mouseobserver.d.ts +89 -0
- package/src/view/observer/mouseobserver.js +8 -28
- package/src/view/observer/mutationobserver.d.ts +82 -0
- package/src/view/observer/mutationobserver.js +7 -37
- package/src/view/observer/observer.d.ts +84 -0
- package/src/view/observer/observer.js +12 -25
- package/src/view/observer/selectionobserver.d.ts +143 -0
- package/src/view/observer/selectionobserver.js +9 -99
- package/src/view/observer/tabobserver.d.ts +42 -0
- package/src/view/observer/tabobserver.js +0 -14
- package/src/view/placeholder.d.ts +85 -0
- package/src/view/placeholder.js +26 -43
- package/src/view/position.d.ts +189 -0
- package/src/view/position.js +36 -83
- package/src/view/range.d.ts +279 -0
- package/src/view/range.js +79 -122
- package/src/view/rawelement.d.ts +73 -0
- package/src/view/rawelement.js +34 -48
- package/src/view/renderer.d.ts +265 -0
- package/src/view/renderer.js +105 -193
- package/src/view/rooteditableelement.d.ts +41 -0
- package/src/view/rooteditableelement.js +12 -40
- package/src/view/selection.d.ts +375 -0
- package/src/view/selection.js +79 -153
- package/src/view/styles/background.d.ts +33 -0
- package/src/view/styles/background.js +14 -12
- package/src/view/styles/border.d.ts +43 -0
- package/src/view/styles/border.js +58 -48
- package/src/view/styles/margin.d.ts +29 -0
- package/src/view/styles/margin.js +13 -11
- package/src/view/styles/padding.d.ts +29 -0
- package/src/view/styles/padding.js +13 -11
- package/src/view/styles/utils.d.ts +93 -0
- package/src/view/styles/utils.js +22 -48
- package/src/view/stylesmap.d.ts +675 -0
- package/src/view/stylesmap.js +249 -244
- package/src/view/text.d.ts +74 -0
- package/src/view/text.js +16 -46
- package/src/view/textproxy.d.ts +97 -0
- package/src/view/textproxy.js +10 -59
- package/src/view/treewalker.d.ts +195 -0
- package/src/view/treewalker.js +43 -106
- package/src/view/typecheckable.d.ts +401 -0
- package/src/view/uielement.d.ts +96 -0
- package/src/view/uielement.js +28 -62
- package/src/view/upcastwriter.d.ts +328 -0
- package/src/view/upcastwriter.js +124 -134
- package/src/view/view.d.ts +327 -0
- package/src/view/view.js +79 -150
package/src/model/model.js
CHANGED
|
@@ -12,8 +12,10 @@ import ModelPosition from './position';
|
|
|
12
12
|
import ModelRange from './range';
|
|
13
13
|
import ModelSelection from './selection';
|
|
14
14
|
import OperationFactory from './operation/operationfactory';
|
|
15
|
+
import DocumentSelection from './documentselection';
|
|
15
16
|
import Schema from './schema';
|
|
16
17
|
import Writer from './writer';
|
|
18
|
+
import Node from './node';
|
|
17
19
|
import { autoParagraphEmptyRoots } from './utils/autoparagraphing';
|
|
18
20
|
import { injectSelectionPostFixer } from './utils/selection-post-fixer';
|
|
19
21
|
import deleteContent from './utils/deletecontent';
|
|
@@ -22,13 +24,15 @@ import insertContent from './utils/insertcontent';
|
|
|
22
24
|
import insertObject from './utils/insertobject';
|
|
23
25
|
import modifySelection from './utils/modifyselection';
|
|
24
26
|
import { CKEditorError, ObservableMixin } from '@ckeditor/ckeditor5-utils';
|
|
25
|
-
// @if CK_DEBUG_ENGINE // const { dumpTrees } = require( '../dev-utils/utils' );
|
|
27
|
+
// @if CK_DEBUG_ENGINE // const { dumpTrees, initDocumentDumping } = require( '../dev-utils/utils' );
|
|
26
28
|
// @if CK_DEBUG_ENGINE // const { OperationReplayer } = require( '../dev-utils/operationreplayer' ).default;
|
|
27
29
|
/**
|
|
28
30
|
* Editor's data model. Read about the model in the
|
|
29
|
-
* {@glink framework/
|
|
31
|
+
* {@glink framework/architecture/editing-engine engine architecture} guide.
|
|
30
32
|
*/
|
|
31
33
|
export default class Model extends ObservableMixin() {
|
|
34
|
+
// @if CK_DEBUG_ENGINE // private _operationLogs: Array<string>;
|
|
35
|
+
// @if CK_DEBUG_ENGINE // private _appliedOperations: Array<Operation>;
|
|
32
36
|
constructor() {
|
|
33
37
|
super();
|
|
34
38
|
this.markers = new MarkerCollection();
|
|
@@ -36,7 +40,7 @@ export default class Model extends ObservableMixin() {
|
|
|
36
40
|
this.schema = new Schema();
|
|
37
41
|
this._pendingChanges = [];
|
|
38
42
|
this._currentWriter = null;
|
|
39
|
-
['
|
|
43
|
+
['deleteContent', 'modifySelection', 'getSelectedContent', 'applyOperation']
|
|
40
44
|
.forEach(methodName => this.decorate(methodName));
|
|
41
45
|
// Adding operation validation with `highest` priority, so it is called before any other feature would like
|
|
42
46
|
// to do anything with the operation. If the operation has incorrect parameters it should throw on the earliest occasion.
|
|
@@ -94,9 +98,20 @@ export default class Model extends ObservableMixin() {
|
|
|
94
98
|
injectSelectionPostFixer(this);
|
|
95
99
|
// Post-fixer which takes care of adding empty paragraph elements to the empty roots.
|
|
96
100
|
this.document.registerPostFixer(autoParagraphEmptyRoots);
|
|
101
|
+
// The base implementation for "decorated" method with remapped arguments.
|
|
102
|
+
this.on('insertContent', (evt, [content, selectable]) => {
|
|
103
|
+
evt.return = insertContent(this, content, selectable);
|
|
104
|
+
});
|
|
105
|
+
// The base implementation for "decorated" method with remapped arguments.
|
|
106
|
+
this.on('insertObject', (evt, [element, selection, options]) => {
|
|
107
|
+
evt.return = insertObject(this, element, selection, options);
|
|
108
|
+
});
|
|
109
|
+
// @if CK_DEBUG_ENGINE // initDocumentDumping( this.document );
|
|
97
110
|
// @if CK_DEBUG_ENGINE // this.on( 'applyOperation', () => {
|
|
98
111
|
// @if CK_DEBUG_ENGINE // dumpTrees( this.document, this.document.version );
|
|
99
112
|
// @if CK_DEBUG_ENGINE // }, { priority: 'lowest' } );
|
|
113
|
+
// @if CK_DEBUG_ENGINE // this._operationLogs = [];
|
|
114
|
+
// @if CK_DEBUG_ENGINE // this._appliedOperations = [];
|
|
100
115
|
}
|
|
101
116
|
/**
|
|
102
117
|
* The `change()` method is the primary way of changing the model. You should use it to modify all document nodes
|
|
@@ -186,37 +201,31 @@ export default class Model extends ObservableMixin() {
|
|
|
186
201
|
*
|
|
187
202
|
* This is a low-level way of changing the model. It is exposed for very specific use cases (like the undo feature).
|
|
188
203
|
* Normally, to modify the model, you will want to use {@link module:engine/model/writer~Writer `Writer`}.
|
|
189
|
-
* See also {@glink framework/
|
|
190
|
-
* of the {@glink framework/
|
|
204
|
+
* See also {@glink framework/architecture/editing-engine#changing-the-model Changing the model} section
|
|
205
|
+
* of the {@glink framework/architecture/editing-engine Editing architecture} guide.
|
|
191
206
|
*
|
|
192
207
|
* @param operation The operation to apply.
|
|
193
208
|
*/
|
|
194
209
|
applyOperation(operation) {
|
|
195
210
|
// @if CK_DEBUG_ENGINE // console.log( 'Applying ' + operation );
|
|
196
|
-
// @if CK_DEBUG_ENGINE // if ( !this._operationLogs ) {
|
|
197
|
-
// @if CK_DEBUG_ENGINE // this._operationLogs = [];
|
|
198
|
-
// @if CK_DEBUG_ENGINE // }
|
|
199
211
|
// @if CK_DEBUG_ENGINE // this._operationLogs.push( JSON.stringify( operation ) );
|
|
200
|
-
// @if CK_DEBUG_ENGINE //
|
|
201
|
-
// @if CK_DEBUG_ENGINE // this._appliedOperations = [];
|
|
202
|
-
// @if CK_DEBUG_ENGINE //}
|
|
203
|
-
// @if CK_DEBUG_ENGINE //this._appliedOperations.push( operation );
|
|
212
|
+
// @if CK_DEBUG_ENGINE // this._appliedOperations.push( operation );
|
|
204
213
|
operation._execute();
|
|
205
214
|
}
|
|
206
|
-
// @if CK_DEBUG_ENGINE // getAppliedOperation() {
|
|
207
|
-
// @if CK_DEBUG_ENGINE //
|
|
208
|
-
// @if CK_DEBUG_ENGINE //
|
|
209
|
-
// @if CK_DEBUG_ENGINE //
|
|
210
|
-
// @if CK_DEBUG_ENGINE //
|
|
215
|
+
// @if CK_DEBUG_ENGINE // public getAppliedOperation(): string {
|
|
216
|
+
// @if CK_DEBUG_ENGINE // if ( !this._appliedOperations ) {
|
|
217
|
+
// @if CK_DEBUG_ENGINE // return '';
|
|
218
|
+
// @if CK_DEBUG_ENGINE // }
|
|
219
|
+
// @if CK_DEBUG_ENGINE // return this._appliedOperations.map( operation => JSON.stringify( operation ) ).join( '-------' );
|
|
211
220
|
// @if CK_DEBUG_ENGINE // }
|
|
212
|
-
// @if CK_DEBUG_ENGINE // createReplayer( stringifiedOperations ) {
|
|
213
|
-
// @if CK_DEBUG_ENGINE //
|
|
221
|
+
// @if CK_DEBUG_ENGINE // public createReplayer( stringifiedOperations: string ): typeof OperationReplayer {
|
|
222
|
+
// @if CK_DEBUG_ENGINE // return new OperationReplayer( this, '-------', stringifiedOperations );
|
|
214
223
|
// @if CK_DEBUG_ENGINE // }
|
|
215
224
|
/**
|
|
216
225
|
* Inserts content at the position in the editor specified by the selection, as one would expect the paste
|
|
217
226
|
* functionality to work.
|
|
218
227
|
*
|
|
219
|
-
* **Note**: If you want to insert an {@glink framework/
|
|
228
|
+
* **Note**: If you want to insert an {@glink framework/deep-dive/schema#object-elements object element}
|
|
220
229
|
* (e.g. a {@link module:widget/utils~toWidget widget}), see {@link #insertObject} instead.
|
|
221
230
|
*
|
|
222
231
|
* This is a high-level method. It takes the {@link #schema schema} into consideration when inserting
|
|
@@ -235,8 +244,8 @@ export default class Model extends ObservableMixin() {
|
|
|
235
244
|
* Inserting elements and text nodes into the model is not enough to make CKEditor 5 render that content
|
|
236
245
|
* to the user. CKEditor 5 implements a model-view-controller architecture and what `model.insertContent()` does
|
|
237
246
|
* is only adding nodes to the model. Additionally, you need to define
|
|
238
|
-
* {@glink framework/
|
|
239
|
-
* and define those nodes in the {@glink framework/
|
|
247
|
+
* {@glink framework/architecture/editing-engine#conversion converters} between the model and view
|
|
248
|
+
* and define those nodes in the {@glink framework/architecture/editing-engine#schema schema}.
|
|
240
249
|
*
|
|
241
250
|
* So, while this method may seem similar to CKEditor 4 `editor.insertHtml()` (in fact, both methods
|
|
242
251
|
* are used for paste-like content insertion), the CKEditor 5 method cannot be use to insert arbitrary HTML
|
|
@@ -354,11 +363,13 @@ export default class Model extends ObservableMixin() {
|
|
|
354
363
|
* This param defines a position in relation to that item.
|
|
355
364
|
* at the insertion position.
|
|
356
365
|
*/
|
|
357
|
-
insertContent(content, selectable, placeOrOffset) {
|
|
358
|
-
|
|
366
|
+
insertContent(content, selectable, placeOrOffset, ...rest) {
|
|
367
|
+
const selection = normalizeSelectable(selectable, placeOrOffset);
|
|
368
|
+
// Passing all call arguments so it acts like decorated method.
|
|
369
|
+
return this.fire('insertContent', [content, selection, placeOrOffset, ...rest]);
|
|
359
370
|
}
|
|
360
371
|
/**
|
|
361
|
-
* Inserts an {@glink framework/
|
|
372
|
+
* Inserts an {@glink framework/deep-dive/schema#object-elements object element} at a specific position in the editor content.
|
|
362
373
|
*
|
|
363
374
|
* This is a high-level API:
|
|
364
375
|
* * It takes the {@link #schema schema} into consideration,
|
|
@@ -377,8 +388,8 @@ export default class Model extends ObservableMixin() {
|
|
|
377
388
|
* * Inserting object into the model is not enough to make CKEditor 5 render that content to the user.
|
|
378
389
|
* CKEditor 5 implements a model-view-controller architecture and what `model.insertObject()` does
|
|
379
390
|
* is only adding nodes to the model. Additionally, you need to define
|
|
380
|
-
* {@glink framework/
|
|
381
|
-
* and define those nodes in the {@glink framework/
|
|
391
|
+
* {@glink framework/architecture/editing-engine#conversion converters} between the model and view
|
|
392
|
+
* and define those nodes in the {@glink framework/architecture/editing-engine#schema schema}.
|
|
382
393
|
*
|
|
383
394
|
* # Examples
|
|
384
395
|
*
|
|
@@ -421,7 +432,7 @@ export default class Model extends ObservableMixin() {
|
|
|
421
432
|
* model.insertObject( tableElement, range );
|
|
422
433
|
* ```
|
|
423
434
|
*
|
|
424
|
-
* @param
|
|
435
|
+
* @param element An object to be inserted into the model document.
|
|
425
436
|
* @param selectable A selectable where the content should be inserted. If not specified, the current
|
|
426
437
|
* {@link module:engine/model/document~Document#selection document selection} will be used instead.
|
|
427
438
|
* @param placeOrOffset Specifies the exact place or offset for the insertion to take place, relative to `selectable`.
|
|
@@ -440,8 +451,11 @@ export default class Model extends ObservableMixin() {
|
|
|
440
451
|
* such text node, a paragraph will be created and the document selection will be moved inside it.
|
|
441
452
|
* at the insertion position.
|
|
442
453
|
*/
|
|
443
|
-
insertObject(
|
|
444
|
-
|
|
454
|
+
insertObject(element, selectable, placeOrOffset, options, ...rest) {
|
|
455
|
+
const selection = normalizeSelectable(selectable, placeOrOffset);
|
|
456
|
+
// Note that options are fired as 2 arguments for backward compatibility with the decorated method.
|
|
457
|
+
// Passing all call arguments so it acts like decorated method.
|
|
458
|
+
return this.fire('insertObject', [element, selection, options, options, ...rest]);
|
|
445
459
|
}
|
|
446
460
|
/**
|
|
447
461
|
* Deletes content of the selection and merge siblings. The resulting selection is always collapsed.
|
|
@@ -829,3 +843,18 @@ export default class Model extends ObservableMixin() {
|
|
|
829
843
|
return ret;
|
|
830
844
|
}
|
|
831
845
|
}
|
|
846
|
+
/**
|
|
847
|
+
* Normalizes a selectable to a Selection or DocumentSelection.
|
|
848
|
+
*/
|
|
849
|
+
function normalizeSelectable(selectable, placeOrOffset) {
|
|
850
|
+
if (!selectable) {
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
853
|
+
if (selectable instanceof ModelSelection || selectable instanceof DocumentSelection) {
|
|
854
|
+
return selectable;
|
|
855
|
+
}
|
|
856
|
+
if (selectable instanceof Node) {
|
|
857
|
+
return new ModelSelection(selectable, placeOrOffset);
|
|
858
|
+
}
|
|
859
|
+
return new ModelSelection(selectable);
|
|
860
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module engine/model/node
|
|
7
|
+
*/
|
|
8
|
+
import TypeCheckable from './typecheckable';
|
|
9
|
+
import type Document from './document';
|
|
10
|
+
import type DocumentFragment from './documentfragment';
|
|
11
|
+
import type Element from './element';
|
|
12
|
+
import '@ckeditor/ckeditor5-utils/src/version';
|
|
13
|
+
/**
|
|
14
|
+
* Model node. Most basic structure of model tree.
|
|
15
|
+
*
|
|
16
|
+
* This is an abstract class that is a base for other classes representing different nodes in model.
|
|
17
|
+
*
|
|
18
|
+
* **Note:** If a node is detached from the model tree, you can manipulate it using it's API.
|
|
19
|
+
* However, it is **very important** that nodes already attached to model tree should be only changed through
|
|
20
|
+
* {@link module:engine/model/writer~Writer Writer API}.
|
|
21
|
+
*
|
|
22
|
+
* Changes done by `Node` methods, like {@link module:engine/model/element~Element#_insertChild _insertChild} or
|
|
23
|
+
* {@link module:engine/model/node~Node#_setAttribute _setAttribute}
|
|
24
|
+
* do not generate {@link module:engine/model/operation/operation~Operation operations}
|
|
25
|
+
* which are essential for correct editor work if you modify nodes in {@link module:engine/model/document~Document document} root.
|
|
26
|
+
*
|
|
27
|
+
* The flow of working on `Node` (and classes that inherits from it) is as such:
|
|
28
|
+
* 1. You can create a `Node` instance, modify it using it's API.
|
|
29
|
+
* 2. Add `Node` to the model using `Batch` API.
|
|
30
|
+
* 3. Change `Node` that was already added to the model using `Batch` API.
|
|
31
|
+
*
|
|
32
|
+
* Similarly, you cannot use `Batch` API on a node that has not been added to the model tree, with the exception
|
|
33
|
+
* of {@link module:engine/model/writer~Writer#insert inserting} that node to the model tree.
|
|
34
|
+
*
|
|
35
|
+
* Be aware that using {@link module:engine/model/writer~Writer#remove remove from Batch API} does not allow to use `Node` API because
|
|
36
|
+
* the information about `Node` is still kept in model document.
|
|
37
|
+
*
|
|
38
|
+
* In case of {@link module:engine/model/element~Element element node}, adding and removing children also counts as changing a node and
|
|
39
|
+
* follows same rules.
|
|
40
|
+
*/
|
|
41
|
+
export default abstract class Node extends TypeCheckable {
|
|
42
|
+
/**
|
|
43
|
+
* Parent of this node. It could be {@link module:engine/model/element~Element}
|
|
44
|
+
* or {@link module:engine/model/documentfragment~DocumentFragment}.
|
|
45
|
+
* Equals to `null` if the node has no parent.
|
|
46
|
+
*/
|
|
47
|
+
readonly parent: Element | DocumentFragment | null;
|
|
48
|
+
/**
|
|
49
|
+
* Unique root name used to identify this root element by {@link module:engine/model/document~Document}.
|
|
50
|
+
*/
|
|
51
|
+
readonly rootName: string | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Attributes set on this node.
|
|
54
|
+
*/
|
|
55
|
+
private _attrs;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a model node.
|
|
58
|
+
*
|
|
59
|
+
* This is an abstract class, so this constructor should not be used directly.
|
|
60
|
+
*
|
|
61
|
+
* @param attrs Node's attributes. See {@link module:utils/tomap~toMap} for a list of accepted values.
|
|
62
|
+
*/
|
|
63
|
+
constructor(attrs?: NodeAttributes);
|
|
64
|
+
/**
|
|
65
|
+
* {@link module:engine/model/document~Document Document} that owns this root element.
|
|
66
|
+
*/
|
|
67
|
+
get document(): Document | null;
|
|
68
|
+
/**
|
|
69
|
+
* Index of this node in it's parent or `null` if the node has no parent.
|
|
70
|
+
*
|
|
71
|
+
* Accessing this property throws an error if this node's parent element does not contain it.
|
|
72
|
+
* This means that model tree got broken.
|
|
73
|
+
*/
|
|
74
|
+
get index(): number | null;
|
|
75
|
+
/**
|
|
76
|
+
* Offset at which this node starts in it's parent. It is equal to the sum of {@link #offsetSize offsetSize}
|
|
77
|
+
* of all it's previous siblings. Equals to `null` if node has no parent.
|
|
78
|
+
*
|
|
79
|
+
* Accessing this property throws an error if this node's parent element does not contain it.
|
|
80
|
+
* This means that model tree got broken.
|
|
81
|
+
*/
|
|
82
|
+
get startOffset(): number | null;
|
|
83
|
+
/**
|
|
84
|
+
* Offset size of this node. Represents how much "offset space" is occupied by the node in it's parent.
|
|
85
|
+
* It is important for {@link module:engine/model/position~Position position}. When node has `offsetSize` greater than `1`, position
|
|
86
|
+
* can be placed between that node start and end. `offsetSize` greater than `1` is for nodes that represents more
|
|
87
|
+
* than one entity, i.e. {@link module:engine/model/text~Text text node}.
|
|
88
|
+
*/
|
|
89
|
+
get offsetSize(): number;
|
|
90
|
+
/**
|
|
91
|
+
* Offset at which this node ends in it's parent. It is equal to the sum of this node's
|
|
92
|
+
* {@link module:engine/model/node~Node#startOffset start offset} and {@link #offsetSize offset size}.
|
|
93
|
+
* Equals to `null` if the node has no parent.
|
|
94
|
+
*/
|
|
95
|
+
get endOffset(): number | null;
|
|
96
|
+
/**
|
|
97
|
+
* Node's next sibling or `null` if the node is a last child of it's parent or if the node has no parent.
|
|
98
|
+
*/
|
|
99
|
+
get nextSibling(): Node | null;
|
|
100
|
+
/**
|
|
101
|
+
* Node's previous sibling or `null` if the node is a first child of it's parent or if the node has no parent.
|
|
102
|
+
*/
|
|
103
|
+
get previousSibling(): Node | null;
|
|
104
|
+
/**
|
|
105
|
+
* The top-most ancestor of the node. If node has no parent it is the root itself. If the node is a part
|
|
106
|
+
* of {@link module:engine/model/documentfragment~DocumentFragment}, it's `root` is equal to that `DocumentFragment`.
|
|
107
|
+
*/
|
|
108
|
+
get root(): Node | DocumentFragment;
|
|
109
|
+
/**
|
|
110
|
+
* Returns true if the node is in a tree rooted in the document (is a descendant of one of its roots).
|
|
111
|
+
*/
|
|
112
|
+
isAttached(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Gets path to the node. The path is an array containing starting offsets of consecutive ancestors of this node,
|
|
115
|
+
* beginning from {@link module:engine/model/node~Node#root root}, down to this node's starting offset. The path can be used to
|
|
116
|
+
* create {@link module:engine/model/position~Position Position} instance.
|
|
117
|
+
*
|
|
118
|
+
* ```ts
|
|
119
|
+
* const abc = new Text( 'abc' );
|
|
120
|
+
* const foo = new Text( 'foo' );
|
|
121
|
+
* const h1 = new Element( 'h1', null, new Text( 'header' ) );
|
|
122
|
+
* const p = new Element( 'p', null, [ abc, foo ] );
|
|
123
|
+
* const div = new Element( 'div', null, [ h1, p ] );
|
|
124
|
+
* foo.getPath(); // Returns [ 1, 3 ]. `foo` is in `p` which is in `div`. `p` starts at offset 1, while `foo` at 3.
|
|
125
|
+
* h1.getPath(); // Returns [ 0 ].
|
|
126
|
+
* div.getPath(); // Returns [].
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
getPath(): Array<number>;
|
|
130
|
+
/**
|
|
131
|
+
* Returns ancestors array of this node.
|
|
132
|
+
*
|
|
133
|
+
* @param options Options object.
|
|
134
|
+
* @param options.includeSelf When set to `true` this node will be also included in parent's array.
|
|
135
|
+
* @param options.parentFirst When set to `true`, array will be sorted from node's parent to root element,
|
|
136
|
+
* otherwise root element will be the first item in the array.
|
|
137
|
+
* @returns Array with ancestors.
|
|
138
|
+
*/
|
|
139
|
+
getAncestors(options?: {
|
|
140
|
+
includeSelf?: boolean;
|
|
141
|
+
parentFirst?: boolean;
|
|
142
|
+
}): Array<Node | DocumentFragment>;
|
|
143
|
+
/**
|
|
144
|
+
* Returns a {@link module:engine/model/element~Element} or {@link module:engine/model/documentfragment~DocumentFragment}
|
|
145
|
+
* which is a common ancestor of both nodes.
|
|
146
|
+
*
|
|
147
|
+
* @param node The second node.
|
|
148
|
+
* @param options Options object.
|
|
149
|
+
* @param options.includeSelf When set to `true` both nodes will be considered "ancestors" too.
|
|
150
|
+
* Which means that if e.g. node A is inside B, then their common ancestor will be B.
|
|
151
|
+
*/
|
|
152
|
+
getCommonAncestor(node: Node, options?: {
|
|
153
|
+
includeSelf?: boolean;
|
|
154
|
+
}): Element | DocumentFragment | null;
|
|
155
|
+
/**
|
|
156
|
+
* Returns whether this node is before given node. `false` is returned if nodes are in different trees (for example,
|
|
157
|
+
* in different {@link module:engine/model/documentfragment~DocumentFragment}s).
|
|
158
|
+
*
|
|
159
|
+
* @param node Node to compare with.
|
|
160
|
+
*/
|
|
161
|
+
isBefore(node: Node): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Returns whether this node is after given node. `false` is returned if nodes are in different trees (for example,
|
|
164
|
+
* in different {@link module:engine/model/documentfragment~DocumentFragment}s).
|
|
165
|
+
*
|
|
166
|
+
* @param node Node to compare with.
|
|
167
|
+
*/
|
|
168
|
+
isAfter(node: Node): boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Checks if the node has an attribute with given key.
|
|
171
|
+
*
|
|
172
|
+
* @param key Key of attribute to check.
|
|
173
|
+
* @returns `true` if attribute with given key is set on node, `false` otherwise.
|
|
174
|
+
*/
|
|
175
|
+
hasAttribute(key: string): boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Gets an attribute value for given key or `undefined` if that attribute is not set on node.
|
|
178
|
+
*
|
|
179
|
+
* @param key Key of attribute to look for.
|
|
180
|
+
* @returns Attribute value or `undefined`.
|
|
181
|
+
*/
|
|
182
|
+
getAttribute(key: string): unknown;
|
|
183
|
+
/**
|
|
184
|
+
* Returns iterator that iterates over this node's attributes.
|
|
185
|
+
*
|
|
186
|
+
* Attributes are returned as arrays containing two items. First one is attribute key and second is attribute value.
|
|
187
|
+
* This format is accepted by native `Map` object and also can be passed in `Node` constructor.
|
|
188
|
+
*/
|
|
189
|
+
getAttributes(): IterableIterator<[string, unknown]>;
|
|
190
|
+
/**
|
|
191
|
+
* Returns iterator that iterates over this node's attribute keys.
|
|
192
|
+
*/
|
|
193
|
+
getAttributeKeys(): IterableIterator<string>;
|
|
194
|
+
/**
|
|
195
|
+
* Converts `Node` to plain object and returns it.
|
|
196
|
+
*
|
|
197
|
+
* @returns `Node` converted to plain object.
|
|
198
|
+
*/
|
|
199
|
+
toJSON(): unknown;
|
|
200
|
+
/**
|
|
201
|
+
* Creates a copy of this node, that is a node with exactly same attributes, and returns it.
|
|
202
|
+
*
|
|
203
|
+
* @internal
|
|
204
|
+
* @returns Node with same attributes as this node.
|
|
205
|
+
*/
|
|
206
|
+
_clone(_deep?: boolean): Node;
|
|
207
|
+
/**
|
|
208
|
+
* Removes this node from it's parent.
|
|
209
|
+
*
|
|
210
|
+
* @internal
|
|
211
|
+
* @see module:engine/model/writer~Writer#remove
|
|
212
|
+
*/
|
|
213
|
+
_remove(): void;
|
|
214
|
+
/**
|
|
215
|
+
* Sets attribute on the node. If attribute with the same key already is set, it's value is overwritten.
|
|
216
|
+
*
|
|
217
|
+
* @see module:engine/model/writer~Writer#setAttribute
|
|
218
|
+
* @internal
|
|
219
|
+
* @param key Key of attribute to set.
|
|
220
|
+
* @param value Attribute value.
|
|
221
|
+
*/
|
|
222
|
+
_setAttribute(key: string, value: unknown): void;
|
|
223
|
+
/**
|
|
224
|
+
* Removes all attributes from the node and sets given attributes.
|
|
225
|
+
*
|
|
226
|
+
* @see module:engine/model/writer~Writer#setAttributes
|
|
227
|
+
* @internal
|
|
228
|
+
* @param attrs Attributes to set. See {@link module:utils/tomap~toMap} for a list of accepted values.
|
|
229
|
+
*/
|
|
230
|
+
_setAttributesTo(attrs: NodeAttributes): void;
|
|
231
|
+
/**
|
|
232
|
+
* Removes an attribute with given key from the node.
|
|
233
|
+
*
|
|
234
|
+
* @see module:engine/model/writer~Writer#removeAttribute
|
|
235
|
+
* @internal
|
|
236
|
+
* @param key Key of attribute to remove.
|
|
237
|
+
* @returns `true` if the attribute was set on the element, `false` otherwise.
|
|
238
|
+
*/
|
|
239
|
+
_removeAttribute(key: string): boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Removes all attributes from the node.
|
|
242
|
+
*
|
|
243
|
+
* @see module:engine/model/writer~Writer#clearAttributes
|
|
244
|
+
* @internal
|
|
245
|
+
*/
|
|
246
|
+
_clearAttributes(): void;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* The node's parent does not contain this node.
|
|
250
|
+
*
|
|
251
|
+
* @error model-node-not-found-in-parent
|
|
252
|
+
*/
|
|
253
|
+
/**
|
|
254
|
+
* Node's attributes. See {@link module:utils/tomap~toMap} for a list of accepted values.
|
|
255
|
+
*/
|
|
256
|
+
export type NodeAttributes = Record<string, unknown> | Iterable<[string, unknown]>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module engine/model/nodelist
|
|
7
|
+
*/
|
|
8
|
+
import Node from './node';
|
|
9
|
+
/**
|
|
10
|
+
* Provides an interface to operate on a list of {@link module:engine/model/node~Node nodes}. `NodeList` is used internally
|
|
11
|
+
* in classes like {@link module:engine/model/element~Element Element}
|
|
12
|
+
* or {@link module:engine/model/documentfragment~DocumentFragment DocumentFragment}.
|
|
13
|
+
*/
|
|
14
|
+
export default class NodeList implements Iterable<Node> {
|
|
15
|
+
/**
|
|
16
|
+
* Nodes contained in this node list.
|
|
17
|
+
*/
|
|
18
|
+
private _nodes;
|
|
19
|
+
/**
|
|
20
|
+
* Creates an empty node list.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
* @param nodes Nodes contained in this node list.
|
|
24
|
+
*/
|
|
25
|
+
constructor(nodes?: Iterable<Node>);
|
|
26
|
+
/**
|
|
27
|
+
* Iterable interface.
|
|
28
|
+
*
|
|
29
|
+
* Iterates over all nodes contained inside this node list.
|
|
30
|
+
*/
|
|
31
|
+
[Symbol.iterator](): IterableIterator<Node>;
|
|
32
|
+
/**
|
|
33
|
+
* Number of nodes contained inside this node list.
|
|
34
|
+
*/
|
|
35
|
+
get length(): number;
|
|
36
|
+
/**
|
|
37
|
+
* Sum of {@link module:engine/model/node~Node#offsetSize offset sizes} of all nodes contained inside this node list.
|
|
38
|
+
*/
|
|
39
|
+
get maxOffset(): number;
|
|
40
|
+
/**
|
|
41
|
+
* Gets the node at the given index. Returns `null` if incorrect index was passed.
|
|
42
|
+
*/
|
|
43
|
+
getNode(index: number): Node | null;
|
|
44
|
+
/**
|
|
45
|
+
* Returns an index of the given node. Returns `null` if given node is not inside this node list.
|
|
46
|
+
*/
|
|
47
|
+
getNodeIndex(node: Node): number | null;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the starting offset of given node. Starting offset is equal to the sum of
|
|
50
|
+
* {@link module:engine/model/node~Node#offsetSize offset sizes} of all nodes that are before this node in this node list.
|
|
51
|
+
*/
|
|
52
|
+
getNodeStartOffset(node: Node): number | null;
|
|
53
|
+
/**
|
|
54
|
+
* Converts index to offset in node list.
|
|
55
|
+
*
|
|
56
|
+
* Returns starting offset of a node that is at given index. Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError}
|
|
57
|
+
* `model-nodelist-index-out-of-bounds` if given index is less than `0` or more than {@link #length}.
|
|
58
|
+
*/
|
|
59
|
+
indexToOffset(index: number): number;
|
|
60
|
+
/**
|
|
61
|
+
* Converts offset in node list to index.
|
|
62
|
+
*
|
|
63
|
+
* Returns index of a node that occupies given offset. Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError}
|
|
64
|
+
* `model-nodelist-offset-out-of-bounds` if given offset is less than `0` or more than {@link #maxOffset}.
|
|
65
|
+
*/
|
|
66
|
+
offsetToIndex(offset: number): number;
|
|
67
|
+
/**
|
|
68
|
+
* Inserts given nodes at given index.
|
|
69
|
+
*
|
|
70
|
+
* @internal
|
|
71
|
+
* @param index Index at which nodes should be inserted.
|
|
72
|
+
* @param nodes Nodes to be inserted.
|
|
73
|
+
*/
|
|
74
|
+
_insertNodes(index: number, nodes: Iterable<Node>): void;
|
|
75
|
+
/**
|
|
76
|
+
* Removes one or more nodes starting at the given index.
|
|
77
|
+
*
|
|
78
|
+
* @internal
|
|
79
|
+
* @param indexStart Index of the first node to remove.
|
|
80
|
+
* @param howMany Number of nodes to remove.
|
|
81
|
+
* @returns Array containing removed nodes.
|
|
82
|
+
*/
|
|
83
|
+
_removeNodes(indexStart: number, howMany?: number): Array<Node>;
|
|
84
|
+
/**
|
|
85
|
+
* Converts `NodeList` instance to an array containing nodes that were inserted in the node list. Nodes
|
|
86
|
+
* are also converted to their plain object representation.
|
|
87
|
+
*
|
|
88
|
+
* @returns `NodeList` instance converted to `Array`.
|
|
89
|
+
*/
|
|
90
|
+
toJSON(): unknown;
|
|
91
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module engine/model/operation/attributeoperation
|
|
7
|
+
*/
|
|
8
|
+
import Operation from './operation';
|
|
9
|
+
import Range from '../range';
|
|
10
|
+
import type Document from '../document';
|
|
11
|
+
/**
|
|
12
|
+
* Operation to change nodes' attribute.
|
|
13
|
+
*
|
|
14
|
+
* Using this class you can add, remove or change value of the attribute.
|
|
15
|
+
*/
|
|
16
|
+
export default class AttributeOperation extends Operation {
|
|
17
|
+
/**
|
|
18
|
+
* Range on which operation should be applied.
|
|
19
|
+
*
|
|
20
|
+
* @readonly
|
|
21
|
+
*/
|
|
22
|
+
range: Range;
|
|
23
|
+
/**
|
|
24
|
+
* Key of an attribute to change or remove.
|
|
25
|
+
*
|
|
26
|
+
* @readonly
|
|
27
|
+
*/
|
|
28
|
+
key: string;
|
|
29
|
+
/**
|
|
30
|
+
* Old value of the attribute with given key or `null`, if attribute was not set before.
|
|
31
|
+
*
|
|
32
|
+
* @readonly
|
|
33
|
+
*/
|
|
34
|
+
oldValue: unknown;
|
|
35
|
+
/**
|
|
36
|
+
* New value of the attribute with given key or `null`, if operation should remove attribute.
|
|
37
|
+
*
|
|
38
|
+
* @readonly
|
|
39
|
+
*/
|
|
40
|
+
newValue: unknown;
|
|
41
|
+
/**
|
|
42
|
+
* Creates an operation that changes, removes or adds attributes.
|
|
43
|
+
*
|
|
44
|
+
* If only `newValue` is set, attribute will be added on a node. Note that all nodes in operation's range must not
|
|
45
|
+
* have an attribute with the same key as the added attribute.
|
|
46
|
+
*
|
|
47
|
+
* If only `oldValue` is set, then attribute with given key will be removed. Note that all nodes in operation's range
|
|
48
|
+
* must have an attribute with that key added.
|
|
49
|
+
*
|
|
50
|
+
* If both `newValue` and `oldValue` are set, then the operation will change the attribute value. Note that all nodes in
|
|
51
|
+
* operation's ranges must already have an attribute with given key and `oldValue` as value
|
|
52
|
+
*
|
|
53
|
+
* @param range Range on which the operation should be applied. Must be a flat range.
|
|
54
|
+
* @param key Key of an attribute to change or remove.
|
|
55
|
+
* @param oldValue Old value of the attribute with given key or `null`, if attribute was not set before.
|
|
56
|
+
* @param newValue New value of the attribute with given key or `null`, if operation should remove attribute.
|
|
57
|
+
* @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
|
|
58
|
+
* can be applied or `null` if the operation operates on detached (non-document) tree.
|
|
59
|
+
*/
|
|
60
|
+
constructor(range: Range, key: string, oldValue: unknown, newValue: unknown, baseVersion: number | null);
|
|
61
|
+
/**
|
|
62
|
+
* @inheritDoc
|
|
63
|
+
*/
|
|
64
|
+
get type(): 'addAttribute' | 'removeAttribute' | 'changeAttribute';
|
|
65
|
+
/**
|
|
66
|
+
* Creates and returns an operation that has the same parameters as this operation.
|
|
67
|
+
*/
|
|
68
|
+
clone(): AttributeOperation;
|
|
69
|
+
/**
|
|
70
|
+
* See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
|
|
71
|
+
*/
|
|
72
|
+
getReversed(): Operation;
|
|
73
|
+
/**
|
|
74
|
+
* @inheritDoc
|
|
75
|
+
*/
|
|
76
|
+
toJSON(): unknown;
|
|
77
|
+
/**
|
|
78
|
+
* @inheritDoc
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
_validate(): void;
|
|
82
|
+
/**
|
|
83
|
+
* @inheritDoc
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
_execute(): void;
|
|
87
|
+
/**
|
|
88
|
+
* @inheritDoc
|
|
89
|
+
*/
|
|
90
|
+
static get className(): string;
|
|
91
|
+
/**
|
|
92
|
+
* Creates `AttributeOperation` object from deserilized object, i.e. from parsed JSON string.
|
|
93
|
+
*
|
|
94
|
+
* @param json Deserialized JSON object.
|
|
95
|
+
* @param document Document on which this operation will be applied.
|
|
96
|
+
*/
|
|
97
|
+
static fromJSON(json: any, document: Document): AttributeOperation;
|
|
98
|
+
}
|