@ckeditor/ckeditor5-engine 45.2.1 → 46.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2563 -2257
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/controller/datacontroller.d.ts +33 -32
- package/src/controller/datacontroller.js +29 -28
- package/src/controller/editingcontroller.d.ts +8 -8
- package/src/controller/editingcontroller.js +10 -10
- package/src/conversion/conversion.d.ts +18 -19
- package/src/conversion/conversion.js +4 -4
- package/src/conversion/conversionhelpers.d.ts +1 -1
- package/src/conversion/conversionhelpers.js +1 -1
- package/src/conversion/downcastdispatcher.d.ts +63 -69
- package/src/conversion/downcastdispatcher.js +16 -16
- package/src/conversion/downcasthelpers.d.ts +94 -83
- package/src/conversion/downcasthelpers.js +63 -53
- package/src/conversion/mapper.d.ts +27 -27
- package/src/conversion/mapper.js +15 -15
- package/src/conversion/modelconsumable.d.ts +26 -26
- package/src/conversion/modelconsumable.js +23 -23
- package/src/conversion/upcastdispatcher.d.ts +33 -32
- package/src/conversion/upcastdispatcher.js +19 -19
- package/src/conversion/upcasthelpers.d.ts +46 -38
- package/src/conversion/upcasthelpers.js +33 -24
- package/src/conversion/viewconsumable.d.ts +50 -45
- package/src/conversion/viewconsumable.js +32 -27
- package/src/dataprocessor/basichtmlwriter.d.ts +4 -2
- package/src/dataprocessor/basichtmlwriter.js +3 -1
- package/src/dataprocessor/dataprocessor.d.ts +7 -6
- package/src/dataprocessor/htmldataprocessor.d.ts +10 -10
- package/src/dataprocessor/htmldataprocessor.js +6 -6
- package/src/dataprocessor/htmlwriter.d.ts +1 -1
- package/src/dataprocessor/xmldataprocessor.d.ts +10 -10
- package/src/dataprocessor/xmldataprocessor.js +6 -6
- package/src/dev-utils/model.d.ts +25 -26
- package/src/dev-utils/model.js +35 -36
- package/src/dev-utils/operationreplayer.d.ts +5 -3
- package/src/dev-utils/operationreplayer.js +4 -2
- package/src/dev-utils/utils.d.ts +8 -0
- package/src/dev-utils/utils.js +8 -0
- package/src/dev-utils/view.d.ts +66 -63
- package/src/dev-utils/view.js +144 -134
- package/src/index.d.ts +135 -106
- package/src/index.js +120 -71
- package/src/legacyerrors.d.ts +5 -0
- package/src/legacyerrors.js +17 -0
- package/src/model/batch.d.ts +2 -15
- package/src/model/batch.js +1 -23
- package/src/model/differ.d.ts +54 -31
- package/src/model/differ.js +15 -15
- package/src/model/document.d.ts +31 -31
- package/src/model/document.js +13 -13
- package/src/model/documentfragment.d.ts +45 -45
- package/src/model/documentfragment.js +40 -40
- package/src/model/documentselection.d.ts +92 -92
- package/src/model/documentselection.js +71 -70
- package/src/model/element.d.ts +31 -31
- package/src/model/element.js +29 -29
- package/src/model/history.d.ts +3 -3
- package/src/model/history.js +2 -2
- package/src/model/item.d.ts +4 -5
- package/src/model/liveposition.d.ts +31 -31
- package/src/model/liveposition.js +18 -18
- package/src/model/liverange.d.ts +42 -38
- package/src/model/liverange.js +17 -16
- package/src/model/markercollection.d.ts +41 -40
- package/src/model/markercollection.js +22 -20
- package/src/model/model.d.ts +82 -81
- package/src/model/model.js +54 -54
- package/src/model/node.d.ts +48 -48
- package/src/model/node.js +31 -31
- package/src/model/nodelist.d.ts +17 -17
- package/src/model/nodelist.js +11 -11
- package/src/model/operation/attributeoperation.d.ts +10 -10
- package/src/model/operation/attributeoperation.js +7 -7
- package/src/model/operation/detachoperation.d.ts +11 -9
- package/src/model/operation/detachoperation.js +8 -6
- package/src/model/operation/insertoperation.d.ts +13 -13
- package/src/model/operation/insertoperation.js +15 -15
- package/src/model/operation/markeroperation.d.ts +12 -12
- package/src/model/operation/markeroperation.js +5 -5
- package/src/model/operation/mergeoperation.d.ts +16 -16
- package/src/model/operation/mergeoperation.js +18 -18
- package/src/model/operation/moveoperation.d.ts +16 -16
- package/src/model/operation/moveoperation.js +18 -15
- package/src/model/operation/nooperation.d.ts +4 -4
- package/src/model/operation/nooperation.js +2 -2
- package/src/model/operation/operation.d.ts +10 -10
- package/src/model/operation/operation.js +5 -5
- package/src/model/operation/operationfactory.d.ts +4 -4
- package/src/model/operation/operationfactory.js +12 -12
- package/src/model/operation/renameoperation.d.ts +10 -10
- package/src/model/operation/renameoperation.js +7 -7
- package/src/model/operation/rootattributeoperation.d.ts +12 -12
- package/src/model/operation/rootattributeoperation.js +8 -8
- package/src/model/operation/rootoperation.d.ts +8 -8
- package/src/model/operation/rootoperation.js +3 -3
- package/src/model/operation/splitoperation.d.ts +17 -17
- package/src/model/operation/splitoperation.js +19 -19
- package/src/model/operation/transform.d.ts +11 -8
- package/src/model/operation/transform.js +66 -49
- package/src/model/operation/utils.d.ts +24 -23
- package/src/model/operation/utils.js +20 -20
- package/src/model/position.d.ts +101 -97
- package/src/model/position.js +69 -64
- package/src/model/range.d.ts +90 -90
- package/src/model/range.js +87 -87
- package/src/model/rootelement.d.ts +11 -11
- package/src/model/rootelement.js +9 -9
- package/src/model/schema.d.ts +158 -154
- package/src/model/schema.js +93 -90
- package/src/model/selection.d.ts +73 -73
- package/src/model/selection.js +62 -62
- package/src/model/text.d.ts +11 -10
- package/src/model/text.js +11 -10
- package/src/model/textproxy.d.ts +39 -38
- package/src/model/textproxy.js +31 -30
- package/src/model/treewalker.d.ts +37 -37
- package/src/model/treewalker.js +14 -14
- package/src/model/typecheckable.d.ts +45 -45
- package/src/model/typecheckable.js +1 -1
- package/src/model/utils/autoparagraphing.d.ts +7 -7
- package/src/model/utils/deletecontent.d.ts +7 -5
- package/src/model/utils/deletecontent.js +13 -11
- package/src/model/utils/getselectedcontent.d.ts +6 -5
- package/src/model/utils/getselectedcontent.js +2 -1
- package/src/model/utils/insertcontent.d.ts +9 -8
- package/src/model/utils/insertcontent.js +41 -40
- package/src/model/utils/insertobject.d.ts +9 -9
- package/src/model/utils/insertobject.js +4 -4
- package/src/model/utils/modifyselection.d.ts +5 -4
- package/src/model/utils/modifyselection.js +12 -11
- package/src/model/utils/selection-post-fixer.d.ts +12 -8
- package/src/model/utils/selection-post-fixer.js +15 -11
- package/src/model/writer.d.ts +102 -101
- package/src/model/writer.js +99 -98
- package/src/view/attributeelement.d.ts +29 -29
- package/src/view/attributeelement.js +25 -25
- package/src/view/containerelement.d.ts +16 -15
- package/src/view/containerelement.js +15 -14
- package/src/view/datatransfer.d.ts +7 -7
- package/src/view/datatransfer.js +1 -1
- package/src/view/document.d.ts +25 -25
- package/src/view/document.js +15 -15
- package/src/view/documentfragment.d.ts +21 -21
- package/src/view/documentfragment.js +14 -14
- package/src/view/documentselection.d.ts +65 -63
- package/src/view/documentselection.js +27 -25
- package/src/view/domconverter.d.ts +94 -89
- package/src/view/domconverter.js +78 -73
- package/src/view/downcastwriter.d.ts +185 -181
- package/src/view/downcastwriter.js +222 -210
- package/src/view/editableelement.d.ts +13 -13
- package/src/view/editableelement.js +8 -8
- package/src/view/element.d.ts +75 -74
- package/src/view/element.js +58 -58
- package/src/view/elementdefinition.d.ts +3 -4
- package/src/view/emptyelement.d.ts +13 -13
- package/src/view/emptyelement.js +13 -13
- package/src/view/filler.d.ts +14 -3
- package/src/view/filler.js +12 -1
- package/src/view/item.d.ts +4 -5
- package/src/view/matcher.d.ts +22 -19
- package/src/view/matcher.js +6 -6
- package/src/view/node.d.ts +33 -33
- package/src/view/node.js +9 -9
- package/src/view/observer/arrowkeysobserver.d.ts +10 -10
- package/src/view/observer/arrowkeysobserver.js +5 -5
- package/src/view/observer/bubblingemittermixin.d.ts +5 -5
- package/src/view/observer/bubblingemittermixin.js +2 -9
- package/src/view/observer/bubblingeventinfo.d.ts +9 -9
- package/src/view/observer/bubblingeventinfo.js +1 -1
- package/src/view/observer/clickobserver.d.ts +8 -8
- package/src/view/observer/clickobserver.js +4 -4
- package/src/view/observer/compositionobserver.d.ts +19 -19
- package/src/view/observer/compositionobserver.js +6 -6
- package/src/view/observer/domeventdata.d.ts +9 -9
- package/src/view/observer/domeventdata.js +2 -2
- package/src/view/observer/domeventobserver.d.ts +3 -3
- package/src/view/observer/domeventobserver.js +5 -5
- package/src/view/observer/fakeselectionobserver.d.ts +9 -9
- package/src/view/observer/fakeselectionobserver.js +8 -8
- package/src/view/observer/focusobserver.d.ts +16 -16
- package/src/view/observer/focusobserver.js +7 -7
- package/src/view/observer/inputobserver.d.ts +18 -18
- package/src/view/observer/inputobserver.js +5 -5
- package/src/view/observer/keyobserver.d.ts +11 -11
- package/src/view/observer/keyobserver.js +3 -3
- package/src/view/observer/mouseobserver.d.ts +16 -16
- package/src/view/observer/mouseobserver.js +3 -3
- package/src/view/observer/mutationobserver.d.ts +21 -21
- package/src/view/observer/mutationobserver.js +7 -7
- package/src/view/observer/observer.d.ts +12 -12
- package/src/view/observer/observer.js +6 -6
- package/src/view/observer/selectionobserver.d.ts +33 -33
- package/src/view/observer/selectionobserver.js +14 -14
- package/src/view/observer/tabobserver.d.ts +10 -10
- package/src/view/observer/tabobserver.js +5 -5
- package/src/view/observer/touchobserver.d.ts +13 -13
- package/src/view/observer/touchobserver.js +3 -3
- package/src/view/placeholder.d.ts +21 -21
- package/src/view/placeholder.js +23 -23
- package/src/view/position.d.ts +49 -49
- package/src/view/position.js +42 -42
- package/src/view/range.d.ts +76 -74
- package/src/view/range.js +67 -65
- package/src/view/rawelement.d.ts +19 -19
- package/src/view/rawelement.js +16 -16
- package/src/view/renderer.d.ts +14 -14
- package/src/view/renderer.js +7 -7
- package/src/view/rooteditableelement.d.ts +8 -7
- package/src/view/rooteditableelement.js +7 -6
- package/src/view/selection.d.ts +66 -64
- package/src/view/selection.js +50 -48
- package/src/view/styles/background.d.ts +2 -2
- package/src/view/styles/background.js +9 -9
- package/src/view/styles/border.d.ts +2 -2
- package/src/view/styles/border.js +13 -13
- package/src/view/styles/margin.d.ts +2 -2
- package/src/view/styles/margin.js +5 -5
- package/src/view/styles/padding.d.ts +2 -2
- package/src/view/styles/padding.js +5 -5
- package/src/view/styles/utils.d.ts +24 -24
- package/src/view/styles/utils.js +25 -25
- package/src/view/stylesmap.d.ts +28 -32
- package/src/view/stylesmap.js +52 -39
- package/src/view/text.d.ts +11 -11
- package/src/view/text.js +10 -10
- package/src/view/textproxy.d.ts +33 -32
- package/src/view/textproxy.js +23 -22
- package/src/view/tokenlist.d.ts +14 -14
- package/src/view/tokenlist.js +10 -10
- package/src/view/treewalker.d.ts +42 -40
- package/src/view/treewalker.js +36 -35
- package/src/view/typecheckable.d.ts +76 -75
- package/src/view/typecheckable.js +1 -1
- package/src/view/uielement.d.ts +22 -21
- package/src/view/uielement.js +17 -16
- package/src/view/upcastwriter.d.ts +70 -70
- package/src/view/upcastwriter.js +42 -42
- package/src/view/view.d.ts +70 -69
- package/src/view/view.js +56 -55
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Abstract base operation class.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export class Operation {
|
|
9
9
|
/**
|
|
10
|
-
* {@link module:engine/model/document~
|
|
10
|
+
* {@link module:engine/model/document~ModelDocument#version} on which operation can be applied. If you try to
|
|
11
11
|
* {@link module:engine/model/model~Model#applyOperation apply} operation with different base version than the
|
|
12
|
-
* {@link module:engine/model/document~
|
|
12
|
+
* {@link module:engine/model/document~ModelDocument#version document version} the
|
|
13
13
|
* {@link module:utils/ckeditorerror~CKEditorError model-document-applyOperation-wrong-version} error is thrown.
|
|
14
14
|
*/
|
|
15
15
|
baseVersion;
|
|
16
16
|
/**
|
|
17
|
-
* Defines whether operation is executed on attached or detached {@link module:engine/model/item~
|
|
17
|
+
* Defines whether operation is executed on attached or detached {@link module:engine/model/item~ModelItem items}.
|
|
18
18
|
*/
|
|
19
19
|
isDocumentOperation;
|
|
20
20
|
/**
|
|
@@ -28,7 +28,7 @@ export default class Operation {
|
|
|
28
28
|
/**
|
|
29
29
|
* Base operation constructor.
|
|
30
30
|
*
|
|
31
|
-
* @param baseVersion Document {@link module:engine/model/document~
|
|
31
|
+
* @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
|
|
32
32
|
* can be applied or `null` if the operation operates on detached (non-document) tree.
|
|
33
33
|
*/
|
|
34
34
|
constructor(baseVersion) {
|
|
@@ -2,17 +2,17 @@
|
|
|
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 Operation from './operation.js';
|
|
6
|
-
import type
|
|
5
|
+
import { Operation } from './operation.js';
|
|
6
|
+
import { type ModelDocument } from '../document.js';
|
|
7
7
|
/**
|
|
8
8
|
* A factory class for creating operations.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export declare abstract class OperationFactory {
|
|
11
11
|
/**
|
|
12
12
|
* Creates an operation instance from a JSON object (parsed JSON string).
|
|
13
13
|
*
|
|
14
14
|
* @param json Deserialized JSON object.
|
|
15
15
|
* @param document Document on which this operation will be applied.
|
|
16
16
|
*/
|
|
17
|
-
static fromJSON(json: any, document:
|
|
17
|
+
static fromJSON(json: any, document: ModelDocument): Operation;
|
|
18
18
|
}
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/operationfactory
|
|
7
7
|
*/
|
|
8
|
-
import AttributeOperation from './attributeoperation.js';
|
|
9
|
-
import InsertOperation from './insertoperation.js';
|
|
10
|
-
import MarkerOperation from './markeroperation.js';
|
|
11
|
-
import MoveOperation from './moveoperation.js';
|
|
12
|
-
import NoOperation from './nooperation.js';
|
|
13
|
-
import Operation from './operation.js';
|
|
14
|
-
import RenameOperation from './renameoperation.js';
|
|
15
|
-
import RootAttributeOperation from './rootattributeoperation.js';
|
|
16
|
-
import RootOperation from './rootoperation.js';
|
|
17
|
-
import SplitOperation from './splitoperation.js';
|
|
18
|
-
import MergeOperation from './mergeoperation.js';
|
|
8
|
+
import { AttributeOperation } from './attributeoperation.js';
|
|
9
|
+
import { InsertOperation } from './insertoperation.js';
|
|
10
|
+
import { MarkerOperation } from './markeroperation.js';
|
|
11
|
+
import { MoveOperation } from './moveoperation.js';
|
|
12
|
+
import { NoOperation } from './nooperation.js';
|
|
13
|
+
import { Operation } from './operation.js';
|
|
14
|
+
import { RenameOperation } from './renameoperation.js';
|
|
15
|
+
import { RootAttributeOperation } from './rootattributeoperation.js';
|
|
16
|
+
import { RootOperation } from './rootoperation.js';
|
|
17
|
+
import { SplitOperation } from './splitoperation.js';
|
|
18
|
+
import { MergeOperation } from './mergeoperation.js';
|
|
19
19
|
const operations = {};
|
|
20
20
|
operations[AttributeOperation.className] = AttributeOperation;
|
|
21
21
|
operations[InsertOperation.className] = InsertOperation;
|
|
@@ -31,7 +31,7 @@ operations[MergeOperation.className] = MergeOperation;
|
|
|
31
31
|
/**
|
|
32
32
|
* A factory class for creating operations.
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
34
|
+
export class OperationFactory {
|
|
35
35
|
/**
|
|
36
36
|
* Creates an operation instance from a JSON object (parsed JSON string).
|
|
37
37
|
*
|
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/renameoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
9
|
-
import
|
|
10
|
-
import type
|
|
11
|
-
import type {
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
|
+
import { ModelPosition } from '../position.js';
|
|
10
|
+
import { type ModelDocument } from '../document.js';
|
|
11
|
+
import type { ModelSelectable } from '../selection.js';
|
|
12
12
|
/**
|
|
13
13
|
* Operation to change element's name.
|
|
14
14
|
*
|
|
15
15
|
* Using this class you can change element's name.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export declare class RenameOperation extends Operation {
|
|
18
18
|
/**
|
|
19
19
|
* Position before an element to change.
|
|
20
20
|
*/
|
|
21
|
-
position:
|
|
21
|
+
position: ModelPosition;
|
|
22
22
|
/**
|
|
23
23
|
* Current name of the element.
|
|
24
24
|
*/
|
|
@@ -33,10 +33,10 @@ export default class RenameOperation extends Operation {
|
|
|
33
33
|
* @param position Position before an element to change.
|
|
34
34
|
* @param oldName Current name of the element.
|
|
35
35
|
* @param newName New name for the element.
|
|
36
|
-
* @param baseVersion Document {@link module:engine/model/document~
|
|
36
|
+
* @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
|
|
37
37
|
* can be applied or `null` if the operation operates on detached (non-document) tree.
|
|
38
38
|
*/
|
|
39
|
-
constructor(position:
|
|
39
|
+
constructor(position: ModelPosition, oldName: string, newName: string, baseVersion: number | null);
|
|
40
40
|
/**
|
|
41
41
|
* @inheritDoc
|
|
42
42
|
*/
|
|
@@ -44,7 +44,7 @@ export default class RenameOperation extends Operation {
|
|
|
44
44
|
/**
|
|
45
45
|
* @inheritDoc
|
|
46
46
|
*/
|
|
47
|
-
get affectedSelectable():
|
|
47
|
+
get affectedSelectable(): ModelSelectable;
|
|
48
48
|
/**
|
|
49
49
|
* Creates and returns an operation that has the same parameters as this operation.
|
|
50
50
|
*
|
|
@@ -79,5 +79,5 @@ export default class RenameOperation extends Operation {
|
|
|
79
79
|
* @param json Deserialized JSON object.
|
|
80
80
|
* @param document Document on which this operation will be applied.
|
|
81
81
|
*/
|
|
82
|
-
static fromJSON(json: any, document:
|
|
82
|
+
static fromJSON(json: any, document: ModelDocument): RenameOperation;
|
|
83
83
|
}
|
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/renameoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
|
+
import { ModelElement } from '../element.js';
|
|
10
|
+
import { ModelPosition } from '../position.js';
|
|
11
11
|
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
12
12
|
/**
|
|
13
13
|
* Operation to change element's name.
|
|
14
14
|
*
|
|
15
15
|
* Using this class you can change element's name.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export class RenameOperation extends Operation {
|
|
18
18
|
/**
|
|
19
19
|
* Position before an element to change.
|
|
20
20
|
*/
|
|
@@ -33,7 +33,7 @@ export default class RenameOperation extends Operation {
|
|
|
33
33
|
* @param position Position before an element to change.
|
|
34
34
|
* @param oldName Current name of the element.
|
|
35
35
|
* @param newName New name for the element.
|
|
36
|
-
* @param baseVersion Document {@link module:engine/model/document~
|
|
36
|
+
* @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
|
|
37
37
|
* can be applied or `null` if the operation operates on detached (non-document) tree.
|
|
38
38
|
*/
|
|
39
39
|
constructor(position, oldName, newName, baseVersion) {
|
|
@@ -76,7 +76,7 @@ export default class RenameOperation extends Operation {
|
|
|
76
76
|
*/
|
|
77
77
|
_validate() {
|
|
78
78
|
const element = this.position.nodeAfter;
|
|
79
|
-
if (!(element instanceof
|
|
79
|
+
if (!(element instanceof ModelElement)) {
|
|
80
80
|
/**
|
|
81
81
|
* Given position is invalid or node after it is not instance of Element.
|
|
82
82
|
*
|
|
@@ -122,6 +122,6 @@ export default class RenameOperation extends Operation {
|
|
|
122
122
|
* @param document Document on which this operation will be applied.
|
|
123
123
|
*/
|
|
124
124
|
static fromJSON(json, document) {
|
|
125
|
-
return new RenameOperation(
|
|
125
|
+
return new RenameOperation(ModelPosition.fromJSON(json.position, document), json.oldName, json.newName, json.baseVersion);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/rootattributeoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
9
|
-
import type
|
|
10
|
-
import type
|
|
11
|
-
import type {
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
|
+
import { type ModelDocument } from '../document.js';
|
|
10
|
+
import { type ModelRootElement } from '../rootelement.js';
|
|
11
|
+
import type { ModelSelectable } from '../selection.js';
|
|
12
12
|
/**
|
|
13
13
|
* Operation to change root element's attribute. Using this class you can add, remove or change value of the attribute.
|
|
14
14
|
*
|
|
@@ -16,14 +16,14 @@ import type { Selectable } from '../selection.js';
|
|
|
16
16
|
* {@link module:engine/model/operation/attributeoperation~AttributeOperation}.
|
|
17
17
|
* It is because {@link module:engine/model/operation/attributeoperation~AttributeOperation}
|
|
18
18
|
* requires a range to change and root element can't
|
|
19
|
-
* be a part of range because every {@link module:engine/model/position~
|
|
20
|
-
* {@link module:engine/model/position~
|
|
19
|
+
* be a part of range because every {@link module:engine/model/position~ModelPosition} has to be inside a root.
|
|
20
|
+
* {@link module:engine/model/position~ModelPosition} can't be created before a root element.
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
22
|
+
export declare class RootAttributeOperation extends Operation {
|
|
23
23
|
/**
|
|
24
24
|
* Root element to change.
|
|
25
25
|
*/
|
|
26
|
-
readonly root:
|
|
26
|
+
readonly root: ModelRootElement;
|
|
27
27
|
/**
|
|
28
28
|
* Key of an attribute to change or remove.
|
|
29
29
|
*/
|
|
@@ -48,10 +48,10 @@ export default class RootAttributeOperation extends Operation {
|
|
|
48
48
|
* @param key Key of an attribute to change or remove.
|
|
49
49
|
* @param oldValue Old value of the attribute with given key or `null`, if attribute was not set before.
|
|
50
50
|
* @param newValue New value of the attribute with given key or `null`, if operation should remove attribute.
|
|
51
|
-
* @param baseVersion Document {@link module:engine/model/document~
|
|
51
|
+
* @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
|
|
52
52
|
* can be applied or `null` if the operation operates on detached (non-document) tree.
|
|
53
53
|
*/
|
|
54
|
-
constructor(root:
|
|
54
|
+
constructor(root: ModelRootElement, key: string, oldValue: unknown, newValue: unknown, baseVersion: number | null);
|
|
55
55
|
/**
|
|
56
56
|
* @inheritDoc
|
|
57
57
|
*/
|
|
@@ -59,7 +59,7 @@ export default class RootAttributeOperation extends Operation {
|
|
|
59
59
|
/**
|
|
60
60
|
* @inheritDoc
|
|
61
61
|
*/
|
|
62
|
-
get affectedSelectable():
|
|
62
|
+
get affectedSelectable(): ModelSelectable;
|
|
63
63
|
/**
|
|
64
64
|
* Creates and returns an operation that has the same parameters as this operation.
|
|
65
65
|
*
|
|
@@ -94,5 +94,5 @@ export default class RootAttributeOperation extends Operation {
|
|
|
94
94
|
* @param json Deserialized JSON object.
|
|
95
95
|
* @param document Document on which this operation will be applied.
|
|
96
96
|
*/
|
|
97
|
-
static fromJSON(json: any, document:
|
|
97
|
+
static fromJSON(json: any, document: ModelDocument): RootAttributeOperation;
|
|
98
98
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/rootattributeoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
9
|
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
/**
|
|
11
11
|
* Operation to change root element's attribute. Using this class you can add, remove or change value of the attribute.
|
|
@@ -14,10 +14,10 @@ import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
|
14
14
|
* {@link module:engine/model/operation/attributeoperation~AttributeOperation}.
|
|
15
15
|
* It is because {@link module:engine/model/operation/attributeoperation~AttributeOperation}
|
|
16
16
|
* requires a range to change and root element can't
|
|
17
|
-
* be a part of range because every {@link module:engine/model/position~
|
|
18
|
-
* {@link module:engine/model/position~
|
|
17
|
+
* be a part of range because every {@link module:engine/model/position~ModelPosition} has to be inside a root.
|
|
18
|
+
* {@link module:engine/model/position~ModelPosition} can't be created before a root element.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export class RootAttributeOperation extends Operation {
|
|
21
21
|
/**
|
|
22
22
|
* Root element to change.
|
|
23
23
|
*/
|
|
@@ -46,7 +46,7 @@ export default class RootAttributeOperation extends Operation {
|
|
|
46
46
|
* @param key Key of an attribute to change or remove.
|
|
47
47
|
* @param oldValue Old value of the attribute with given key or `null`, if attribute was not set before.
|
|
48
48
|
* @param newValue New value of the attribute with given key or `null`, if operation should remove attribute.
|
|
49
|
-
* @param baseVersion Document {@link module:engine/model/document~
|
|
49
|
+
* @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
|
|
50
50
|
* can be applied or `null` if the operation operates on detached (non-document) tree.
|
|
51
51
|
*/
|
|
52
52
|
constructor(root, key, oldValue, newValue, baseVersion) {
|
|
@@ -100,7 +100,7 @@ export default class RootAttributeOperation extends Operation {
|
|
|
100
100
|
* The element to change is not a root element.
|
|
101
101
|
*
|
|
102
102
|
* @error rootattribute-operation-not-a-root
|
|
103
|
-
* @param {module:engine/model/rootelement~
|
|
103
|
+
* @param {module:engine/model/rootelement~ModelRootElement} root The root element.
|
|
104
104
|
* @param {string} key The key of the attribute.
|
|
105
105
|
*/
|
|
106
106
|
throw new CKEditorError('rootattribute-operation-not-a-root', this, { root: this.root, key: this.key });
|
|
@@ -110,7 +110,7 @@ export default class RootAttributeOperation extends Operation {
|
|
|
110
110
|
* The attribute which should be removed does not exist for the given node.
|
|
111
111
|
*
|
|
112
112
|
* @error rootattribute-operation-wrong-old-value
|
|
113
|
-
* @param {module:engine/model/rootelement~
|
|
113
|
+
* @param {module:engine/model/rootelement~ModelRootElement} root The root element.
|
|
114
114
|
* @param {string} key The key of the attribute.
|
|
115
115
|
*/
|
|
116
116
|
throw new CKEditorError('rootattribute-operation-wrong-old-value', this, { root: this.root, key: this.key });
|
|
@@ -120,7 +120,7 @@ export default class RootAttributeOperation extends Operation {
|
|
|
120
120
|
* The attribute with given key already exists for the given node.
|
|
121
121
|
*
|
|
122
122
|
* @error rootattribute-operation-attribute-exists
|
|
123
|
-
* @param {module:engine/model/rootelement~
|
|
123
|
+
* @param {module:engine/model/rootelement~ModelRootElement} root The root element.
|
|
124
124
|
* @param {string} key The key of the attribute.
|
|
125
125
|
*/
|
|
126
126
|
throw new CKEditorError('rootattribute-operation-attribute-exists', this, { root: this.root, key: this.key });
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/rootoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
9
|
-
import type
|
|
10
|
-
import type {
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
|
+
import { type ModelDocument } from '../document.js';
|
|
10
|
+
import type { ModelSelectable } from '../selection.js';
|
|
11
11
|
/**
|
|
12
12
|
* Operation that creates (or attaches) or detaches a root element.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export declare class RootOperation extends Operation {
|
|
15
15
|
/**
|
|
16
16
|
* Root name to create or detach.
|
|
17
17
|
*/
|
|
@@ -35,9 +35,9 @@ export default class RootOperation extends Operation {
|
|
|
35
35
|
* @param elementName Root element name.
|
|
36
36
|
* @param isAdd Specifies whether the operation adds (`true`) or detaches the root (`false`).
|
|
37
37
|
* @param document Document which owns the root.
|
|
38
|
-
* @param baseVersion Document {@link module:engine/model/document~
|
|
38
|
+
* @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation can be applied.
|
|
39
39
|
*/
|
|
40
|
-
constructor(rootName: string, elementName: string, isAdd: boolean, document:
|
|
40
|
+
constructor(rootName: string, elementName: string, isAdd: boolean, document: ModelDocument, baseVersion: number);
|
|
41
41
|
/**
|
|
42
42
|
* @inheritDoc
|
|
43
43
|
*/
|
|
@@ -45,7 +45,7 @@ export default class RootOperation extends Operation {
|
|
|
45
45
|
/**
|
|
46
46
|
* @inheritDoc
|
|
47
47
|
*/
|
|
48
|
-
get affectedSelectable():
|
|
48
|
+
get affectedSelectable(): ModelSelectable;
|
|
49
49
|
/**
|
|
50
50
|
* @inheritDoc
|
|
51
51
|
*/
|
|
@@ -72,5 +72,5 @@ export default class RootOperation extends Operation {
|
|
|
72
72
|
* @param json Deserialized JSON object.
|
|
73
73
|
* @param document Document on which this operation will be applied.
|
|
74
74
|
*/
|
|
75
|
-
static fromJSON(json: any, document:
|
|
75
|
+
static fromJSON(json: any, document: ModelDocument): RootOperation;
|
|
76
76
|
}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/rootoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
9
|
/**
|
|
10
10
|
* Operation that creates (or attaches) or detaches a root element.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export class RootOperation extends Operation {
|
|
13
13
|
/**
|
|
14
14
|
* Root name to create or detach.
|
|
15
15
|
*/
|
|
@@ -33,7 +33,7 @@ export default class RootOperation extends Operation {
|
|
|
33
33
|
* @param elementName Root element name.
|
|
34
34
|
* @param isAdd Specifies whether the operation adds (`true`) or detaches the root (`false`).
|
|
35
35
|
* @param document Document which owns the root.
|
|
36
|
-
* @param baseVersion Document {@link module:engine/model/document~
|
|
36
|
+
* @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation can be applied.
|
|
37
37
|
*/
|
|
38
38
|
constructor(rootName, elementName, isAdd, document, baseVersion) {
|
|
39
39
|
super(baseVersion);
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/splitoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import type
|
|
12
|
-
import type {
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
|
+
import { ModelPosition } from '../position.js';
|
|
10
|
+
import { ModelRange } from '../range.js';
|
|
11
|
+
import { type ModelDocument } from '../document.js';
|
|
12
|
+
import type { ModelSelectable } from '../selection.js';
|
|
13
13
|
/**
|
|
14
|
-
* Operation to split {@link module:engine/model/element~
|
|
14
|
+
* Operation to split {@link module:engine/model/element~ModelElement an element} at given
|
|
15
15
|
* {@link module:engine/model/operation/splitoperation~SplitOperation#splitPosition split position} into two elements,
|
|
16
16
|
* both containing a part of the element's original content.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export declare class SplitOperation extends Operation {
|
|
19
19
|
/**
|
|
20
20
|
* Position at which an element should be split.
|
|
21
21
|
*/
|
|
22
|
-
splitPosition:
|
|
22
|
+
splitPosition: ModelPosition;
|
|
23
23
|
/**
|
|
24
24
|
* Total offset size of elements that are in the split element after `position`.
|
|
25
25
|
*/
|
|
@@ -27,14 +27,14 @@ export default class SplitOperation extends Operation {
|
|
|
27
27
|
/**
|
|
28
28
|
* Position at which the clone of split element (or element from graveyard) will be inserted.
|
|
29
29
|
*/
|
|
30
|
-
insertionPosition:
|
|
30
|
+
insertionPosition: ModelPosition;
|
|
31
31
|
/**
|
|
32
32
|
* Position in the graveyard root before the element which should be used as a parent of the nodes after `position`.
|
|
33
33
|
* If it is not set, a copy of the the `position` parent will be used.
|
|
34
34
|
*
|
|
35
35
|
* The default behavior is to clone the split element. Element from graveyard is used during undo.
|
|
36
36
|
*/
|
|
37
|
-
graveyardPosition:
|
|
37
|
+
graveyardPosition: ModelPosition | null;
|
|
38
38
|
/**
|
|
39
39
|
* Creates a split operation.
|
|
40
40
|
*
|
|
@@ -43,10 +43,10 @@ export default class SplitOperation extends Operation {
|
|
|
43
43
|
* @param insertionPosition Position at which the clone of split element (or element from graveyard) will be inserted.
|
|
44
44
|
* @param graveyardPosition Position in the graveyard root before the element which
|
|
45
45
|
* should be used as a parent of the nodes after `position`. If it is not set, a copy of the the `position` parent will be used.
|
|
46
|
-
* @param baseVersion Document {@link module:engine/model/document~
|
|
46
|
+
* @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
|
|
47
47
|
* can be applied or `null` if the operation operates on detached (non-document) tree.
|
|
48
48
|
*/
|
|
49
|
-
constructor(splitPosition:
|
|
49
|
+
constructor(splitPosition: ModelPosition, howMany: number, insertionPosition: ModelPosition, graveyardPosition: ModelPosition | null, baseVersion: number | null);
|
|
50
50
|
/**
|
|
51
51
|
* @inheritDoc
|
|
52
52
|
*/
|
|
@@ -56,16 +56,16 @@ export default class SplitOperation extends Operation {
|
|
|
56
56
|
*
|
|
57
57
|
* This is a position where nodes that are after the split position will be moved to.
|
|
58
58
|
*/
|
|
59
|
-
get moveTargetPosition():
|
|
59
|
+
get moveTargetPosition(): ModelPosition;
|
|
60
60
|
/**
|
|
61
61
|
* Artificial range that contains all the nodes from the split element that will be moved to the new element.
|
|
62
62
|
* The range starts at {@link #splitPosition} and ends in the same parent, at `POSITIVE_INFINITY` offset.
|
|
63
63
|
*/
|
|
64
|
-
get movedRange():
|
|
64
|
+
get movedRange(): ModelRange;
|
|
65
65
|
/**
|
|
66
66
|
* @inheritDoc
|
|
67
67
|
*/
|
|
68
|
-
get affectedSelectable():
|
|
68
|
+
get affectedSelectable(): ModelSelectable;
|
|
69
69
|
/**
|
|
70
70
|
* Creates and returns an operation that has the same parameters as this operation.
|
|
71
71
|
*
|
|
@@ -98,12 +98,12 @@ export default class SplitOperation extends Operation {
|
|
|
98
98
|
* Helper function that returns a default insertion position basing on given `splitPosition`. The default insertion
|
|
99
99
|
* position is after the split element.
|
|
100
100
|
*/
|
|
101
|
-
static getInsertionPosition(splitPosition:
|
|
101
|
+
static getInsertionPosition(splitPosition: ModelPosition): ModelPosition;
|
|
102
102
|
/**
|
|
103
103
|
* Creates `SplitOperation` object from deserialized object, i.e. from parsed JSON string.
|
|
104
104
|
*
|
|
105
105
|
* @param json Deserialized JSON object.
|
|
106
106
|
* @param document Document on which this operation will be applied.
|
|
107
107
|
*/
|
|
108
|
-
static fromJSON(json: any, document:
|
|
108
|
+
static fromJSON(json: any, document: ModelDocument): SplitOperation;
|
|
109
109
|
}
|
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/operation/splitoperation
|
|
7
7
|
*/
|
|
8
|
-
import Operation from './operation.js';
|
|
9
|
-
import MergeOperation from './mergeoperation.js';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
8
|
+
import { Operation } from './operation.js';
|
|
9
|
+
import { MergeOperation } from './mergeoperation.js';
|
|
10
|
+
import { ModelPosition } from '../position.js';
|
|
11
|
+
import { ModelRange } from '../range.js';
|
|
12
12
|
import { _insert, _move } from './utils.js';
|
|
13
13
|
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
14
14
|
/**
|
|
15
|
-
* Operation to split {@link module:engine/model/element~
|
|
15
|
+
* Operation to split {@link module:engine/model/element~ModelElement an element} at given
|
|
16
16
|
* {@link module:engine/model/operation/splitoperation~SplitOperation#splitPosition split position} into two elements,
|
|
17
17
|
* both containing a part of the element's original content.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export class SplitOperation extends Operation {
|
|
20
20
|
/**
|
|
21
21
|
* Position at which an element should be split.
|
|
22
22
|
*/
|
|
@@ -44,7 +44,7 @@ export default class SplitOperation extends Operation {
|
|
|
44
44
|
* @param insertionPosition Position at which the clone of split element (or element from graveyard) will be inserted.
|
|
45
45
|
* @param graveyardPosition Position in the graveyard root before the element which
|
|
46
46
|
* should be used as a parent of the nodes after `position`. If it is not set, a copy of the the `position` parent will be used.
|
|
47
|
-
* @param baseVersion Document {@link module:engine/model/document~
|
|
47
|
+
* @param baseVersion Document {@link module:engine/model/document~ModelDocument#version} on which operation
|
|
48
48
|
* can be applied or `null` if the operation operates on detached (non-document) tree.
|
|
49
49
|
*/
|
|
50
50
|
constructor(splitPosition, howMany, insertionPosition, graveyardPosition, baseVersion) {
|
|
@@ -74,7 +74,7 @@ export default class SplitOperation extends Operation {
|
|
|
74
74
|
get moveTargetPosition() {
|
|
75
75
|
const path = this.insertionPosition.path.slice();
|
|
76
76
|
path.push(0);
|
|
77
|
-
return new
|
|
77
|
+
return new ModelPosition(this.insertionPosition.root, path);
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Artificial range that contains all the nodes from the split element that will be moved to the new element.
|
|
@@ -82,7 +82,7 @@ export default class SplitOperation extends Operation {
|
|
|
82
82
|
*/
|
|
83
83
|
get movedRange() {
|
|
84
84
|
const end = this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);
|
|
85
|
-
return new
|
|
85
|
+
return new ModelRange(this.splitPosition, end);
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* @inheritDoc
|
|
@@ -90,11 +90,11 @@ export default class SplitOperation extends Operation {
|
|
|
90
90
|
get affectedSelectable() {
|
|
91
91
|
// These could be positions but `Selectable` type only supports `Iterable<Range>`.
|
|
92
92
|
const ranges = [
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
ModelRange._createFromPositionAndShift(this.splitPosition, 0),
|
|
94
|
+
ModelRange._createFromPositionAndShift(this.insertionPosition, 0)
|
|
95
95
|
];
|
|
96
96
|
if (this.graveyardPosition) {
|
|
97
|
-
ranges.push(
|
|
97
|
+
ranges.push(ModelRange._createFromPositionAndShift(this.graveyardPosition, 0));
|
|
98
98
|
}
|
|
99
99
|
return ranges;
|
|
100
100
|
}
|
|
@@ -111,7 +111,7 @@ export default class SplitOperation extends Operation {
|
|
|
111
111
|
*/
|
|
112
112
|
getReversed() {
|
|
113
113
|
const graveyard = this.splitPosition.root.document.graveyard;
|
|
114
|
-
const graveyardPosition = new
|
|
114
|
+
const graveyardPosition = new ModelPosition(graveyard, [0]);
|
|
115
115
|
return new MergeOperation(this.moveTargetPosition, this.howMany, this.splitPosition, graveyardPosition, this.baseVersion + 1);
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
@@ -162,13 +162,13 @@ export default class SplitOperation extends Operation {
|
|
|
162
162
|
_execute() {
|
|
163
163
|
const splitElement = this.splitPosition.parent;
|
|
164
164
|
if (this.graveyardPosition) {
|
|
165
|
-
_move(
|
|
165
|
+
_move(ModelRange._createFromPositionAndShift(this.graveyardPosition, 1), this.insertionPosition);
|
|
166
166
|
}
|
|
167
167
|
else {
|
|
168
168
|
const newElement = splitElement._clone();
|
|
169
169
|
_insert(this.insertionPosition, newElement);
|
|
170
170
|
}
|
|
171
|
-
const sourceRange = new
|
|
171
|
+
const sourceRange = new ModelRange(ModelPosition._createAt(splitElement, this.splitPosition.offset), ModelPosition._createAt(splitElement, splitElement.maxOffset));
|
|
172
172
|
_move(sourceRange, this.moveTargetPosition);
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
@@ -196,7 +196,7 @@ export default class SplitOperation extends Operation {
|
|
|
196
196
|
static getInsertionPosition(splitPosition) {
|
|
197
197
|
const path = splitPosition.path.slice(0, -1);
|
|
198
198
|
path[path.length - 1]++;
|
|
199
|
-
return new
|
|
199
|
+
return new ModelPosition(splitPosition.root, path, 'toPrevious');
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
202
|
* Creates `SplitOperation` object from deserialized object, i.e. from parsed JSON string.
|
|
@@ -205,9 +205,9 @@ export default class SplitOperation extends Operation {
|
|
|
205
205
|
* @param document Document on which this operation will be applied.
|
|
206
206
|
*/
|
|
207
207
|
static fromJSON(json, document) {
|
|
208
|
-
const splitPosition =
|
|
209
|
-
const insertionPosition =
|
|
210
|
-
const graveyardPosition = json.graveyardPosition ?
|
|
208
|
+
const splitPosition = ModelPosition.fromJSON(json.splitPosition, document);
|
|
209
|
+
const insertionPosition = ModelPosition.fromJSON(json.insertionPosition, document);
|
|
210
|
+
const graveyardPosition = json.graveyardPosition ? ModelPosition.fromJSON(json.graveyardPosition, document) : null;
|
|
211
211
|
return new this(splitPosition, json.howMany, insertionPosition, graveyardPosition, json.baseVersion);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
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 Operation from './operation.js';
|
|
6
|
-
import type
|
|
5
|
+
import { type Operation } from './operation.js';
|
|
6
|
+
import { type ModelDocument } from '../document.js';
|
|
7
7
|
/**
|
|
8
8
|
* Transforms operation `a` by operation `b`.
|
|
9
9
|
*
|
|
@@ -11,6 +11,7 @@ import type Document from '../document.js';
|
|
|
11
11
|
* @param b Operation to transform by.
|
|
12
12
|
* @param context Transformation context for this transformation.
|
|
13
13
|
* @returns Transformation result.
|
|
14
|
+
* @internal
|
|
14
15
|
*/
|
|
15
16
|
export declare function transform(a: Operation, b: Operation, context?: TransformationContext): Array<Operation>;
|
|
16
17
|
/**
|
|
@@ -18,7 +19,7 @@ export declare function transform(a: Operation, b: Operation, context?: Transfor
|
|
|
18
19
|
* both transformed `operationsA` and transformed `operationsB` are returned.
|
|
19
20
|
*
|
|
20
21
|
* Note, that the first operation in each set should base on the same document state (
|
|
21
|
-
* {@link module:engine/model/document~
|
|
22
|
+
* {@link module:engine/model/document~ModelDocument#version document version}).
|
|
22
23
|
*
|
|
23
24
|
* It is assumed that `operationsA` are "more important" during conflict resolution between two operations.
|
|
24
25
|
*
|
|
@@ -47,16 +48,16 @@ export declare function transform(a: Operation, b: Operation, context?: Transfor
|
|
|
47
48
|
* so the removed nodes won't end up back in the document root. When set to `true`, context data will be used.
|
|
48
49
|
* @returns Transformation result.
|
|
49
50
|
*/
|
|
50
|
-
export declare function
|
|
51
|
-
document:
|
|
51
|
+
export declare function transformOperationSets(operationsA: Array<Operation>, operationsB: Array<Operation>, options: {
|
|
52
|
+
document: ModelDocument;
|
|
52
53
|
useRelations?: boolean;
|
|
53
54
|
padWithNoOps?: boolean;
|
|
54
55
|
forceWeakRemove?: boolean;
|
|
55
|
-
}):
|
|
56
|
+
}): TransformOperationSetsResult;
|
|
56
57
|
/**
|
|
57
|
-
* The result of {@link module:engine/model/operation/transform~
|
|
58
|
+
* The result of {@link module:engine/model/operation/transform~transformOperationSets}.
|
|
58
59
|
*/
|
|
59
|
-
export interface
|
|
60
|
+
export interface TransformOperationSetsResult {
|
|
60
61
|
/**
|
|
61
62
|
* Transformed `operationsA`.
|
|
62
63
|
*/
|
|
@@ -74,6 +75,8 @@ export interface TransformSetsResult {
|
|
|
74
75
|
/**
|
|
75
76
|
* Holds additional contextual information about a transformed pair of operations (`a` and `b`). Those information
|
|
76
77
|
* can be used for better conflict resolving.
|
|
78
|
+
*
|
|
79
|
+
* @internal
|
|
77
80
|
*/
|
|
78
81
|
export type TransformationContext = {
|
|
79
82
|
/**
|