@ckeditor/ckeditor5-engine 35.4.0 → 36.0.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 (123) hide show
  1. package/LICENSE.md +1 -1
  2. package/package.json +22 -22
  3. package/src/controller/datacontroller.js +5 -1
  4. package/src/controller/editingcontroller.js +1 -1
  5. package/src/conversion/conversion.js +1 -1
  6. package/src/conversion/conversionhelpers.js +1 -1
  7. package/src/conversion/downcastdispatcher.js +1 -1
  8. package/src/conversion/downcasthelpers.js +1 -1
  9. package/src/conversion/mapper.js +1 -1
  10. package/src/conversion/modelconsumable.js +1 -1
  11. package/src/conversion/upcastdispatcher.js +1 -1
  12. package/src/conversion/upcasthelpers.js +8 -1
  13. package/src/conversion/viewconsumable.js +1 -1
  14. package/src/dataprocessor/basichtmlwriter.js +1 -1
  15. package/src/dataprocessor/dataprocessor.js +1 -1
  16. package/src/dataprocessor/htmldataprocessor.js +1 -2
  17. package/src/dataprocessor/htmlwriter.js +1 -1
  18. package/src/dataprocessor/xmldataprocessor.js +1 -1
  19. package/src/dev-utils/model.js +1 -1
  20. package/src/dev-utils/operationreplayer.js +1 -1
  21. package/src/dev-utils/utils.js +1 -1
  22. package/src/dev-utils/view.js +1 -1
  23. package/src/index.js +3 -2
  24. package/src/model/batch.js +9 -46
  25. package/src/model/differ.js +81 -174
  26. package/src/model/document.js +36 -92
  27. package/src/model/documentfragment.js +43 -96
  28. package/src/model/documentselection.js +151 -245
  29. package/src/model/element.js +47 -100
  30. package/src/model/history.js +15 -46
  31. package/src/model/item.js +1 -1
  32. package/src/model/liveposition.js +10 -36
  33. package/src/model/liverange.js +13 -36
  34. package/src/model/markercollection.js +40 -111
  35. package/src/model/model.js +212 -289
  36. package/src/model/node.js +35 -125
  37. package/src/model/nodelist.js +11 -39
  38. package/src/model/operation/attributeoperation.js +13 -44
  39. package/src/model/operation/detachoperation.js +3 -16
  40. package/src/model/operation/insertoperation.js +6 -34
  41. package/src/model/operation/markeroperation.js +9 -48
  42. package/src/model/operation/mergeoperation.js +8 -41
  43. package/src/model/operation/moveoperation.js +14 -37
  44. package/src/model/operation/nooperation.js +1 -7
  45. package/src/model/operation/operation.js +5 -63
  46. package/src/model/operation/operationfactory.js +3 -6
  47. package/src/model/operation/renameoperation.js +8 -28
  48. package/src/model/operation/rootattributeoperation.js +18 -47
  49. package/src/model/operation/splitoperation.js +9 -47
  50. package/src/model/operation/transform.js +109 -150
  51. package/src/model/operation/utils.js +36 -50
  52. package/src/model/position.js +117 -228
  53. package/src/model/range.js +145 -200
  54. package/src/model/rootelement.js +8 -47
  55. package/src/model/schema.js +236 -272
  56. package/src/model/selection.js +134 -192
  57. package/src/model/text.js +10 -37
  58. package/src/model/textproxy.js +15 -69
  59. package/src/model/treewalker.js +10 -101
  60. package/src/model/typecheckable.js +1 -1
  61. package/src/model/utils/autoparagraphing.js +11 -12
  62. package/src/model/utils/deletecontent.js +93 -62
  63. package/src/model/utils/findoptimalinsertionrange.js +24 -24
  64. package/src/model/utils/getselectedcontent.js +3 -6
  65. package/src/model/utils/insertcontent.js +36 -129
  66. package/src/model/utils/insertobject.js +19 -21
  67. package/src/model/utils/modifyselection.js +23 -33
  68. package/src/model/utils/selection-post-fixer.js +53 -59
  69. package/src/model/writer.js +208 -314
  70. package/src/view/attributeelement.js +1 -1
  71. package/src/view/containerelement.js +1 -1
  72. package/src/view/datatransfer.js +1 -1
  73. package/src/view/document.js +1 -17
  74. package/src/view/documentfragment.js +49 -1
  75. package/src/view/documentselection.js +1 -1
  76. package/src/view/domconverter.js +4 -3
  77. package/src/view/downcastwriter.js +1 -1
  78. package/src/view/editableelement.js +1 -1
  79. package/src/view/element.js +5 -5
  80. package/src/view/elementdefinition.js +1 -1
  81. package/src/view/emptyelement.js +1 -1
  82. package/src/view/filler.js +1 -1
  83. package/src/view/item.js +1 -1
  84. package/src/view/matcher.js +1 -1
  85. package/src/view/node.js +1 -1
  86. package/src/view/observer/arrowkeysobserver.js +1 -1
  87. package/src/view/observer/bubblingemittermixin.js +1 -1
  88. package/src/view/observer/bubblingeventinfo.js +1 -1
  89. package/src/view/observer/clickobserver.js +1 -1
  90. package/src/view/observer/compositionobserver.js +1 -1
  91. package/src/view/observer/domeventdata.js +1 -1
  92. package/src/view/observer/domeventobserver.js +1 -1
  93. package/src/view/observer/fakeselectionobserver.js +1 -1
  94. package/src/view/observer/focusobserver.js +22 -4
  95. package/src/view/observer/inputobserver.js +1 -1
  96. package/src/view/observer/keyobserver.js +1 -1
  97. package/src/view/observer/mouseobserver.js +1 -1
  98. package/src/view/observer/mutationobserver.js +1 -1
  99. package/src/view/observer/observer.js +1 -1
  100. package/src/view/observer/selectionobserver.js +13 -2
  101. package/src/view/observer/tabobserver.js +1 -1
  102. package/src/view/placeholder.js +1 -1
  103. package/src/view/position.js +1 -1
  104. package/src/view/range.js +1 -1
  105. package/src/view/rawelement.js +1 -1
  106. package/src/view/renderer.js +1 -14
  107. package/src/view/rooteditableelement.js +1 -1
  108. package/src/view/selection.js +1 -1
  109. package/src/view/styles/background.js +1 -1
  110. package/src/view/styles/border.js +1 -1
  111. package/src/view/styles/margin.js +1 -1
  112. package/src/view/styles/padding.js +1 -1
  113. package/src/view/styles/utils.js +1 -1
  114. package/src/view/stylesmap.js +1 -1
  115. package/src/view/text.js +1 -1
  116. package/src/view/textproxy.js +1 -1
  117. package/src/view/treewalker.js +1 -1
  118. package/src/view/typecheckable.js +1 -1
  119. package/src/view/uielement.js +1 -1
  120. package/src/view/upcastwriter.js +1 -1
  121. package/src/view/view.js +5 -5
  122. package/theme/placeholder.css +1 -1
  123. package/theme/renderer.css +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
@@ -15,42 +15,21 @@ import Element from '../element';
15
15
  import { CKEditorError } from '@ckeditor/ckeditor5-utils';
16
16
  /**
17
17
  * Operation to insert one or more nodes at given position in the model.
18
- *
19
- * @extends module:engine/model/operation/operation~Operation
20
18
  */
21
19
  export default class InsertOperation extends Operation {
22
20
  /**
23
21
  * Creates an insert operation.
24
22
  *
25
- * @param {module:engine/model/position~Position} position Position of insertion.
26
- * @param {module:engine/model/node~NodeSet} nodes The list of nodes to be inserted.
27
- * @param {Number|null} baseVersion Document {@link module:engine/model/document~Document#version} on which operation
23
+ * @param position Position of insertion.
24
+ * @param nodes The list of nodes to be inserted.
25
+ * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
28
26
  * can be applied or `null` if the operation operates on detached (non-document) tree.
29
27
  */
30
28
  constructor(position, nodes, baseVersion) {
31
29
  super(baseVersion);
32
- /**
33
- * Position of insertion.
34
- *
35
- * @readonly
36
- * @member {module:engine/model/position~Position} module:engine/model/operation/insertoperation~InsertOperation#position
37
- */
38
30
  this.position = position.clone();
39
31
  this.position.stickiness = 'toNone';
40
- /**
41
- * List of nodes to insert.
42
- *
43
- * @readonly
44
- * @member {module:engine/model/nodelist~NodeList} module:engine/model/operation/insertoperation~InsertOperation#nodeList
45
- */
46
32
  this.nodes = new NodeList(_normalizeNodes(nodes));
47
- /**
48
- * Flag deciding how the operation should be transformed. If set to `true`, nodes might get additional attributes
49
- * during operational transformation. This happens when the operation insertion position is inside of a range
50
- * where attributes have changed.
51
- *
52
- * @member {Boolean} module:engine/model/operation/insertoperation~InsertOperation#shouldReceiveAttributes
53
- */
54
33
  this.shouldReceiveAttributes = false;
55
34
  }
56
35
  /**
@@ -61,16 +40,12 @@ export default class InsertOperation extends Operation {
61
40
  }
62
41
  /**
63
42
  * Total offset size of inserted nodes.
64
- *
65
- * @returns {Number}
66
43
  */
67
44
  get howMany() {
68
45
  return this.nodes.maxOffset;
69
46
  }
70
47
  /**
71
48
  * Creates and returns an operation that has the same parameters as this operation.
72
- *
73
- * @returns {module:engine/model/operation/insertoperation~InsertOperation} Clone of this operation.
74
49
  */
75
50
  clone() {
76
51
  const nodes = new NodeList([...this.nodes].map(node => node._clone(true)));
@@ -80,8 +55,6 @@ export default class InsertOperation extends Operation {
80
55
  }
81
56
  /**
82
57
  * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
83
- *
84
- * @returns {module:engine/model/operation/moveoperation~MoveOperation}
85
58
  */
86
59
  getReversed() {
87
60
  const graveyard = this.position.root.document.graveyard;
@@ -134,9 +107,8 @@ export default class InsertOperation extends Operation {
134
107
  /**
135
108
  * Creates `InsertOperation` object from deserilized object, i.e. from parsed JSON string.
136
109
  *
137
- * @param {Object} json Deserialized JSON object.
138
- * @param {module:engine/model/document~Document} document Document on which this operation will be applied.
139
- * @returns {module:engine/model/operation/insertoperation~InsertOperation}
110
+ * @param json Deserialized JSON object.
111
+ * @param document Document on which this operation will be applied.
140
112
  */
141
113
  static fromJSON(json, document) {
142
114
  const children = [];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
@@ -7,57 +7,23 @@
7
7
  */
8
8
  import Operation from './operation';
9
9
  import Range from '../range';
10
- /**
11
- * @extends module:engine/model/operation/operation~Operation
12
- */
13
10
  export default class MarkerOperation extends Operation {
14
11
  /**
15
- * @param {String} name Marker name.
16
- * @param {module:engine/model/range~Range|null} oldRange Marker range before the change.
17
- * @param {module:engine/model/range~Range|null} newRange Marker range after the change.
18
- * @param {module:engine/model/markercollection~MarkerCollection} markers Marker collection on which change should be executed.
19
- * @param {Boolean} affectsData Specifies whether the marker operation affects the data produced by the data pipeline
12
+ * @param name Marker name.
13
+ * @param oldRange Marker range before the change.
14
+ * @param newRange Marker range after the change.
15
+ * @param markers Marker collection on which change should be executed.
16
+ * @param affectsData Specifies whether the marker operation affects the data produced by the data pipeline
20
17
  * (is persisted in the editor's data).
21
- * @param {Number|null} baseVersion Document {@link module:engine/model/document~Document#version} on which operation
18
+ * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
22
19
  * can be applied or `null` if the operation operates on detached (non-document) tree.
23
20
  */
24
21
  constructor(name, oldRange, newRange, markers, affectsData, baseVersion) {
25
22
  super(baseVersion);
26
- /**
27
- * Marker name.
28
- *
29
- * @readonly
30
- * @member {String}
31
- */
32
23
  this.name = name;
33
- /**
34
- * Marker range before the change.
35
- *
36
- * @readonly
37
- * @member {module:engine/model/range~Range|null}
38
- */
39
24
  this.oldRange = oldRange ? oldRange.clone() : null;
40
- /**
41
- * Marker range after the change.
42
- *
43
- * @readonly
44
- * @member {module:engine/model/range~Range}
45
- */
46
25
  this.newRange = newRange ? newRange.clone() : null;
47
- /**
48
- * Specifies whether the marker operation affects the data produced by the data pipeline
49
- * (is persisted in the editor's data).
50
- *
51
- * @readonly
52
- * @member {Boolean}
53
- */
54
26
  this.affectsData = affectsData;
55
- /**
56
- * Marker collection on which change should be executed.
57
- *
58
- * @private
59
- * @member {module:engine/model/markercollection~MarkerCollection}
60
- */
61
27
  this._markers = markers;
62
28
  }
63
29
  /**
@@ -68,16 +34,12 @@ export default class MarkerOperation extends Operation {
68
34
  }
69
35
  /**
70
36
  * Creates and returns an operation that has the same parameters as this operation.
71
- *
72
- * @returns {module:engine/model/operation/markeroperation~MarkerOperation} Clone of this operation.
73
37
  */
74
38
  clone() {
75
39
  return new MarkerOperation(this.name, this.oldRange, this.newRange, this._markers, this.affectsData, this.baseVersion);
76
40
  }
77
41
  /**
78
42
  * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
79
- *
80
- * @returns {module:engine/model/operation/markeroperation~MarkerOperation}
81
43
  */
82
44
  getReversed() {
83
45
  return new MarkerOperation(this.name, this.newRange, this.oldRange, this._markers, this.affectsData, this.baseVersion + 1);
@@ -118,9 +80,8 @@ export default class MarkerOperation extends Operation {
118
80
  /**
119
81
  * Creates `MarkerOperation` object from deserialized object, i.e. from parsed JSON string.
120
82
  *
121
- * @param {Object} json Deserialized JSON object.
122
- * @param {module:engine/model/document~Document} document Document on which this operation will be applied.
123
- * @returns {module:engine/model/operation/markeroperation~MarkerOperation}
83
+ * @param json Deserialized JSON object.
84
+ * @param document Document on which this operation will be applied.
124
85
  */
125
86
  static fromJSON(json, document) {
126
87
  return new MarkerOperation(json.name, json.oldRange ? Range.fromJSON(json.oldRange, document) : null, json.newRange ? Range.fromJSON(json.newRange, document) : null, document.model.markers, json.affectsData, json.baseVersion);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
@@ -18,51 +18,29 @@ import { CKEditorError } from '@ckeditor/ckeditor5-utils';
18
18
  * {@link ~MergeOperation#targetPosition}. All nodes from the merged element are moved to {@link ~MergeOperation#targetPosition}.
19
19
  *
20
20
  * The merged element is moved to the graveyard at {@link ~MergeOperation#graveyardPosition}.
21
- *
22
- * @extends module:engine/model/operation/operation~Operation
23
21
  */
24
22
  export default class MergeOperation extends Operation {
25
23
  /**
26
24
  * Creates a merge operation.
27
25
  *
28
- * @param {module:engine/model/position~Position} sourcePosition Position inside the merged element. All nodes from that
26
+ * @param sourcePosition Position inside the merged element. All nodes from that
29
27
  * element after that position will be moved to {@link ~#targetPosition}.
30
- * @param {Number} howMany Summary offset size of nodes which will be moved from the merged element to the new parent.
31
- * @param {module:engine/model/position~Position} targetPosition Position which the nodes from the merged elements will be moved to.
32
- * @param {module:engine/model/position~Position} graveyardPosition Position in graveyard to which the merged element will be moved.
33
- * @param {Number|null} baseVersion Document {@link module:engine/model/document~Document#version} on which operation
28
+ * @param howMany Summary offset size of nodes which will be moved from the merged element to the new parent.
29
+ * @param targetPosition Position which the nodes from the merged elements will be moved to.
30
+ * @param graveyardPosition Position in graveyard to which the merged element will be moved.
31
+ * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
34
32
  * can be applied or `null` if the operation operates on detached (non-document) tree.
35
33
  */
36
34
  constructor(sourcePosition, howMany, targetPosition, graveyardPosition, baseVersion) {
37
35
  super(baseVersion);
38
- /**
39
- * Position inside the merged element. All nodes from that element after that position will be moved to {@link ~#targetPosition}.
40
- *
41
- * @member {module:engine/model/position~Position} module:engine/model/operation/mergeoperation~MergeOperation#sourcePosition
42
- */
43
36
  this.sourcePosition = sourcePosition.clone();
44
37
  // This is, and should always remain, the first position in its parent.
45
38
  this.sourcePosition.stickiness = 'toPrevious';
46
- /**
47
- * Summary offset size of nodes which will be moved from the merged element to the new parent.
48
- *
49
- * @member {Number} module:engine/model/operation/mergeoperation~MergeOperation#howMany
50
- */
51
39
  this.howMany = howMany;
52
- /**
53
- * Position which the nodes from the merged elements will be moved to.
54
- *
55
- * @member {module:engine/model/position~Position} module:engine/model/operation/mergeoperation~MergeOperation#targetPosition
56
- */
57
40
  this.targetPosition = targetPosition.clone();
58
41
  // Except of a rare scenario in `MergeOperation` x `MergeOperation` transformation,
59
42
  // this is, and should always remain, the last position in its parent.
60
43
  this.targetPosition.stickiness = 'toNext';
61
- /**
62
- * Position in graveyard to which the merged element will be moved.
63
- *
64
- * @member {module:engine/model/position~Position} module:engine/model/operation/mergeoperation~MergeOperation#graveyardPosition
65
- */
66
44
  this.graveyardPosition = graveyardPosition.clone();
67
45
  }
68
46
  /**
@@ -73,9 +51,6 @@ export default class MergeOperation extends Operation {
73
51
  }
74
52
  /**
75
53
  * Position before the merged element (which will be deleted).
76
- *
77
- * @readonly
78
- * @type {module:engine/model/position~Position}
79
54
  */
80
55
  get deletionPosition() {
81
56
  return new Position(this.sourcePosition.root, this.sourcePosition.path.slice(0, -1));
@@ -83,9 +58,6 @@ export default class MergeOperation extends Operation {
83
58
  /**
84
59
  * Artificial range that contains all the nodes from the merged element that will be moved to {@link ~MergeOperation#sourcePosition}.
85
60
  * The range starts at {@link ~MergeOperation#sourcePosition} and ends in the same parent, at `POSITIVE_INFINITY` offset.
86
- *
87
- * @readonly
88
- * @type {module:engine/model/range~Range}
89
61
  */
90
62
  get movedRange() {
91
63
  const end = this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);
@@ -93,16 +65,12 @@ export default class MergeOperation extends Operation {
93
65
  }
94
66
  /**
95
67
  * Creates and returns an operation that has the same parameters as this operation.
96
- *
97
- * @returns {module:engine/model/operation/mergeoperation~MergeOperation} Clone of this operation.
98
68
  */
99
69
  clone() {
100
70
  return new MergeOperation(this.sourcePosition, this.howMany, this.targetPosition, this.graveyardPosition, this.baseVersion);
101
71
  }
102
72
  /**
103
73
  * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
104
- *
105
- * @returns {module:engine/model/operation/splitoperation~SplitOperation}
106
74
  */
107
75
  getReversed() {
108
76
  // Positions in this method are transformed by this merge operation because the split operation bases on
@@ -175,9 +143,8 @@ export default class MergeOperation extends Operation {
175
143
  /**
176
144
  * Creates `MergeOperation` object from deserilized object, i.e. from parsed JSON string.
177
145
  *
178
- * @param {Object} json Deserialized JSON object.
179
- * @param {module:engine/model/document~Document} document Document on which this operation will be applied.
180
- * @returns {module:engine/model/operation/mergeoperation~MergeOperation}
146
+ * @param json Deserialized JSON object.
147
+ * @param document Document on which this operation will be applied.
181
148
  */
182
149
  static fromJSON(json, document) {
183
150
  const sourcePosition = Position.fromJSON(json.sourcePosition, document);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
@@ -14,42 +14,24 @@ import { CKEditorError, compareArrays } from '@ckeditor/ckeditor5-utils';
14
14
  /**
15
15
  * Operation to move a range of {@link module:engine/model/item~Item model items}
16
16
  * to given {@link module:engine/model/position~Position target position}.
17
- *
18
- * @extends module:engine/model/operation/operation~Operation
19
17
  */
20
18
  export default class MoveOperation extends Operation {
21
19
  /**
22
20
  * Creates a move operation.
23
21
  *
24
- * @param {module:engine/model/position~Position} sourcePosition
25
- * Position before the first {@link module:engine/model/item~Item model item} to move.
26
- * @param {Number} howMany Offset size of moved range. Moved range will start from `sourcePosition` and end at
22
+ * @param sourcePosition Position before the first {@link module:engine/model/item~Item model item} to move.
23
+ * @param howMany Offset size of moved range. Moved range will start from `sourcePosition` and end at
27
24
  * `sourcePosition` with offset shifted by `howMany`.
28
- * @param {module:engine/model/position~Position} targetPosition Position at which moved nodes will be inserted.
29
- * @param {Number|null} baseVersion Document {@link module:engine/model/document~Document#version} on which operation
25
+ * @param targetPosition Position at which moved nodes will be inserted.
26
+ * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
30
27
  * can be applied or `null` if the operation operates on detached (non-document) tree.
31
28
  */
32
29
  constructor(sourcePosition, howMany, targetPosition, baseVersion) {
33
30
  super(baseVersion);
34
- /**
35
- * Position before the first {@link module:engine/model/item~Item model item} to move.
36
- *
37
- * @member {module:engine/model/position~Position} module:engine/model/operation/moveoperation~MoveOperation#sourcePosition
38
- */
39
31
  this.sourcePosition = sourcePosition.clone();
40
32
  // `'toNext'` because `sourcePosition` is a bit like a start of the moved range.
41
33
  this.sourcePosition.stickiness = 'toNext';
42
- /**
43
- * Offset size of moved range.
44
- *
45
- * @member {Number} module:engine/model/operation/moveoperation~MoveOperation#howMany
46
- */
47
34
  this.howMany = howMany;
48
- /**
49
- * Position at which moved nodes will be inserted.
50
- *
51
- * @member {module:engine/model/position~Position} module:engine/model/operation/moveoperation~MoveOperation#targetPosition
52
- */
53
35
  this.targetPosition = targetPosition.clone();
54
36
  this.targetPosition.stickiness = 'toNone';
55
37
  }
@@ -67,8 +49,6 @@ export default class MoveOperation extends Operation {
67
49
  }
68
50
  /**
69
51
  * Creates and returns an operation that has the same parameters as this operation.
70
- *
71
- * @returns {module:engine/model/operation/moveoperation~MoveOperation} Clone of this operation.
72
52
  */
73
53
  clone() {
74
54
  return new MoveOperation(this.sourcePosition, this.howMany, this.targetPosition, this.baseVersion);
@@ -79,21 +59,19 @@ export default class MoveOperation extends Operation {
79
59
  * inside the same parent but {@link module:engine/model/operation/moveoperation~MoveOperation#targetPosition targetPosition}
80
60
  * is after {@link module:engine/model/operation/moveoperation~MoveOperation#sourcePosition sourcePosition}.
81
61
  *
82
- * vv vv
83
- * abcdefg ===> adefbcg
84
- * ^ ^
85
- * targetPos movedRangeStart
86
- * offset 6 offset 4
87
- *
88
- * @returns {module:engine/model/position~Position}
62
+ * ```
63
+ * vv vv
64
+ * abcdefg ===> adefbcg
65
+ * ^ ^
66
+ * targetPos movedRangeStart
67
+ * offset 6 offset 4
68
+ *```
89
69
  */
90
70
  getMovedRangeStart() {
91
71
  return this.targetPosition._getTransformedByDeletion(this.sourcePosition, this.howMany);
92
72
  }
93
73
  /**
94
74
  * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
95
- *
96
- * @returns {module:engine/model/operation/moveoperation~MoveOperation}
97
75
  */
98
76
  getReversed() {
99
77
  const newTargetPosition = this.sourcePosition._getTransformedByInsertion(this.targetPosition, this.howMany);
@@ -166,9 +144,8 @@ export default class MoveOperation extends Operation {
166
144
  /**
167
145
  * Creates `MoveOperation` object from deserilized object, i.e. from parsed JSON string.
168
146
  *
169
- * @param {Object} json Deserialized JSON object.
170
- * @param {module:engine/model/document~Document} document Document on which this operation will be applied.
171
- * @returns {module:engine/model/operation/moveoperation~MoveOperation}
147
+ * @param json Deserialized JSON object.
148
+ * @param document Document on which this operation will be applied.
172
149
  */
173
150
  static fromJSON(json, document) {
174
151
  const sourcePosition = Position.fromJSON(json.sourcePosition, document);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
@@ -13,8 +13,6 @@ import Operation from './operation';
13
13
  * In most cases this operation is a result of transforming operations. When transformation returns
14
14
  * {@link module:engine/model/operation/nooperation~NoOperation} it means that changes done by the transformed operation
15
15
  * have already been applied.
16
- *
17
- * @extends module:engine/model/operation/operation~Operation
18
16
  */
19
17
  export default class NoOperation extends Operation {
20
18
  get type() {
@@ -22,16 +20,12 @@ export default class NoOperation extends Operation {
22
20
  }
23
21
  /**
24
22
  * Creates and returns an operation that has the same parameters as this operation.
25
- *
26
- * @returns {module:engine/model/operation/nooperation~NoOperation} Clone of this operation.
27
23
  */
28
24
  clone() {
29
25
  return new NoOperation(this.baseVersion);
30
26
  }
31
27
  /**
32
28
  * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
33
- *
34
- * @returns {module:engine/model/operation/nooperation~NoOperation}
35
29
  */
36
30
  getReversed() {
37
31
  return new NoOperation(this.baseVersion + 1);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
@@ -7,86 +7,31 @@
7
7
  */
8
8
  /**
9
9
  * Abstract base operation class.
10
- *
11
- * @abstract
12
10
  */
13
11
  export default class Operation {
14
12
  /**
15
13
  * Base operation constructor.
16
14
  *
17
- * @param {Number|null} baseVersion Document {@link module:engine/model/document~Document#version} on which operation
15
+ * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
18
16
  * can be applied or `null` if the operation operates on detached (non-document) tree.
19
17
  */
20
18
  constructor(baseVersion) {
21
- /**
22
- * {@link module:engine/model/document~Document#version} on which operation can be applied. If you try to
23
- * {@link module:engine/model/model~Model#applyOperation apply} operation with different base version than the
24
- * {@link module:engine/model/document~Document#version document version} the
25
- * {@link module:utils/ckeditorerror~CKEditorError model-document-applyOperation-wrong-version} error is thrown.
26
- *
27
- * @member {Number|null}
28
- */
29
19
  this.baseVersion = baseVersion;
30
- /**
31
- * Defines whether operation is executed on attached or detached {@link module:engine/model/item~Item items}.
32
- *
33
- * @readonly
34
- * @member {Boolean} #isDocumentOperation
35
- */
36
20
  this.isDocumentOperation = this.baseVersion !== null;
37
- /**
38
- * {@link module:engine/model/batch~Batch Batch} to which the operation is added or `null` if the operation is not
39
- * added to any batch yet.
40
- *
41
- * @member {module:engine/model/batch~Batch|null} #batch
42
- */
43
21
  this.batch = null;
44
- /**
45
- * Operation type.
46
- *
47
- * @readonly
48
- * @member {String} #type
49
- */
50
- /**
51
- * Creates and returns an operation that has the same parameters as this operation.
52
- *
53
- * @method #clone
54
- * @returns {module:engine/model/operation/operation~Operation} Clone of this operation.
55
- */
56
- /**
57
- * Creates and returns a reverse operation. Reverse operation when executed right after
58
- * the original operation will bring back tree model state to the point before the original
59
- * operation execution. In other words, it reverses changes done by the original operation.
60
- *
61
- * Keep in mind that tree model state may change since executing the original operation,
62
- * so reverse operation will be "outdated". In that case you will need to transform it by
63
- * all operations that were executed after the original operation.
64
- *
65
- * @method #getReversed
66
- * @returns {module:engine/model/operation/operation~Operation} Reversed operation.
67
- */
68
- /**
69
- * Executes the operation - modifications described by the operation properties will be applied to the model tree.
70
- *
71
- * @protected
72
- * @method #_execute
73
- */
74
22
  }
75
23
  /**
76
24
  * Checks whether the operation's parameters are correct and the operation can be correctly executed. Throws
77
25
  * an error if operation is not valid.
78
26
  *
79
27
  * @internal
80
- * @protected
81
- * @method #_validate
82
28
  */
83
29
  _validate() {
84
30
  }
85
31
  /**
86
32
  * Custom toJSON method to solve child-parent circular dependencies.
87
33
  *
88
- * @method #toJSON
89
- * @returns {Object} Clone of this object with the operation property replaced with string.
34
+ * @returns Clone of this object with the operation property replaced with string.
90
35
  */
91
36
  toJSON() {
92
37
  // This method creates only a shallow copy, all nested objects should be defined separately.
@@ -101,8 +46,6 @@ export default class Operation {
101
46
  }
102
47
  /**
103
48
  * Name of the operation class used for serialization.
104
- *
105
- * @type {String}
106
49
  */
107
50
  static get className() {
108
51
  return 'Operation';
@@ -110,9 +53,8 @@ export default class Operation {
110
53
  /**
111
54
  * Creates Operation object from deserilized object, i.e. from parsed JSON string.
112
55
  *
113
- * @param {Object} json Deserialized JSON object.
114
- * @param {module:engine/model/document~Document} doc Document on which this operation will be applied.
115
- * @returns {module:engine/model/operation/operation~Operation}
56
+ * @param json Deserialized JSON object.
57
+ * @param doc Document on which this operation will be applied.
116
58
  */
117
59
  static fromJSON(json, document) {
118
60
  return new this(json.baseVersion);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
@@ -28,16 +28,13 @@ operations[SplitOperation.className] = SplitOperation;
28
28
  operations[MergeOperation.className] = MergeOperation;
29
29
  /**
30
30
  * A factory class for creating operations.
31
- *
32
- * @abstract
33
31
  */
34
32
  export default class OperationFactory {
35
33
  /**
36
34
  * Creates an operation instance from a JSON object (parsed JSON string).
37
35
  *
38
- * @param {Object} json Deserialized JSON object.
39
- * @param {module:engine/model/document~Document} document Document on which this operation will be applied.
40
- * @returns {module:engine/model/operation/operation~Operation}
36
+ * @param json Deserialized JSON object.
37
+ * @param document Document on which this operation will be applied.
41
38
  */
42
39
  static fromJSON(json, document) {
43
40
  return operations[json.__className].fromJSON(json, document);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
@@ -13,40 +13,23 @@ import { CKEditorError } from '@ckeditor/ckeditor5-utils';
13
13
  * Operation to change element's name.
14
14
  *
15
15
  * Using this class you can change element's name.
16
- *
17
- * @extends module:engine/model/operation/operation~Operation
18
16
  */
19
17
  export default class RenameOperation extends Operation {
20
18
  /**
21
19
  * Creates an operation that changes element's name.
22
20
  *
23
- * @param {module:engine/model/position~Position} position Position before an element to change.
24
- * @param {String} oldName Current name of the element.
25
- * @param {String} newName New name for the element.
26
- * @param {Number|null} baseVersion Document {@link module:engine/model/document~Document#version} on which operation
21
+ * @param position Position before an element to change.
22
+ * @param oldName Current name of the element.
23
+ * @param newName New name for the element.
24
+ * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
27
25
  * can be applied or `null` if the operation operates on detached (non-document) tree.
28
26
  */
29
27
  constructor(position, oldName, newName, baseVersion) {
30
28
  super(baseVersion);
31
- /**
32
- * Position before an element to change.
33
- *
34
- * @member {module:engine/model/position~Position} module:engine/model/operation/renameoperation~RenameOperation#position
35
- */
36
29
  this.position = position;
37
30
  // This position sticks to the next node because it is a position before the node that we want to change.
38
31
  this.position.stickiness = 'toNext';
39
- /**
40
- * Current name of the element.
41
- *
42
- * @member {String} module:engine/model/operation/renameoperation~RenameOperation#oldName
43
- */
44
32
  this.oldName = oldName;
45
- /**
46
- * New name for the element.
47
- *
48
- * @member {String} module:engine/model/operation/renameoperation~RenameOperation#newName
49
- */
50
33
  this.newName = newName;
51
34
  }
52
35
  /**
@@ -58,15 +41,13 @@ export default class RenameOperation extends Operation {
58
41
  /**
59
42
  * Creates and returns an operation that has the same parameters as this operation.
60
43
  *
61
- * @returns {module:engine/model/operation/renameoperation~RenameOperation} Clone of this operation.
44
+ * @returns Clone of this operation.
62
45
  */
63
46
  clone() {
64
47
  return new RenameOperation(this.position.clone(), this.oldName, this.newName, this.baseVersion);
65
48
  }
66
49
  /**
67
50
  * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
68
- *
69
- * @returns {module:engine/model/operation/renameoperation~RenameOperation}
70
51
  */
71
52
  getReversed() {
72
53
  return new RenameOperation(this.position.clone(), this.newName, this.oldName, this.baseVersion + 1);
@@ -119,9 +100,8 @@ export default class RenameOperation extends Operation {
119
100
  /**
120
101
  * Creates `RenameOperation` object from deserialized object, i.e. from parsed JSON string.
121
102
  *
122
- * @param {Object} json Deserialized JSON object.
123
- * @param {module:engine/model/document~Document} document Document on which this operation will be applied.
124
- * @returns {module:engine/model/operation/attributeoperation~AttributeOperation}
103
+ * @param json Deserialized JSON object.
104
+ * @param document Document on which this operation will be applied.
125
105
  */
126
106
  static fromJSON(json, document) {
127
107
  return new RenameOperation(Position.fromJSON(json.position, document), json.oldName, json.newName, json.baseVersion);