@ckeditor/ckeditor5-engine 41.2.0 → 41.3.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.
Files changed (134) hide show
  1. package/dist/content-index.css +4 -0
  2. package/dist/editor-index.css +23 -0
  3. package/dist/index.css +49 -0
  4. package/dist/index.css.map +1 -0
  5. package/dist/index.js +36728 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/types/controller/datacontroller.d.ts +335 -0
  8. package/dist/types/controller/editingcontroller.d.ts +98 -0
  9. package/dist/types/conversion/conversion.d.ts +478 -0
  10. package/dist/types/conversion/conversionhelpers.d.ts +26 -0
  11. package/dist/types/conversion/downcastdispatcher.d.ts +562 -0
  12. package/dist/types/conversion/downcasthelpers.d.ts +1190 -0
  13. package/dist/types/conversion/mapper.d.ts +503 -0
  14. package/dist/types/conversion/modelconsumable.d.ts +201 -0
  15. package/dist/types/conversion/upcastdispatcher.d.ts +492 -0
  16. package/dist/types/conversion/upcasthelpers.d.ts +499 -0
  17. package/dist/types/conversion/viewconsumable.d.ts +369 -0
  18. package/dist/types/dataprocessor/basichtmlwriter.d.ts +18 -0
  19. package/dist/types/dataprocessor/dataprocessor.d.ts +61 -0
  20. package/dist/types/dataprocessor/htmldataprocessor.d.ts +76 -0
  21. package/dist/types/dataprocessor/htmlwriter.d.ts +16 -0
  22. package/dist/types/dataprocessor/xmldataprocessor.d.ts +90 -0
  23. package/dist/types/dev-utils/model.d.ts +124 -0
  24. package/dist/types/dev-utils/operationreplayer.d.ts +51 -0
  25. package/dist/types/dev-utils/utils.d.ts +37 -0
  26. package/dist/types/dev-utils/view.d.ts +319 -0
  27. package/dist/types/index.d.ts +113 -0
  28. package/dist/types/model/batch.d.ts +106 -0
  29. package/dist/types/model/differ.d.ts +415 -0
  30. package/dist/types/model/document.d.ts +274 -0
  31. package/dist/types/model/documentfragment.d.ts +200 -0
  32. package/dist/types/model/documentselection.d.ts +420 -0
  33. package/dist/types/model/element.d.ts +165 -0
  34. package/dist/types/model/history.d.ts +114 -0
  35. package/dist/types/model/item.d.ts +14 -0
  36. package/dist/types/model/liveposition.d.ts +77 -0
  37. package/dist/types/model/liverange.d.ts +102 -0
  38. package/dist/types/model/markercollection.d.ts +335 -0
  39. package/dist/types/model/model.d.ts +919 -0
  40. package/dist/types/model/node.d.ts +255 -0
  41. package/dist/types/model/nodelist.d.ts +91 -0
  42. package/dist/types/model/operation/attributeoperation.d.ts +103 -0
  43. package/dist/types/model/operation/detachoperation.d.ts +60 -0
  44. package/dist/types/model/operation/insertoperation.d.ts +90 -0
  45. package/dist/types/model/operation/markeroperation.d.ts +91 -0
  46. package/dist/types/model/operation/mergeoperation.d.ts +100 -0
  47. package/dist/types/model/operation/moveoperation.d.ts +96 -0
  48. package/dist/types/model/operation/nooperation.d.ts +38 -0
  49. package/dist/types/model/operation/operation.d.ts +96 -0
  50. package/dist/types/model/operation/operationfactory.d.ts +18 -0
  51. package/dist/types/model/operation/renameoperation.d.ts +83 -0
  52. package/dist/types/model/operation/rootattributeoperation.d.ts +98 -0
  53. package/dist/types/model/operation/rootoperation.d.ts +76 -0
  54. package/dist/types/model/operation/splitoperation.d.ts +109 -0
  55. package/dist/types/model/operation/transform.d.ts +100 -0
  56. package/dist/types/model/operation/utils.d.ts +71 -0
  57. package/dist/types/model/position.d.ts +538 -0
  58. package/dist/types/model/range.d.ts +458 -0
  59. package/dist/types/model/rootelement.d.ts +60 -0
  60. package/dist/types/model/schema.d.ts +1206 -0
  61. package/dist/types/model/selection.d.ts +482 -0
  62. package/dist/types/model/text.d.ts +66 -0
  63. package/dist/types/model/textproxy.d.ts +144 -0
  64. package/dist/types/model/treewalker.d.ts +186 -0
  65. package/dist/types/model/typecheckable.d.ts +285 -0
  66. package/dist/types/model/utils/autoparagraphing.d.ts +37 -0
  67. package/dist/types/model/utils/deletecontent.d.ts +58 -0
  68. package/dist/types/model/utils/getselectedcontent.d.ts +30 -0
  69. package/dist/types/model/utils/insertcontent.d.ts +46 -0
  70. package/dist/types/model/utils/insertobject.d.ts +47 -0
  71. package/dist/types/model/utils/modifyselection.d.ts +48 -0
  72. package/dist/types/model/utils/selection-post-fixer.d.ts +74 -0
  73. package/dist/types/model/writer.d.ts +851 -0
  74. package/dist/types/view/attributeelement.d.ts +108 -0
  75. package/dist/types/view/containerelement.d.ts +49 -0
  76. package/dist/types/view/datatransfer.d.ts +79 -0
  77. package/dist/types/view/document.d.ts +184 -0
  78. package/dist/types/view/documentfragment.d.ts +153 -0
  79. package/dist/types/view/documentselection.d.ts +306 -0
  80. package/dist/types/view/domconverter.d.ts +652 -0
  81. package/dist/types/view/downcastwriter.d.ts +996 -0
  82. package/dist/types/view/editableelement.d.ts +62 -0
  83. package/dist/types/view/element.d.ts +468 -0
  84. package/dist/types/view/elementdefinition.d.ts +87 -0
  85. package/dist/types/view/emptyelement.d.ts +41 -0
  86. package/dist/types/view/filler.d.ts +111 -0
  87. package/dist/types/view/item.d.ts +14 -0
  88. package/dist/types/view/matcher.d.ts +486 -0
  89. package/dist/types/view/node.d.ts +162 -0
  90. package/dist/types/view/observer/arrowkeysobserver.d.ts +45 -0
  91. package/dist/types/view/observer/bubblingemittermixin.d.ts +166 -0
  92. package/dist/types/view/observer/bubblingeventinfo.d.ts +47 -0
  93. package/dist/types/view/observer/clickobserver.d.ts +43 -0
  94. package/dist/types/view/observer/compositionobserver.d.ts +82 -0
  95. package/dist/types/view/observer/domeventdata.d.ts +50 -0
  96. package/dist/types/view/observer/domeventobserver.d.ts +73 -0
  97. package/dist/types/view/observer/fakeselectionobserver.d.ts +47 -0
  98. package/dist/types/view/observer/focusobserver.d.ts +82 -0
  99. package/dist/types/view/observer/inputobserver.d.ts +86 -0
  100. package/dist/types/view/observer/keyobserver.d.ts +66 -0
  101. package/dist/types/view/observer/mouseobserver.d.ts +89 -0
  102. package/dist/types/view/observer/mutationobserver.d.ts +86 -0
  103. package/dist/types/view/observer/observer.d.ts +89 -0
  104. package/dist/types/view/observer/selectionobserver.d.ts +148 -0
  105. package/dist/types/view/observer/tabobserver.d.ts +46 -0
  106. package/dist/types/view/placeholder.d.ts +96 -0
  107. package/dist/types/view/position.d.ts +188 -0
  108. package/dist/types/view/range.d.ts +279 -0
  109. package/dist/types/view/rawelement.d.ts +73 -0
  110. package/dist/types/view/renderer.d.ts +265 -0
  111. package/dist/types/view/rooteditableelement.d.ts +41 -0
  112. package/dist/types/view/selection.d.ts +375 -0
  113. package/dist/types/view/styles/background.d.ts +33 -0
  114. package/dist/types/view/styles/border.d.ts +43 -0
  115. package/dist/types/view/styles/margin.d.ts +29 -0
  116. package/dist/types/view/styles/padding.d.ts +29 -0
  117. package/dist/types/view/styles/utils.d.ts +93 -0
  118. package/dist/types/view/stylesmap.d.ts +673 -0
  119. package/dist/types/view/text.d.ts +74 -0
  120. package/dist/types/view/textproxy.d.ts +97 -0
  121. package/dist/types/view/treewalker.d.ts +195 -0
  122. package/dist/types/view/typecheckable.d.ts +448 -0
  123. package/dist/types/view/uielement.d.ts +96 -0
  124. package/dist/types/view/upcastwriter.d.ts +417 -0
  125. package/dist/types/view/view.d.ts +487 -0
  126. package/package.json +3 -2
  127. package/src/model/node.d.ts +0 -1
  128. package/src/model/node.js +0 -2
  129. package/src/model/position.d.ts +0 -1
  130. package/src/model/position.js +0 -2
  131. package/src/view/node.d.ts +0 -1
  132. package/src/view/node.js +0 -2
  133. package/src/view/position.d.ts +0 -1
  134. package/src/view/position.js +0 -2
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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/mergeoperation
7
+ */
8
+ import Operation from './operation.js';
9
+ import Position from '../position.js';
10
+ import Range from '../range.js';
11
+ import type Document from '../document.js';
12
+ import type { Selectable } from '../selection.js';
13
+ /**
14
+ * Operation to merge two {@link module:engine/model/element~Element elements}.
15
+ *
16
+ * The merged element is the parent of {@link ~MergeOperation#sourcePosition} and it is merged into the parent of
17
+ * {@link ~MergeOperation#targetPosition}. All nodes from the merged element are moved to {@link ~MergeOperation#targetPosition}.
18
+ *
19
+ * The merged element is moved to the graveyard at {@link ~MergeOperation#graveyardPosition}.
20
+ */
21
+ export default class MergeOperation extends Operation {
22
+ /**
23
+ * Position inside the merged element. All nodes from that element after that position will be moved to {@link #targetPosition}.
24
+ */
25
+ sourcePosition: Position;
26
+ /**
27
+ * Summary offset size of nodes which will be moved from the merged element to the new parent.
28
+ */
29
+ howMany: number;
30
+ /**
31
+ * Position which the nodes from the merged elements will be moved to.
32
+ */
33
+ targetPosition: Position;
34
+ /**
35
+ * Position in graveyard to which the merged element will be moved.
36
+ */
37
+ graveyardPosition: Position;
38
+ /**
39
+ * Creates a merge operation.
40
+ *
41
+ * @param sourcePosition Position inside the merged element. All nodes from that
42
+ * element after that position will be moved to {@link #targetPosition}.
43
+ * @param howMany Summary offset size of nodes which will be moved from the merged element to the new parent.
44
+ * @param targetPosition Position which the nodes from the merged elements will be moved to.
45
+ * @param graveyardPosition Position in graveyard to which the merged element will be moved.
46
+ * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
47
+ * can be applied or `null` if the operation operates on detached (non-document) tree.
48
+ */
49
+ constructor(sourcePosition: Position, howMany: number, targetPosition: Position, graveyardPosition: Position, baseVersion: number | null);
50
+ /**
51
+ * @inheritDoc
52
+ */
53
+ get type(): 'merge';
54
+ /**
55
+ * Position before the merged element (which will be deleted).
56
+ */
57
+ get deletionPosition(): Position;
58
+ /**
59
+ * Artificial range that contains all the nodes from the merged element that will be moved to {@link ~MergeOperation#sourcePosition}.
60
+ * The range starts at {@link ~MergeOperation#sourcePosition} and ends in the same parent, at `POSITIVE_INFINITY` offset.
61
+ */
62
+ get movedRange(): Range;
63
+ /**
64
+ * @inheritDoc
65
+ */
66
+ get affectedSelectable(): Selectable;
67
+ /**
68
+ * Creates and returns an operation that has the same parameters as this operation.
69
+ */
70
+ clone(): MergeOperation;
71
+ /**
72
+ * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
73
+ */
74
+ getReversed(): Operation;
75
+ /**
76
+ * @inheritDoc
77
+ * @internal
78
+ */
79
+ _validate(): void;
80
+ /**
81
+ * @inheritDoc
82
+ * @internal
83
+ */
84
+ _execute(): void;
85
+ /**
86
+ * @inheritDoc
87
+ */
88
+ toJSON(): unknown;
89
+ /**
90
+ * @inheritDoc
91
+ */
92
+ static get className(): string;
93
+ /**
94
+ * Creates `MergeOperation` object from deserialized object, i.e. from parsed JSON string.
95
+ *
96
+ * @param json Deserialized JSON object.
97
+ * @param document Document on which this operation will be applied.
98
+ */
99
+ static fromJSON(json: any, document: Document): MergeOperation;
100
+ }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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/moveoperation
7
+ */
8
+ import Operation from './operation.js';
9
+ import Position from '../position.js';
10
+ import type { Selectable } from '../selection.js';
11
+ import type Document from '../document.js';
12
+ /**
13
+ * Operation to move a range of {@link module:engine/model/item~Item model items}
14
+ * to given {@link module:engine/model/position~Position target position}.
15
+ */
16
+ export default class MoveOperation extends Operation {
17
+ /**
18
+ * Position before the first {@link module:engine/model/item~Item model item} to move.
19
+ */
20
+ sourcePosition: Position;
21
+ /**
22
+ * Offset size of moved range.
23
+ */
24
+ howMany: number;
25
+ /**
26
+ * Position at which moved nodes will be inserted.
27
+ */
28
+ targetPosition: Position;
29
+ /**
30
+ * Creates a move operation.
31
+ *
32
+ * @param sourcePosition Position before the first {@link module:engine/model/item~Item model item} to move.
33
+ * @param howMany Offset size of moved range. Moved range will start from `sourcePosition` and end at
34
+ * `sourcePosition` with offset shifted by `howMany`.
35
+ * @param targetPosition Position at which moved nodes will be inserted.
36
+ * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
37
+ * can be applied or `null` if the operation operates on detached (non-document) tree.
38
+ */
39
+ constructor(sourcePosition: Position, howMany: number, targetPosition: Position, baseVersion: number | null);
40
+ /**
41
+ * @inheritDoc
42
+ */
43
+ get type(): 'move' | 'remove' | 'reinsert';
44
+ /**
45
+ * @inheritDoc
46
+ */
47
+ get affectedSelectable(): Selectable;
48
+ /**
49
+ * Creates and returns an operation that has the same parameters as this operation.
50
+ */
51
+ clone(): MoveOperation;
52
+ /**
53
+ * Returns the start position of the moved range after it got moved. This may be different than
54
+ * {@link module:engine/model/operation/moveoperation~MoveOperation#targetPosition} in some cases, i.e. when a range is moved
55
+ * inside the same parent but {@link module:engine/model/operation/moveoperation~MoveOperation#targetPosition targetPosition}
56
+ * is after {@link module:engine/model/operation/moveoperation~MoveOperation#sourcePosition sourcePosition}.
57
+ *
58
+ * ```
59
+ * vv vv
60
+ * abcdefg ===> adefbcg
61
+ * ^ ^
62
+ * targetPos movedRangeStart
63
+ * offset 6 offset 4
64
+ *```
65
+ */
66
+ getMovedRangeStart(): Position;
67
+ /**
68
+ * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
69
+ */
70
+ getReversed(): Operation;
71
+ /**
72
+ * @inheritDoc
73
+ * @internal
74
+ */
75
+ _validate(): void;
76
+ /**
77
+ * @inheritDoc
78
+ * @internal
79
+ */
80
+ _execute(): void;
81
+ /**
82
+ * @inheritDoc
83
+ */
84
+ toJSON(): unknown;
85
+ /**
86
+ * @inheritDoc
87
+ */
88
+ static get className(): string;
89
+ /**
90
+ * Creates `MoveOperation` object from deserialized object, i.e. from parsed JSON string.
91
+ *
92
+ * @param json Deserialized JSON object.
93
+ * @param document Document on which this operation will be applied.
94
+ */
95
+ static fromJSON(json: any, document: Document): MoveOperation;
96
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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/nooperation
7
+ */
8
+ import Operation from './operation.js';
9
+ import type { Selectable } from '../selection.js';
10
+ /**
11
+ * Operation which is doing nothing ("empty operation", "do-nothing operation", "noop"). This is an operation,
12
+ * which when executed does not change the tree model. It still has some parameters defined for transformation purposes.
13
+ *
14
+ * In most cases this operation is a result of transforming operations. When transformation returns
15
+ * {@link module:engine/model/operation/nooperation~NoOperation} it means that changes done by the transformed operation
16
+ * have already been applied.
17
+ */
18
+ export default class NoOperation extends Operation {
19
+ get type(): 'noop';
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ get affectedSelectable(): Selectable;
24
+ /**
25
+ * Creates and returns an operation that has the same parameters as this operation.
26
+ */
27
+ clone(): NoOperation;
28
+ /**
29
+ * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
30
+ */
31
+ getReversed(): Operation;
32
+ /** @internal */
33
+ _execute(): void;
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ static get className(): string;
38
+ }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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/operation
7
+ */
8
+ import type Batch from '../batch.js';
9
+ import type Document from '../document.js';
10
+ import type { Selectable } from '../selection.js';
11
+ /**
12
+ * Abstract base operation class.
13
+ */
14
+ export default abstract class Operation {
15
+ /**
16
+ * {@link module:engine/model/document~Document#version} on which operation can be applied. If you try to
17
+ * {@link module:engine/model/model~Model#applyOperation apply} operation with different base version than the
18
+ * {@link module:engine/model/document~Document#version document version} the
19
+ * {@link module:utils/ckeditorerror~CKEditorError model-document-applyOperation-wrong-version} error is thrown.
20
+ */
21
+ baseVersion: number | null;
22
+ /**
23
+ * Defines whether operation is executed on attached or detached {@link module:engine/model/item~Item items}.
24
+ */
25
+ readonly isDocumentOperation: boolean;
26
+ /**
27
+ * {@link module:engine/model/batch~Batch Batch} to which the operation is added or `null` if the operation is not
28
+ * added to any batch yet.
29
+ */
30
+ batch: Batch | null;
31
+ /**
32
+ * Operation type.
33
+ */
34
+ abstract readonly type: string;
35
+ /**
36
+ * Base operation constructor.
37
+ *
38
+ * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
39
+ * can be applied or `null` if the operation operates on detached (non-document) tree.
40
+ */
41
+ constructor(baseVersion: number | null);
42
+ /**
43
+ * A selectable that will be affected by the operation after it is executed.
44
+ *
45
+ * The exact returned parameter differs between operation types.
46
+ */
47
+ abstract get affectedSelectable(): Selectable;
48
+ /**
49
+ * Creates and returns an operation that has the same parameters as this operation.
50
+ *
51
+ * @returns Clone of this operation.
52
+ */
53
+ abstract clone(): Operation;
54
+ /**
55
+ * Creates and returns a reverse operation. Reverse operation when executed right after
56
+ * the original operation will bring back tree model state to the point before the original
57
+ * operation execution. In other words, it reverses changes done by the original operation.
58
+ *
59
+ * Keep in mind that tree model state may change since executing the original operation,
60
+ * so reverse operation will be "outdated". In that case you will need to transform it by
61
+ * all operations that were executed after the original operation.
62
+ *
63
+ * @returns Reversed operation.
64
+ */
65
+ abstract getReversed(): Operation;
66
+ /**
67
+ * Executes the operation - modifications described by the operation properties will be applied to the model tree.
68
+ *
69
+ * @internal
70
+ */
71
+ abstract _execute(): void;
72
+ /**
73
+ * Checks whether the operation's parameters are correct and the operation can be correctly executed. Throws
74
+ * an error if operation is not valid.
75
+ *
76
+ * @internal
77
+ */
78
+ _validate(): void;
79
+ /**
80
+ * Custom toJSON method to solve child-parent circular dependencies.
81
+ *
82
+ * @returns Clone of this object with the operation property replaced with string.
83
+ */
84
+ toJSON(): unknown;
85
+ /**
86
+ * Name of the operation class used for serialization.
87
+ */
88
+ static get className(): string;
89
+ /**
90
+ * Creates `Operation` object from deserialized object, i.e. from parsed JSON string.
91
+ *
92
+ * @param json Deserialized JSON object.
93
+ * @param doc Document on which this operation will be applied.
94
+ */
95
+ static fromJSON(json: any, document: Document): Operation;
96
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ import Operation from './operation.js';
6
+ import type Document from '../document.js';
7
+ /**
8
+ * A factory class for creating operations.
9
+ */
10
+ export default abstract class OperationFactory {
11
+ /**
12
+ * Creates an operation instance from a JSON object (parsed JSON string).
13
+ *
14
+ * @param json Deserialized JSON object.
15
+ * @param document Document on which this operation will be applied.
16
+ */
17
+ static fromJSON(json: any, document: Document): Operation;
18
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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/renameoperation
7
+ */
8
+ import Operation from './operation.js';
9
+ import Position from '../position.js';
10
+ import type Document from '../document.js';
11
+ import type { Selectable } from '../selection.js';
12
+ /**
13
+ * Operation to change element's name.
14
+ *
15
+ * Using this class you can change element's name.
16
+ */
17
+ export default class RenameOperation extends Operation {
18
+ /**
19
+ * Position before an element to change.
20
+ */
21
+ position: Position;
22
+ /**
23
+ * Current name of the element.
24
+ */
25
+ oldName: string;
26
+ /**
27
+ * New name for the element.
28
+ */
29
+ newName: string;
30
+ /**
31
+ * Creates an operation that changes element's name.
32
+ *
33
+ * @param position Position before an element to change.
34
+ * @param oldName Current name of the element.
35
+ * @param newName New name for the element.
36
+ * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
37
+ * can be applied or `null` if the operation operates on detached (non-document) tree.
38
+ */
39
+ constructor(position: Position, oldName: string, newName: string, baseVersion: number | null);
40
+ /**
41
+ * @inheritDoc
42
+ */
43
+ get type(): 'rename';
44
+ /**
45
+ * @inheritDoc
46
+ */
47
+ get affectedSelectable(): Selectable;
48
+ /**
49
+ * Creates and returns an operation that has the same parameters as this operation.
50
+ *
51
+ * @returns Clone of this operation.
52
+ */
53
+ clone(): RenameOperation;
54
+ /**
55
+ * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
56
+ */
57
+ getReversed(): Operation;
58
+ /**
59
+ * @inheritDoc
60
+ * @internal
61
+ */
62
+ _validate(): void;
63
+ /**
64
+ * @inheritDoc
65
+ * @internal
66
+ */
67
+ _execute(): void;
68
+ /**
69
+ * @inheritDoc
70
+ */
71
+ toJSON(): unknown;
72
+ /**
73
+ * @inheritDoc
74
+ */
75
+ static get className(): string;
76
+ /**
77
+ * Creates `RenameOperation` object from deserialized object, i.e. from parsed JSON string.
78
+ *
79
+ * @param json Deserialized JSON object.
80
+ * @param document Document on which this operation will be applied.
81
+ */
82
+ static fromJSON(json: any, document: Document): RenameOperation;
83
+ }
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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/rootattributeoperation
7
+ */
8
+ import Operation from './operation.js';
9
+ import type Document from '../document.js';
10
+ import type RootElement from '../rootelement.js';
11
+ import type { Selectable } from '../selection.js';
12
+ /**
13
+ * Operation to change root element's attribute. Using this class you can add, remove or change value of the attribute.
14
+ *
15
+ * This operation is needed, because root elements can't be changed through
16
+ * {@link module:engine/model/operation/attributeoperation~AttributeOperation}.
17
+ * It is because {@link module:engine/model/operation/attributeoperation~AttributeOperation}
18
+ * requires a range to change and root element can't
19
+ * be a part of range because every {@link module:engine/model/position~Position} has to be inside a root.
20
+ * {@link module:engine/model/position~Position} can't be created before a root element.
21
+ */
22
+ export default class RootAttributeOperation extends Operation {
23
+ /**
24
+ * Root element to change.
25
+ */
26
+ readonly root: RootElement;
27
+ /**
28
+ * Key of an attribute to change or remove.
29
+ */
30
+ readonly key: string;
31
+ /**
32
+ * Old value of the attribute with given key or `null`, if attribute was not set before.
33
+ *
34
+ * @readonly
35
+ */
36
+ oldValue: unknown;
37
+ /**
38
+ * New value of the attribute with given key or `null`, if operation should remove attribute.
39
+ *
40
+ * @readonly
41
+ */
42
+ newValue: unknown;
43
+ /**
44
+ * Creates an operation that changes, removes or adds attributes on root element.
45
+ *
46
+ * @see module:engine/model/operation/attributeoperation~AttributeOperation
47
+ * @param root Root element to change.
48
+ * @param key Key of an attribute to change or remove.
49
+ * @param oldValue Old value of the attribute with given key or `null`, if attribute was not set before.
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~Document#version} on which operation
52
+ * can be applied or `null` if the operation operates on detached (non-document) tree.
53
+ */
54
+ constructor(root: RootElement, key: string, oldValue: unknown, newValue: unknown, baseVersion: number | null);
55
+ /**
56
+ * @inheritDoc
57
+ */
58
+ get type(): 'addRootAttribute' | 'removeRootAttribute' | 'changeRootAttribute';
59
+ /**
60
+ * @inheritDoc
61
+ */
62
+ get affectedSelectable(): Selectable;
63
+ /**
64
+ * Creates and returns an operation that has the same parameters as this operation.
65
+ *
66
+ * @returns Clone of this operation.
67
+ */
68
+ clone(): RootAttributeOperation;
69
+ /**
70
+ * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
71
+ */
72
+ getReversed(): Operation;
73
+ /**
74
+ * @inheritDoc
75
+ * @internal
76
+ */
77
+ _validate(): void;
78
+ /**
79
+ * @inheritDoc
80
+ * @internal
81
+ */
82
+ _execute(): void;
83
+ /**
84
+ * @inheritDoc
85
+ */
86
+ toJSON(): unknown;
87
+ /**
88
+ * @inheritDoc
89
+ */
90
+ static get className(): string;
91
+ /**
92
+ * Creates `RootAttributeOperation` object from deserialized 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): RootAttributeOperation;
98
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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/rootoperation
7
+ */
8
+ import Operation from './operation.js';
9
+ import type Document from '../document.js';
10
+ import type { Selectable } from '../selection.js';
11
+ /**
12
+ * Operation that creates (or attaches) or detaches a root element.
13
+ */
14
+ export default class RootOperation extends Operation {
15
+ /**
16
+ * Root name to create or detach.
17
+ */
18
+ readonly rootName: string;
19
+ /**
20
+ * Root element name.
21
+ */
22
+ readonly elementName: string;
23
+ /**
24
+ * Specifies whether the operation adds (`true`) or detaches the root (`false`).
25
+ */
26
+ readonly isAdd: boolean;
27
+ /**
28
+ * Document which owns the root.
29
+ */
30
+ private readonly _document;
31
+ /**
32
+ * Creates an operation that creates or removes a root element.
33
+ *
34
+ * @param rootName Root name to create or detach.
35
+ * @param elementName Root element name.
36
+ * @param isAdd Specifies whether the operation adds (`true`) or detaches the root (`false`).
37
+ * @param document Document which owns the root.
38
+ * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation can be applied.
39
+ */
40
+ constructor(rootName: string, elementName: string, isAdd: boolean, document: Document, baseVersion: number);
41
+ /**
42
+ * @inheritDoc
43
+ */
44
+ get type(): 'addRoot' | 'detachRoot';
45
+ /**
46
+ * @inheritDoc
47
+ */
48
+ get affectedSelectable(): Selectable;
49
+ /**
50
+ * @inheritDoc
51
+ */
52
+ clone(): RootOperation;
53
+ /**
54
+ * @inheritDoc
55
+ */
56
+ getReversed(): RootOperation;
57
+ /**
58
+ * @inheritDoc
59
+ */
60
+ _execute(): void;
61
+ /**
62
+ * @inheritDoc
63
+ */
64
+ toJSON(): unknown;
65
+ /**
66
+ * @inheritDoc
67
+ */
68
+ static get className(): string;
69
+ /**
70
+ * Creates `RootOperation` object from deserialized object, i.e. from parsed JSON string.
71
+ *
72
+ * @param json Deserialized JSON object.
73
+ * @param document Document on which this operation will be applied.
74
+ */
75
+ static fromJSON(json: any, document: Document): RootOperation;
76
+ }