@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,109 @@
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/splitoperation
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 split {@link module:engine/model/element~Element an element} at given
15
+ * {@link module:engine/model/operation/splitoperation~SplitOperation#splitPosition split position} into two elements,
16
+ * both containing a part of the element's original content.
17
+ */
18
+ export default class SplitOperation extends Operation {
19
+ /**
20
+ * Position at which an element should be split.
21
+ */
22
+ splitPosition: Position;
23
+ /**
24
+ * Total offset size of elements that are in the split element after `position`.
25
+ */
26
+ howMany: number;
27
+ /**
28
+ * Position at which the clone of split element (or element from graveyard) will be inserted.
29
+ */
30
+ insertionPosition: Position;
31
+ /**
32
+ * Position in the graveyard root before the element which should be used as a parent of the nodes after `position`.
33
+ * If it is not set, a copy of the the `position` parent will be used.
34
+ *
35
+ * The default behavior is to clone the split element. Element from graveyard is used during undo.
36
+ */
37
+ graveyardPosition: Position | null;
38
+ /**
39
+ * Creates a split operation.
40
+ *
41
+ * @param splitPosition Position at which an element should be split.
42
+ * @param howMany Total offset size of elements that are in the split element after `position`.
43
+ * @param insertionPosition Position at which the clone of split element (or element from graveyard) will be inserted.
44
+ * @param graveyardPosition Position in the graveyard root before the element which
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~Document#version} on which operation
47
+ * can be applied or `null` if the operation operates on detached (non-document) tree.
48
+ */
49
+ constructor(splitPosition: Position, howMany: number, insertionPosition: Position, graveyardPosition: Position | null, baseVersion: number | null);
50
+ /**
51
+ * @inheritDoc
52
+ */
53
+ get type(): 'split';
54
+ /**
55
+ * Position inside the new clone of a split element.
56
+ *
57
+ * This is a position where nodes that are after the split position will be moved to.
58
+ */
59
+ get moveTargetPosition(): Position;
60
+ /**
61
+ * Artificial range that contains all the nodes from the split element that will be moved to the new element.
62
+ * The range starts at {@link #splitPosition} and ends in the same parent, at `POSITIVE_INFINITY` offset.
63
+ */
64
+ get movedRange(): Range;
65
+ /**
66
+ * @inheritDoc
67
+ */
68
+ get affectedSelectable(): Selectable;
69
+ /**
70
+ * Creates and returns an operation that has the same parameters as this operation.
71
+ *
72
+ * @returns Clone of this operation.
73
+ */
74
+ clone(): SplitOperation;
75
+ /**
76
+ * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
77
+ */
78
+ getReversed(): Operation;
79
+ /**
80
+ * @inheritDoc
81
+ * @internal
82
+ */
83
+ _validate(): void;
84
+ /**
85
+ * @inheritDoc
86
+ * @internal
87
+ */
88
+ _execute(): void;
89
+ /**
90
+ * @inheritDoc
91
+ */
92
+ toJSON(): unknown;
93
+ /**
94
+ * @inheritDoc
95
+ */
96
+ static get className(): string;
97
+ /**
98
+ * Helper function that returns a default insertion position basing on given `splitPosition`. The default insertion
99
+ * position is after the split element.
100
+ */
101
+ static getInsertionPosition(splitPosition: Position): Position;
102
+ /**
103
+ * Creates `SplitOperation` object from deserialized object, i.e. from parsed JSON string.
104
+ *
105
+ * @param json Deserialized JSON object.
106
+ * @param document Document on which this operation will be applied.
107
+ */
108
+ static fromJSON(json: any, document: Document): SplitOperation;
109
+ }
@@ -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
+ import type Operation from './operation.js';
6
+ import type Document from '../document.js';
7
+ /**
8
+ * Transforms operation `a` by operation `b`.
9
+ *
10
+ * @param a Operation to be transformed.
11
+ * @param b Operation to transform by.
12
+ * @param context Transformation context for this transformation.
13
+ * @returns Transformation result.
14
+ */
15
+ export declare function transform(a: Operation, b: Operation, context?: TransformationContext): Array<Operation>;
16
+ /**
17
+ * Performs a transformation of two sets of operations - `operationsA` and `operationsB`. The transformation is two-way -
18
+ * both transformed `operationsA` and transformed `operationsB` are returned.
19
+ *
20
+ * Note, that the first operation in each set should base on the same document state (
21
+ * {@link module:engine/model/document~Document#version document version}).
22
+ *
23
+ * It is assumed that `operationsA` are "more important" during conflict resolution between two operations.
24
+ *
25
+ * New copies of both passed arrays and operations inside them are returned. Passed arguments are not altered.
26
+ *
27
+ * Base versions of the transformed operations sets are updated accordingly. For example, assume that base versions are `4`
28
+ * and there are `3` operations in `operationsA` and `5` operations in `operationsB`. Then:
29
+ *
30
+ * * transformed `operationsA` will start from base version `9` (`4` base version + `5` operations B),
31
+ * * transformed `operationsB` will start from base version `7` (`4` base version + `3` operations A).
32
+ *
33
+ * If no operation was broken into two during transformation, then both sets will end up with an operation that bases on version `11`:
34
+ *
35
+ * * transformed `operationsA` start from `9` and there are `3` of them, so the last will have `baseVersion` equal to `11`,
36
+ * * transformed `operationsB` start from `7` and there are `5` of them, so the last will have `baseVersion` equal to `11`.
37
+ *
38
+ * @param operationsA
39
+ * @param operationsB
40
+ * @param options Additional transformation options.
41
+ * @param options.document Document which the operations change.
42
+ * @param options.useRelations Whether during transformation relations should be used (used during undo for better conflict resolution).
43
+ * @param options.padWithNoOps Whether additional {@link module:engine/model/operation/nooperation~NoOperation}s
44
+ * should be added to the transformation results to force the same last base version for both transformed sets (in case
45
+ * if some operations got broken into multiple operations during transformation).
46
+ * @param options.forceWeakRemove If set to `false`, remove operation will be always stronger than move operation,
47
+ * so the removed nodes won't end up back in the document root. When set to `true`, context data will be used.
48
+ * @returns Transformation result.
49
+ */
50
+ export declare function transformSets(operationsA: Array<Operation>, operationsB: Array<Operation>, options: {
51
+ document: Document;
52
+ useRelations?: boolean;
53
+ padWithNoOps?: boolean;
54
+ forceWeakRemove?: boolean;
55
+ }): TransformSetsResult;
56
+ /**
57
+ * The result of {@link module:engine/model/operation/transform~transformSets}.
58
+ */
59
+ export interface TransformSetsResult {
60
+ /**
61
+ * Transformed `operationsA`.
62
+ */
63
+ operationsA: Array<Operation>;
64
+ /**
65
+ * Transformed `operationsB`.
66
+ */
67
+ operationsB: Array<Operation>;
68
+ /**
69
+ * A map that links transformed operations to original operations. The keys are the transformed
70
+ * operations and the values are the original operations from the input (`operationsA` and `operationsB`).
71
+ */
72
+ originalOperations: Map<Operation, Operation>;
73
+ }
74
+ /**
75
+ * Holds additional contextual information about a transformed pair of operations (`a` and `b`). Those information
76
+ * can be used for better conflict resolving.
77
+ */
78
+ export type TransformationContext = {
79
+ /**
80
+ * Whether `a` is strong operation in this transformation, or weak.
81
+ */
82
+ aIsStrong?: boolean;
83
+ /**
84
+ * Whether `a` operation was undone.
85
+ */
86
+ aWasUndone?: boolean;
87
+ /**
88
+ * Whether `b` operation was undone.
89
+ */
90
+ bWasUndone?: boolean;
91
+ /**
92
+ * The relation between `a` operation and an operation undone by `b` operation.
93
+ */
94
+ abRelation?: any;
95
+ /**
96
+ * The relation between `b` operation and an operation undone by `a` operation.
97
+ */
98
+ baRelation?: any;
99
+ forceWeakRemove?: boolean;
100
+ };
@@ -0,0 +1,71 @@
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/utils
7
+ */
8
+ import Node from '../node.js';
9
+ import Range from '../range.js';
10
+ import type DocumentFragment from '../documentfragment.js';
11
+ import type Item from '../item.js';
12
+ import type NodeList from '../nodelist.js';
13
+ import type Position from '../position.js';
14
+ /**
15
+ * Inserts given nodes at given position.
16
+ *
17
+ * @internal
18
+ * @param position Position at which nodes should be inserted.
19
+ * @param normalizedNodes Nodes to insert.
20
+ * @returns Range spanning over inserted elements.
21
+ */
22
+ export declare function _insert(position: Position, nodes: NodeSet): Range;
23
+ /**
24
+ * Removed nodes in given range. Only {@link module:engine/model/range~Range#isFlat flat} ranges are accepted.
25
+ *
26
+ * @internal
27
+ * @param range Range containing nodes to remove.
28
+ */
29
+ export declare function _remove(this: any, range: Range): Array<Node>;
30
+ /**
31
+ * Moves nodes in given range to given target position. Only {@link module:engine/model/range~Range#isFlat flat} ranges are accepted.
32
+ *
33
+ * @internal
34
+ * @param sourceRange Range containing nodes to move.
35
+ * @param targetPosition Position to which nodes should be moved.
36
+ * @returns Range containing moved nodes.
37
+ */
38
+ export declare function _move(this: any, sourceRange: Range, targetPosition: Position): Range;
39
+ /**
40
+ * Sets given attribute on nodes in given range. The attributes are only set on top-level nodes of the range, not on its children.
41
+ *
42
+ * @internal
43
+ * @param range Range containing nodes that should have the attribute set. Must be a flat range.
44
+ * @param key Key of attribute to set.
45
+ * @param value Attribute value.
46
+ */
47
+ export declare function _setAttribute(range: Range, key: string, value: unknown): void;
48
+ /**
49
+ * Normalizes given object or an array of objects to an array of {@link module:engine/model/node~Node nodes}. See
50
+ * {@link ~NodeSet NodeSet} for details on how normalization is performed.
51
+ *
52
+ * @internal
53
+ * @param nodes Objects to normalize.
54
+ * @returns Normalized nodes.
55
+ */
56
+ export declare function _normalizeNodes(nodes: NodeSet): Array<Node>;
57
+ /**
58
+ * Value that can be normalized to an array of {@link module:engine/model/node~Node nodes}.
59
+ *
60
+ * Non-arrays are normalized as follows:
61
+ * * {@link module:engine/model/node~Node Node} is left as is,
62
+ * * {@link module:engine/model/textproxy~TextProxy TextProxy} and `string` are normalized to {@link module:engine/model/text~Text Text},
63
+ * * {@link module:engine/model/nodelist~NodeList NodeList} is normalized to an array containing all nodes that are in that node list,
64
+ * * {@link module:engine/model/documentfragment~DocumentFragment DocumentFragment} is normalized to an array containing all of it's
65
+ * * children.
66
+ *
67
+ * Arrays are processed item by item like non-array values and flattened to one array. Normalization always results in
68
+ * a flat array of {@link module:engine/model/node~Node nodes}. Consecutive text nodes (or items normalized to text nodes) will be
69
+ * merged if they have same attributes.
70
+ */
71
+ export type NodeSet = Item | string | NodeList | DocumentFragment | Iterable<Item | string | NodeList | DocumentFragment>;