@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.
Files changed (241) hide show
  1. package/dist/index.js +2563 -2257
  2. package/dist/index.js.map +1 -1
  3. package/package.json +3 -3
  4. package/src/controller/datacontroller.d.ts +33 -32
  5. package/src/controller/datacontroller.js +29 -28
  6. package/src/controller/editingcontroller.d.ts +8 -8
  7. package/src/controller/editingcontroller.js +10 -10
  8. package/src/conversion/conversion.d.ts +18 -19
  9. package/src/conversion/conversion.js +4 -4
  10. package/src/conversion/conversionhelpers.d.ts +1 -1
  11. package/src/conversion/conversionhelpers.js +1 -1
  12. package/src/conversion/downcastdispatcher.d.ts +63 -69
  13. package/src/conversion/downcastdispatcher.js +16 -16
  14. package/src/conversion/downcasthelpers.d.ts +94 -83
  15. package/src/conversion/downcasthelpers.js +63 -53
  16. package/src/conversion/mapper.d.ts +27 -27
  17. package/src/conversion/mapper.js +15 -15
  18. package/src/conversion/modelconsumable.d.ts +26 -26
  19. package/src/conversion/modelconsumable.js +23 -23
  20. package/src/conversion/upcastdispatcher.d.ts +33 -32
  21. package/src/conversion/upcastdispatcher.js +19 -19
  22. package/src/conversion/upcasthelpers.d.ts +46 -38
  23. package/src/conversion/upcasthelpers.js +33 -24
  24. package/src/conversion/viewconsumable.d.ts +50 -45
  25. package/src/conversion/viewconsumable.js +32 -27
  26. package/src/dataprocessor/basichtmlwriter.d.ts +4 -2
  27. package/src/dataprocessor/basichtmlwriter.js +3 -1
  28. package/src/dataprocessor/dataprocessor.d.ts +7 -6
  29. package/src/dataprocessor/htmldataprocessor.d.ts +10 -10
  30. package/src/dataprocessor/htmldataprocessor.js +6 -6
  31. package/src/dataprocessor/htmlwriter.d.ts +1 -1
  32. package/src/dataprocessor/xmldataprocessor.d.ts +10 -10
  33. package/src/dataprocessor/xmldataprocessor.js +6 -6
  34. package/src/dev-utils/model.d.ts +25 -26
  35. package/src/dev-utils/model.js +35 -36
  36. package/src/dev-utils/operationreplayer.d.ts +5 -3
  37. package/src/dev-utils/operationreplayer.js +4 -2
  38. package/src/dev-utils/utils.d.ts +8 -0
  39. package/src/dev-utils/utils.js +8 -0
  40. package/src/dev-utils/view.d.ts +66 -63
  41. package/src/dev-utils/view.js +144 -134
  42. package/src/index.d.ts +135 -106
  43. package/src/index.js +120 -71
  44. package/src/legacyerrors.d.ts +5 -0
  45. package/src/legacyerrors.js +17 -0
  46. package/src/model/batch.d.ts +2 -15
  47. package/src/model/batch.js +1 -23
  48. package/src/model/differ.d.ts +54 -31
  49. package/src/model/differ.js +15 -15
  50. package/src/model/document.d.ts +31 -31
  51. package/src/model/document.js +13 -13
  52. package/src/model/documentfragment.d.ts +45 -45
  53. package/src/model/documentfragment.js +40 -40
  54. package/src/model/documentselection.d.ts +92 -92
  55. package/src/model/documentselection.js +71 -70
  56. package/src/model/element.d.ts +31 -31
  57. package/src/model/element.js +29 -29
  58. package/src/model/history.d.ts +3 -3
  59. package/src/model/history.js +2 -2
  60. package/src/model/item.d.ts +4 -5
  61. package/src/model/liveposition.d.ts +31 -31
  62. package/src/model/liveposition.js +18 -18
  63. package/src/model/liverange.d.ts +42 -38
  64. package/src/model/liverange.js +17 -16
  65. package/src/model/markercollection.d.ts +41 -40
  66. package/src/model/markercollection.js +22 -20
  67. package/src/model/model.d.ts +82 -81
  68. package/src/model/model.js +54 -54
  69. package/src/model/node.d.ts +48 -48
  70. package/src/model/node.js +31 -31
  71. package/src/model/nodelist.d.ts +17 -17
  72. package/src/model/nodelist.js +11 -11
  73. package/src/model/operation/attributeoperation.d.ts +10 -10
  74. package/src/model/operation/attributeoperation.js +7 -7
  75. package/src/model/operation/detachoperation.d.ts +11 -9
  76. package/src/model/operation/detachoperation.js +8 -6
  77. package/src/model/operation/insertoperation.d.ts +13 -13
  78. package/src/model/operation/insertoperation.js +15 -15
  79. package/src/model/operation/markeroperation.d.ts +12 -12
  80. package/src/model/operation/markeroperation.js +5 -5
  81. package/src/model/operation/mergeoperation.d.ts +16 -16
  82. package/src/model/operation/mergeoperation.js +18 -18
  83. package/src/model/operation/moveoperation.d.ts +16 -16
  84. package/src/model/operation/moveoperation.js +18 -15
  85. package/src/model/operation/nooperation.d.ts +4 -4
  86. package/src/model/operation/nooperation.js +2 -2
  87. package/src/model/operation/operation.d.ts +10 -10
  88. package/src/model/operation/operation.js +5 -5
  89. package/src/model/operation/operationfactory.d.ts +4 -4
  90. package/src/model/operation/operationfactory.js +12 -12
  91. package/src/model/operation/renameoperation.d.ts +10 -10
  92. package/src/model/operation/renameoperation.js +7 -7
  93. package/src/model/operation/rootattributeoperation.d.ts +12 -12
  94. package/src/model/operation/rootattributeoperation.js +8 -8
  95. package/src/model/operation/rootoperation.d.ts +8 -8
  96. package/src/model/operation/rootoperation.js +3 -3
  97. package/src/model/operation/splitoperation.d.ts +17 -17
  98. package/src/model/operation/splitoperation.js +19 -19
  99. package/src/model/operation/transform.d.ts +11 -8
  100. package/src/model/operation/transform.js +66 -49
  101. package/src/model/operation/utils.d.ts +24 -23
  102. package/src/model/operation/utils.js +20 -20
  103. package/src/model/position.d.ts +101 -97
  104. package/src/model/position.js +69 -64
  105. package/src/model/range.d.ts +90 -90
  106. package/src/model/range.js +87 -87
  107. package/src/model/rootelement.d.ts +11 -11
  108. package/src/model/rootelement.js +9 -9
  109. package/src/model/schema.d.ts +158 -154
  110. package/src/model/schema.js +93 -90
  111. package/src/model/selection.d.ts +73 -73
  112. package/src/model/selection.js +62 -62
  113. package/src/model/text.d.ts +11 -10
  114. package/src/model/text.js +11 -10
  115. package/src/model/textproxy.d.ts +39 -38
  116. package/src/model/textproxy.js +31 -30
  117. package/src/model/treewalker.d.ts +37 -37
  118. package/src/model/treewalker.js +14 -14
  119. package/src/model/typecheckable.d.ts +45 -45
  120. package/src/model/typecheckable.js +1 -1
  121. package/src/model/utils/autoparagraphing.d.ts +7 -7
  122. package/src/model/utils/deletecontent.d.ts +7 -5
  123. package/src/model/utils/deletecontent.js +13 -11
  124. package/src/model/utils/getselectedcontent.d.ts +6 -5
  125. package/src/model/utils/getselectedcontent.js +2 -1
  126. package/src/model/utils/insertcontent.d.ts +9 -8
  127. package/src/model/utils/insertcontent.js +41 -40
  128. package/src/model/utils/insertobject.d.ts +9 -9
  129. package/src/model/utils/insertobject.js +4 -4
  130. package/src/model/utils/modifyselection.d.ts +5 -4
  131. package/src/model/utils/modifyselection.js +12 -11
  132. package/src/model/utils/selection-post-fixer.d.ts +12 -8
  133. package/src/model/utils/selection-post-fixer.js +15 -11
  134. package/src/model/writer.d.ts +102 -101
  135. package/src/model/writer.js +99 -98
  136. package/src/view/attributeelement.d.ts +29 -29
  137. package/src/view/attributeelement.js +25 -25
  138. package/src/view/containerelement.d.ts +16 -15
  139. package/src/view/containerelement.js +15 -14
  140. package/src/view/datatransfer.d.ts +7 -7
  141. package/src/view/datatransfer.js +1 -1
  142. package/src/view/document.d.ts +25 -25
  143. package/src/view/document.js +15 -15
  144. package/src/view/documentfragment.d.ts +21 -21
  145. package/src/view/documentfragment.js +14 -14
  146. package/src/view/documentselection.d.ts +65 -63
  147. package/src/view/documentselection.js +27 -25
  148. package/src/view/domconverter.d.ts +94 -89
  149. package/src/view/domconverter.js +78 -73
  150. package/src/view/downcastwriter.d.ts +185 -181
  151. package/src/view/downcastwriter.js +222 -210
  152. package/src/view/editableelement.d.ts +13 -13
  153. package/src/view/editableelement.js +8 -8
  154. package/src/view/element.d.ts +75 -74
  155. package/src/view/element.js +58 -58
  156. package/src/view/elementdefinition.d.ts +3 -4
  157. package/src/view/emptyelement.d.ts +13 -13
  158. package/src/view/emptyelement.js +13 -13
  159. package/src/view/filler.d.ts +14 -3
  160. package/src/view/filler.js +12 -1
  161. package/src/view/item.d.ts +4 -5
  162. package/src/view/matcher.d.ts +22 -19
  163. package/src/view/matcher.js +6 -6
  164. package/src/view/node.d.ts +33 -33
  165. package/src/view/node.js +9 -9
  166. package/src/view/observer/arrowkeysobserver.d.ts +10 -10
  167. package/src/view/observer/arrowkeysobserver.js +5 -5
  168. package/src/view/observer/bubblingemittermixin.d.ts +5 -5
  169. package/src/view/observer/bubblingemittermixin.js +2 -9
  170. package/src/view/observer/bubblingeventinfo.d.ts +9 -9
  171. package/src/view/observer/bubblingeventinfo.js +1 -1
  172. package/src/view/observer/clickobserver.d.ts +8 -8
  173. package/src/view/observer/clickobserver.js +4 -4
  174. package/src/view/observer/compositionobserver.d.ts +19 -19
  175. package/src/view/observer/compositionobserver.js +6 -6
  176. package/src/view/observer/domeventdata.d.ts +9 -9
  177. package/src/view/observer/domeventdata.js +2 -2
  178. package/src/view/observer/domeventobserver.d.ts +3 -3
  179. package/src/view/observer/domeventobserver.js +5 -5
  180. package/src/view/observer/fakeselectionobserver.d.ts +9 -9
  181. package/src/view/observer/fakeselectionobserver.js +8 -8
  182. package/src/view/observer/focusobserver.d.ts +16 -16
  183. package/src/view/observer/focusobserver.js +7 -7
  184. package/src/view/observer/inputobserver.d.ts +18 -18
  185. package/src/view/observer/inputobserver.js +5 -5
  186. package/src/view/observer/keyobserver.d.ts +11 -11
  187. package/src/view/observer/keyobserver.js +3 -3
  188. package/src/view/observer/mouseobserver.d.ts +16 -16
  189. package/src/view/observer/mouseobserver.js +3 -3
  190. package/src/view/observer/mutationobserver.d.ts +21 -21
  191. package/src/view/observer/mutationobserver.js +7 -7
  192. package/src/view/observer/observer.d.ts +12 -12
  193. package/src/view/observer/observer.js +6 -6
  194. package/src/view/observer/selectionobserver.d.ts +33 -33
  195. package/src/view/observer/selectionobserver.js +14 -14
  196. package/src/view/observer/tabobserver.d.ts +10 -10
  197. package/src/view/observer/tabobserver.js +5 -5
  198. package/src/view/observer/touchobserver.d.ts +13 -13
  199. package/src/view/observer/touchobserver.js +3 -3
  200. package/src/view/placeholder.d.ts +21 -21
  201. package/src/view/placeholder.js +23 -23
  202. package/src/view/position.d.ts +49 -49
  203. package/src/view/position.js +42 -42
  204. package/src/view/range.d.ts +76 -74
  205. package/src/view/range.js +67 -65
  206. package/src/view/rawelement.d.ts +19 -19
  207. package/src/view/rawelement.js +16 -16
  208. package/src/view/renderer.d.ts +14 -14
  209. package/src/view/renderer.js +7 -7
  210. package/src/view/rooteditableelement.d.ts +8 -7
  211. package/src/view/rooteditableelement.js +7 -6
  212. package/src/view/selection.d.ts +66 -64
  213. package/src/view/selection.js +50 -48
  214. package/src/view/styles/background.d.ts +2 -2
  215. package/src/view/styles/background.js +9 -9
  216. package/src/view/styles/border.d.ts +2 -2
  217. package/src/view/styles/border.js +13 -13
  218. package/src/view/styles/margin.d.ts +2 -2
  219. package/src/view/styles/margin.js +5 -5
  220. package/src/view/styles/padding.d.ts +2 -2
  221. package/src/view/styles/padding.js +5 -5
  222. package/src/view/styles/utils.d.ts +24 -24
  223. package/src/view/styles/utils.js +25 -25
  224. package/src/view/stylesmap.d.ts +28 -32
  225. package/src/view/stylesmap.js +52 -39
  226. package/src/view/text.d.ts +11 -11
  227. package/src/view/text.js +10 -10
  228. package/src/view/textproxy.d.ts +33 -32
  229. package/src/view/textproxy.js +23 -22
  230. package/src/view/tokenlist.d.ts +14 -14
  231. package/src/view/tokenlist.js +10 -10
  232. package/src/view/treewalker.d.ts +42 -40
  233. package/src/view/treewalker.js +36 -35
  234. package/src/view/typecheckable.d.ts +76 -75
  235. package/src/view/typecheckable.js +1 -1
  236. package/src/view/uielement.d.ts +22 -21
  237. package/src/view/uielement.js +17 -16
  238. package/src/view/upcastwriter.d.ts +70 -70
  239. package/src/view/upcastwriter.js +42 -42
  240. package/src/view/view.d.ts +70 -69
  241. package/src/view/view.js +56 -55
@@ -8,32 +8,32 @@
8
8
  /**
9
9
  * Collection of methods for manipulating the {@link module:engine/model/model model} for testing purposes.
10
10
  */
11
- import RootElement from '../model/rootelement.js';
12
- import Model from '../model/model.js';
13
- import ModelRange from '../model/range.js';
14
- import ModelPosition from '../model/position.js';
15
- import ModelSelection from '../model/selection.js';
16
- import ModelDocumentFragment from '../model/documentfragment.js';
17
- import DocumentSelection from '../model/documentselection.js';
18
- import View from '../view/view.js';
19
- import ViewContainerElement from '../view/containerelement.js';
20
- import ViewRootEditableElement from '../view/rooteditableelement.js';
21
- import { parse as viewParse, stringify as viewStringify } from '../../src/dev-utils/view.js';
22
- import Mapper from '../conversion/mapper.js';
11
+ import { ModelRootElement } from '../model/rootelement.js';
12
+ import { Model } from '../model/model.js';
13
+ import { ModelRange } from '../model/range.js';
14
+ import { ModelPosition } from '../model/position.js';
15
+ import { ModelSelection } from '../model/selection.js';
16
+ import { ModelDocumentFragment } from '../model/documentfragment.js';
17
+ import { ModelDocumentSelection } from '../model/documentselection.js';
18
+ import { EditingView } from '../view/view.js';
19
+ import { ViewContainerElement } from '../view/containerelement.js';
20
+ import { ViewRootEditableElement } from '../view/rooteditableelement.js';
21
+ import { _parseView, _stringifyView } from '../../src/dev-utils/view.js';
22
+ import { Mapper } from '../conversion/mapper.js';
23
23
  import { convertCollapsedSelection, convertRangeSelection, insertAttributesAndChildren, insertElement, insertText, insertUIElement, wrap } from '../conversion/downcasthelpers.js';
24
24
  import { StylesProcessor } from '../view/stylesmap.js';
25
- import DowncastDispatcher from '../conversion/downcastdispatcher.js';
26
- import UpcastDispatcher from '../conversion/upcastdispatcher.js';
25
+ import { DowncastDispatcher } from '../conversion/downcastdispatcher.js';
26
+ import { UpcastDispatcher } from '../conversion/upcastdispatcher.js';
27
27
  import { toMap } from '@ckeditor/ckeditor5-utils';
28
28
  import { isPlainObject } from 'es-toolkit/compat';
29
29
  /**
30
- * Writes the content of a model {@link module:engine/model/document~Document document} to an HTML-like string.
30
+ * Writes the content of a model {@link module:engine/model/document~ModelDocument document} to an HTML-like string.
31
31
  *
32
32
  * ```ts
33
33
  * getData( editor.model ); // -> '<paragraph>Foo![]</paragraph>'
34
34
  * ```
35
35
  *
36
- * **Note:** A {@link module:engine/model/text~Text text} node that contains attributes will be represented as:
36
+ * **Note:** A {@link module:engine/model/text~ModelText text} node that contains attributes will be represented as:
37
37
  *
38
38
  * ```xml
39
39
  * <$text attribute="value">Text data</$text>
@@ -49,18 +49,18 @@ import { isPlainObject } from 'es-toolkit/compat';
49
49
  * @param options.convertMarkers Whether to include markers in the returned string.
50
50
  * @returns The stringified data.
51
51
  */
52
- export function getData(model, options = {}) {
52
+ export function _getModelData(model, options = {}) {
53
53
  if (!(model instanceof Model)) {
54
54
  throw new TypeError('Model needs to be an instance of module:engine/model/model~Model.');
55
55
  }
56
56
  const rootName = options.rootName || 'main';
57
57
  const root = model.document.getRoot(rootName);
58
- return getData._stringify(root, options.withoutSelection ? null : model.document.selection, options.convertMarkers ? model.markers : null);
58
+ return _getModelData._stringify(root, options.withoutSelection ? null : model.document.selection, options.convertMarkers ? model.markers : null);
59
59
  }
60
60
  // Set stringify as getData private method - needed for testing/spying.
61
- getData._stringify = stringify;
61
+ _getModelData._stringify = _stringifyModel;
62
62
  /**
63
- * Sets the content of a model {@link module:engine/model/document~Document document} provided as an HTML-like string.
63
+ * Sets the content of a model {@link module:engine/model/document~ModelDocument document} provided as an HTML-like string.
64
64
  *
65
65
  * ```ts
66
66
  * setData( editor.model, '<paragraph>Foo![]</paragraph>' );
@@ -69,7 +69,7 @@ getData._stringify = stringify;
69
69
  * **Note:** Remember to register elements in the {@link module:engine/model/model~Model#schema model's schema} before
70
70
  * trying to use them.
71
71
  *
72
- * **Note:** To create a {@link module:engine/model/text~Text text} node that contains attributes use:
72
+ * **Note:** To create a {@link module:engine/model/text~ModelText text} node that contains attributes use:
73
73
  *
74
74
  * ```xml
75
75
  * <$text attribute="value">Text data</$text>
@@ -84,9 +84,8 @@ getData._stringify = stringify;
84
84
  * @param options.selectionAttributes A list of attributes which will be passed to the selection.
85
85
  * @param options.lastRangeBackward If set to `true`, the last range will be added as backward.
86
86
  * @param options.batchType Batch type used for inserting elements. See {@link module:engine/model/batch~Batch#constructor}.
87
- * See {@link module:engine/model/batch~Batch#type}.
88
87
  */
89
- export function setData(model, data, options = {}) {
88
+ export function _setModelData(model, data, options = {}) {
90
89
  if (!(model instanceof Model)) {
91
90
  throw new TypeError('Model needs to be an instance of module:engine/model/model~Model.');
92
91
  }
@@ -94,7 +93,7 @@ export function setData(model, data, options = {}) {
94
93
  let selection = null;
95
94
  const modelRoot = model.document.getRoot(options.rootName || 'main');
96
95
  // Parse data string to model.
97
- const parsedResult = setData._parse(data, model.schema, {
96
+ const parsedResult = _setModelData._parse(data, model.schema, {
98
97
  lastRangeBackward: options.lastRangeBackward,
99
98
  selectionAttributes: options.selectionAttributes,
100
99
  context: [modelRoot.name],
@@ -137,11 +136,11 @@ export function setData(model, data, options = {}) {
137
136
  }
138
137
  }
139
138
  // Set parse as setData private method - needed for testing/spying.
140
- setData._parse = parse;
139
+ _setModelData._parse = _parseModel;
141
140
  /**
142
141
  * Converts model nodes to HTML-like string representation.
143
142
  *
144
- * **Note:** A {@link module:engine/model/text~Text text} node that contains attributes will be represented as:
143
+ * **Note:** A {@link module:engine/model/text~ModelText text} node that contains attributes will be represented as:
145
144
  *
146
145
  * ```xml
147
146
  * <$text attribute="value">Text data</$text>
@@ -154,13 +153,13 @@ setData._parse = parse;
154
153
  * @param markers Markers to include.
155
154
  * @returns An HTML-like string representing the model.
156
155
  */
157
- export function stringify(node, selectionOrPositionOrRange = null, markers = null) {
156
+ export function _stringifyModel(node, selectionOrPositionOrRange = null, markers = null) {
158
157
  const model = new Model();
159
158
  const mapper = new Mapper();
160
159
  let selection = null;
161
160
  let range;
162
161
  // Create a range witch wraps passed node.
163
- if (node instanceof RootElement || node instanceof ModelDocumentFragment) {
162
+ if (node instanceof ModelRootElement || node instanceof ModelDocumentFragment) {
164
163
  range = model.createRangeIn(node);
165
164
  }
166
165
  else {
@@ -177,7 +176,7 @@ export function stringify(node, selectionOrPositionOrRange = null, markers = nul
177
176
  if (selectionOrPositionOrRange instanceof ModelSelection) {
178
177
  selection = selectionOrPositionOrRange;
179
178
  }
180
- else if (selectionOrPositionOrRange instanceof DocumentSelection) {
179
+ else if (selectionOrPositionOrRange instanceof ModelDocumentSelection) {
181
180
  selection = selectionOrPositionOrRange;
182
181
  }
183
182
  else if (selectionOrPositionOrRange instanceof ModelRange) {
@@ -189,7 +188,7 @@ export function stringify(node, selectionOrPositionOrRange = null, markers = nul
189
188
  // Set up conversion.
190
189
  // Create a temporary view controller.
191
190
  const stylesProcessor = new StylesProcessor();
192
- const view = new View(stylesProcessor);
191
+ const view = new EditingView(stylesProcessor);
193
192
  const viewDocument = view.document;
194
193
  const viewRoot = new ViewRootEditableElement(viewDocument, 'div');
195
194
  // Create a temporary root element in view document.
@@ -202,7 +201,7 @@ export function stringify(node, selectionOrPositionOrRange = null, markers = nul
202
201
  downcastDispatcher.on('insert:$text', insertText());
203
202
  downcastDispatcher.on('insert', insertAttributesAndChildren(), { priority: 'lowest' });
204
203
  downcastDispatcher.on('attribute', (evt, data, conversionApi) => {
205
- if (data.item instanceof ModelSelection || data.item instanceof DocumentSelection || data.item.is('$textProxy')) {
204
+ if (data.item instanceof ModelSelection || data.item instanceof ModelDocumentSelection || data.item.is('$textProxy')) {
206
205
  const converter = wrap((modelAttributeValue, { writer }) => {
207
206
  return writer.createAttributeElement('model-text-with-attributes', { [data.attributeKey]: stringifyAttributeValue(modelAttributeValue) });
208
207
  });
@@ -235,7 +234,7 @@ export function stringify(node, selectionOrPositionOrRange = null, markers = nul
235
234
  downcastDispatcher.convertSelection(selection, markers || model.markers, writer);
236
235
  }
237
236
  // Parse view to data string.
238
- let data = viewStringify(viewRoot, viewDocument.selection, { sameSelectionCharacters: true });
237
+ let data = _stringifyView(viewRoot, viewDocument.selection, { sameSelectionCharacters: true });
239
238
  // Removing unnecessary <div> and </div> added because `viewRoot` was also stringified alongside input data.
240
239
  data = data.substr(5, data.length - 11);
241
240
  view.destroy();
@@ -243,9 +242,9 @@ export function stringify(node, selectionOrPositionOrRange = null, markers = nul
243
242
  return data.replace(new RegExp('model-text-with-attributes', 'g'), '$text');
244
243
  }
245
244
  /**
246
- * Parses an HTML-like string and returns the model {@link module:engine/model/rootelement~RootElement rootElement}.
245
+ * Parses an HTML-like string and returns the model {@link module:engine/model/rootelement~ModelRootElement rootElement}.
247
246
  *
248
- * **Note:** To create a {@link module:engine/model/text~Text text} node that contains attributes use:
247
+ * **Note:** To create a {@link module:engine/model/text~ModelText text} node that contains attributes use:
249
248
  *
250
249
  * ```xml
251
250
  * <$text attribute="value">Text data</$text>
@@ -260,12 +259,12 @@ export function stringify(node, selectionOrPositionOrRange = null, markers = nul
260
259
  * @returns Returns the parsed model node or an object with two fields: `model` and `selection`,
261
260
  * when selection ranges were included in the data to parse.
262
261
  */
263
- export function parse(data, schema, options = {}) {
262
+ export function _parseModel(data, schema, options = {}) {
264
263
  const mapper = new Mapper();
265
264
  // Replace not accepted by XML `$text` tag name by valid one `model-text-with-attributes`.
266
265
  data = data.replace(new RegExp('\\$text', 'g'), 'model-text-with-attributes');
267
266
  // Parse data to view using view utils.
268
- const parsedResult = viewParse(data, {
267
+ const parsedResult = _parseView(data, {
269
268
  sameSelectionCharacters: true,
270
269
  lastRangeBackward: !!options.lastRangeBackward,
271
270
  inlineObjectElements: options.inlineObjectElements
@@ -2,12 +2,14 @@
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 Model from '../model/model.js';
6
- import type Operation from '../model/operation/operation.js';
5
+ import { type Model } from '../model/model.js';
6
+ import { type Operation } from '../model/operation/operation.js';
7
7
  /**
8
8
  * Operation replayer is a development tool created for easy replaying of operations on the document from stringified operations.
9
+ *
10
+ * @internal
9
11
  */
10
- export default class OperationReplayer {
12
+ export declare class OperationReplayer {
11
13
  private _model;
12
14
  private _logSeparator;
13
15
  private _operationsToReplay;
@@ -5,11 +5,13 @@
5
5
  /**
6
6
  * @module engine/dev-utils/operationreplayer
7
7
  */
8
- import OperationFactory from '../model/operation/operationfactory.js';
8
+ import { OperationFactory } from '../model/operation/operationfactory.js';
9
9
  /**
10
10
  * Operation replayer is a development tool created for easy replaying of operations on the document from stringified operations.
11
+ *
12
+ * @internal
11
13
  */
12
- export default class OperationReplayer {
14
+ export class OperationReplayer {
13
15
  _model;
14
16
  _logSeparator;
15
17
  _operationsToReplay;
@@ -14,6 +14,7 @@
14
14
  *
15
15
  * @param map Map to convert.
16
16
  * @returns Converted map.
17
+ * @internal
17
18
  */
18
19
  export declare function convertMapToTags(map: Iterable<[string, unknown]>): string;
19
20
  /**
@@ -21,17 +22,24 @@ export declare function convertMapToTags(map: Iterable<[string, unknown]>): stri
21
22
  *
22
23
  * @param map Map to convert.
23
24
  * @returns Converted map.
25
+ * @internal
24
26
  */
25
27
  export declare function convertMapToStringifiedObject(map: Iterable<[string, unknown]>): string;
26
28
  /**
27
29
  * Helper function that stores the `document` state for a given `version`.
30
+ *
31
+ * @internal
28
32
  */
29
33
  export declare function dumpTrees(document: any, version: any): void;
30
34
  /**
31
35
  * Helper function that initializes document dumping.
36
+ *
37
+ * @internal
32
38
  */
33
39
  export declare function initDocumentDumping(document: any): void;
34
40
  /**
35
41
  * Helper function that logs document for the given version.
42
+ *
43
+ * @internal
36
44
  */
37
45
  export declare function logDocument(document: any, version: any): void;
@@ -15,6 +15,7 @@
15
15
  *
16
16
  * @param map Map to convert.
17
17
  * @returns Converted map.
18
+ * @internal
18
19
  */
19
20
  export function convertMapToTags(map) {
20
21
  let string = '';
@@ -28,6 +29,7 @@ export function convertMapToTags(map) {
28
29
  *
29
30
  * @param map Map to convert.
30
31
  * @returns Converted map.
32
+ * @internal
31
33
  */
32
34
  export function convertMapToStringifiedObject(map) {
33
35
  const obj = {};
@@ -40,6 +42,8 @@ const treeDump = Symbol('_treeDump');
40
42
  const maxTreeDumpLength = 20;
41
43
  /**
42
44
  * Helper function that stores the `document` state for a given `version`.
45
+ *
46
+ * @internal
43
47
  */
44
48
  export function dumpTrees(document, version) {
45
49
  console.log(document, version);
@@ -55,12 +59,16 @@ export function dumpTrees(document, version) {
55
59
  }
56
60
  /**
57
61
  * Helper function that initializes document dumping.
62
+ *
63
+ * @internal
58
64
  */
59
65
  export function initDocumentDumping(document) {
60
66
  document[treeDump] = [];
61
67
  }
62
68
  /**
63
69
  * Helper function that logs document for the given version.
70
+ *
71
+ * @internal
64
72
  */
65
73
  export function logDocument(document, version) {
66
74
  console.log('--------------------');
@@ -8,16 +8,16 @@
8
8
  /**
9
9
  * Collection of methods for manipulating the {@link module:engine/view/view view} for testing purposes.
10
10
  */
11
- import View from '../view/view.js';
12
- import ViewDocumentFragment from '../view/documentfragment.js';
13
- import ViewElement from '../view/element.js';
14
- import DocumentSelection from '../view/documentselection.js';
15
- import Range from '../view/range.js';
16
- import Position from '../view/position.js';
17
- import type ViewNode from '../view/node.js';
18
- import type DomConverter from '../view/domconverter.js';
11
+ import { EditingView } from '../view/view.js';
12
+ import { ViewDocumentFragment } from '../view/documentfragment.js';
13
+ import { ViewElement } from '../view/element.js';
14
+ import { ViewDocumentSelection } from '../view/documentselection.js';
15
+ import { ViewRange } from '../view/range.js';
16
+ import { ViewPosition } from '../view/position.js';
17
+ import { type ViewNode } from '../view/node.js';
18
+ import { type ViewDomConverter } from '../view/domconverter.js';
19
19
  /**
20
- * Writes the content of the {@link module:engine/view/document~Document document} to an HTML-like string.
20
+ * Writes the content of the {@link module:engine/view/document~ViewDocument document} to an HTML-like string.
21
21
  *
22
22
  * @param view The view to stringify.
23
23
  * @param options.withoutSelection Whether to write the selection. When set to `true`, the selection will
@@ -29,57 +29,58 @@ import type DomConverter from '../view/domconverter.js';
29
29
  * @param options.showPriority When set to `true`, the attribute element's priority will be printed
30
30
  * (`<span view-priority="12">`, `<b view-priority="10">`).
31
31
  * @param options.renderUIElements When set to `true`, the inner content of each
32
- * {@link module:engine/view/uielement~UIElement} will be printed.
32
+ * {@link module:engine/view/uielement~ViewUIElement} will be printed.
33
33
  * @param options.renderRawElements When set to `true`, the inner content of each
34
- * {@link module:engine/view/rawelement~RawElement} will be printed.
35
- * @param options.domConverter When set to an actual {@link module:engine/view/domconverter~DomConverter DomConverter}
34
+ * {@link module:engine/view/rawelement~ViewRawElement} will be printed.
35
+ * @param options.domConverter When set to an actual {@link module:engine/view/domconverter~ViewDomConverter ViewDomConverter}
36
36
  * instance, it lets the conversion go through exactly the same flow the editing view is going through,
37
37
  * i.e. with view data filtering. Otherwise the simple stub is used.
38
38
  * @returns The stringified data.
39
39
  */
40
- export declare function getData(view: View, options?: {
40
+ export declare function _getViewData(view: EditingView, options?: {
41
41
  withoutSelection?: boolean;
42
42
  rootName?: string;
43
43
  showType?: boolean;
44
44
  showPriority?: boolean;
45
45
  renderUIElements?: boolean;
46
46
  renderRawElements?: boolean;
47
- domConverter?: DomConverter;
47
+ domConverter?: ViewDomConverter;
48
+ skipListItemIds?: boolean;
48
49
  }): string;
49
- export declare namespace getData {
50
- var _stringify: typeof stringify;
50
+ export declare namespace _getViewData {
51
+ var _stringify: typeof _stringifyView;
51
52
  }
52
53
  /**
53
- * Sets the content of a view {@link module:engine/view/document~Document document} provided as an HTML-like string.
54
+ * Sets the content of a view {@link module:engine/view/document~ViewDocument document} provided as an HTML-like string.
54
55
  *
55
56
  * @param data An HTML-like string to write into the document.
56
- * @param options.rootName The root name where parsed data will be stored. If not provided,
57
+ * @param options.rootName The root name where _parseViewd data will be stored. If not provided,
57
58
  * the default `main` name will be used.
58
59
  */
59
- export declare function setData(view: View, data: string, options?: {
60
+ export declare function _setViewData(view: EditingView, data: string, options?: {
60
61
  rootName?: string;
61
62
  }): void;
62
- export declare namespace setData {
63
- var _parse: typeof parse;
63
+ export declare namespace _setViewData {
64
+ var _parse: typeof _parseView;
64
65
  }
65
66
  /**
66
67
  * Converts view elements to HTML-like string representation.
67
68
  *
68
- * A root element can be provided as {@link module:engine/view/text~Text text}:
69
+ * A root element can be provided as {@link module:engine/view/text~ViewText text}:
69
70
  *
70
71
  * ```ts
71
72
  * const text = downcastWriter.createText( 'foobar' );
72
73
  * stringify( text ); // 'foobar'
73
74
  * ```
74
75
  *
75
- * or as an {@link module:engine/view/element~Element element}:
76
+ * or as an {@link module:engine/view/element~ViewElement element}:
76
77
  *
77
78
  * ```ts
78
79
  * const element = downcastWriter.createElement( 'p', null, downcastWriter.createText( 'foobar' ) );
79
80
  * stringify( element ); // '<p>foobar</p>'
80
81
  * ```
81
82
  *
82
- * or as a {@link module:engine/view/documentfragment~DocumentFragment document fragment}:
83
+ * or as a {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}:
83
84
  *
84
85
  * ```ts
85
86
  * const text = downcastWriter.createText( 'foobar' );
@@ -90,7 +91,7 @@ export declare namespace setData {
90
91
  * stringify( fragment ); // '<p style="color:red;"></p><b name="test">foobar</b>'
91
92
  * ```
92
93
  *
93
- * Additionally, a {@link module:engine/view/documentselection~DocumentSelection selection} instance can be provided.
94
+ * Additionally, a {@link module:engine/view/documentselection~ViewDocumentSelection selection} instance can be provided.
94
95
  * Ranges from the selection will then be included in the output data.
95
96
  * If a range position is placed inside the element node, it will be represented with `[` and `]`:
96
97
  *
@@ -135,8 +136,8 @@ export declare namespace setData {
135
136
  * stringify( text, selection ); // '{f}oo{ba}r'
136
137
  * ```
137
138
  *
138
- * A {@link module:engine/view/range~Range range} or {@link module:engine/view/position~Position position} instance can be provided
139
- * instead of the {@link module:engine/view/documentselection~DocumentSelection selection} instance. If a range instance
139
+ * A {@link module:engine/view/range~ViewRange range} or {@link module:engine/view/position~ViewPosition position} instance can be provided
140
+ * instead of the {@link module:engine/view/documentselection~ViewDocumentSelection selection} instance. If a range instance
140
141
  * is provided, it will be converted to a selection containing this range. If a position instance is provided, it will
141
142
  * be converted to a selection containing one range collapsed at this position.
142
143
  *
@@ -151,10 +152,10 @@ export declare namespace setData {
151
152
  *
152
153
  * An additional `options` object can be provided.
153
154
  * If `options.showType` is set to `true`, element's types will be
154
- * presented for {@link module:engine/view/attributeelement~AttributeElement attribute elements},
155
- * {@link module:engine/view/containerelement~ContainerElement container elements}
156
- * {@link module:engine/view/emptyelement~EmptyElement empty elements}
157
- * and {@link module:engine/view/uielement~UIElement UI elements}:
155
+ * presented for {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements},
156
+ * {@link module:engine/view/containerelement~ViewContainerElement container elements}
157
+ * {@link module:engine/view/emptyelement~ViewEmptyElement empty elements}
158
+ * and {@link module:engine/view/uielement~ViewUIElement UI elements}:
158
159
  *
159
160
  * ```ts
160
161
  * const attribute = downcastWriter.createAttributeElement( 'b' );
@@ -168,7 +169,7 @@ export declare namespace setData {
168
169
  * ```
169
170
  *
170
171
  * If `options.showPriority` is set to `true`, a priority will be displayed for all
171
- * {@link module:engine/view/attributeelement~AttributeElement attribute elements}.
172
+ * {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements}.
172
173
  *
173
174
  * ```ts
174
175
  * const attribute = downcastWriter.createAttributeElement( 'b' );
@@ -177,7 +178,7 @@ export declare namespace setData {
177
178
  * ```
178
179
  *
179
180
  * If `options.showAttributeElementId` is set to `true`, the attribute element's id will be displayed for all
180
- * {@link module:engine/view/attributeelement~AttributeElement attribute elements} that have it set.
181
+ * {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} that have it set.
181
182
  *
182
183
  * ```ts
183
184
  * const attribute = downcastWriter.createAttributeElement( 'span' );
@@ -197,19 +198,19 @@ export declare namespace setData {
197
198
  * @param options.showAttributeElementId When set to `true`, attribute element's id will be printed
198
199
  * (`<span id="marker:foo">`).
199
200
  * @param options.ignoreRoot When set to `true`, the root's element opening and closing will not be printed.
200
- * Mainly used by the `getData` function to ignore the {@link module:engine/view/document~Document document's} root element.
201
+ * Mainly used by the `getData` function to ignore the {@link module:engine/view/document~ViewDocument document's} root element.
201
202
  * @param options.sameSelectionCharacters When set to `true`, the selection inside the text will be marked as
202
203
  * `{` and `}` and the selection outside the text as `[` and `]`. When set to `false`, both will be marked as `[` and `]` only.
203
204
  * @param options.renderUIElements When set to `true`, the inner content of each
204
- * {@link module:engine/view/uielement~UIElement} will be printed.
205
+ * {@link module:engine/view/uielement~ViewUIElement} will be printed.
205
206
  * @param options.renderRawElements When set to `true`, the inner content of each
206
- * {@link module:engine/view/rawelement~RawElement} will be printed.
207
- * @param options.domConverter When set to an actual {@link module:engine/view/domconverter~DomConverter DomConverter}
207
+ * {@link module:engine/view/rawelement~ViewRawElement} will be printed.
208
+ * @param options.domConverter When set to an actual {@link module:engine/view/domconverter~ViewDomConverter ViewDomConverter}
208
209
  * instance, it lets the conversion go through exactly the same flow the editing view is going through,
209
210
  * i.e. with view data filtering. Otherwise the simple stub is used.
210
211
  * @returns An HTML-like string representing the view.
211
212
  */
212
- export declare function stringify(node: ViewNode | ViewDocumentFragment, selectionOrPositionOrRange?: DocumentSelection | Position | Range | null, options?: {
213
+ export declare function _stringifyView(node: ViewNode | ViewDocumentFragment, selectionOrPositionOrRange?: ViewDocumentSelection | ViewPosition | ViewRange | null, options?: {
213
214
  showType?: boolean;
214
215
  showPriority?: boolean;
215
216
  showAttributeElementId?: boolean;
@@ -217,96 +218,98 @@ export declare function stringify(node: ViewNode | ViewDocumentFragment, selecti
217
218
  sameSelectionCharacters?: boolean;
218
219
  renderUIElements?: boolean;
219
220
  renderRawElements?: boolean;
220
- domConverter?: DomConverter;
221
+ domConverter?: ViewDomConverter;
222
+ skipListItemIds?: boolean;
221
223
  }): string;
222
224
  /**
223
225
  * Parses an HTML-like string and returns a view tree.
224
- * A simple string will be converted to a {@link module:engine/view/text~Text text} node:
226
+ * A simple string will be converted to a {@link module:engine/view/text~ViewText text} node:
225
227
  *
226
228
  * ```ts
227
- * parse( 'foobar' ); // Returns an instance of text.
229
+ * _parseView( 'foobar' ); // Returns an instance of text.
228
230
  * ```
229
231
  *
230
- * {@link module:engine/view/element~Element Elements} will be parsed with attributes as children:
232
+ * {@link module:engine/view/element~ViewElement Elements} will be _parseViewd with attributes as children:
231
233
  *
232
234
  * ```ts
233
- * parse( '<b name="baz">foobar</b>' ); // Returns an instance of element with the `baz` attribute and a text child node.
235
+ * _parseView( '<b name="baz">foobar</b>' ); // Returns an instance of element with the `baz` attribute and a text child node.
234
236
  * ```
235
237
  *
236
238
  * Multiple nodes provided on root level will be converted to a
237
- * {@link module:engine/view/documentfragment~DocumentFragment document fragment}:
239
+ * {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}:
238
240
  *
239
241
  * ```ts
240
- * parse( '<b>foo</b><i>bar</i>' ); // Returns a document fragment with two child elements.
242
+ * _parseView( '<b>foo</b><i>bar</i>' ); // Returns a document fragment with two child elements.
241
243
  * ```
242
244
  *
243
- * The method can parse multiple {@link module:engine/view/range~Range ranges} provided in string data and return a
244
- * {@link module:engine/view/documentselection~DocumentSelection selection} instance containing these ranges. Ranges placed inside
245
- * {@link module:engine/view/text~Text text} nodes should be marked using `{` and `}` brackets:
245
+ * The method can _parseView multiple {@link module:engine/view/range~ViewRange ranges} provided in string data and return a
246
+ * {@link module:engine/view/documentselection~ViewDocumentSelection selection} instance containing these ranges. Ranges placed inside
247
+ * {@link module:engine/view/text~ViewText text} nodes should be marked using `{` and `}` brackets:
246
248
  *
247
249
  * ```ts
248
- * const { text, selection } = parse( 'f{ooba}r' );
250
+ * const { text, selection } = _parseView( 'f{ooba}r' );
249
251
  * ```
250
252
  *
251
253
  * Ranges placed outside text nodes should be marked using `[` and `]` brackets:
252
254
  *
253
255
  * ```ts
254
- * const { root, selection } = parse( '<p>[<b>foobar</b>]</p>' );
256
+ * const { root, selection } = _parseView( '<p>[<b>foobar</b>]</p>' );
255
257
  * ```
256
258
  *
257
259
  * ** Note: **
258
260
  * It is possible to unify selection markers to `[` and `]` for both (inside and outside text)
259
- * by setting `sameSelectionCharacters=true` option. It is mainly used when the view parse option is used by model utilities.
261
+ * by setting `sameSelectionCharacters=true` option. It is mainly used when the view _parseView option is used by model utilities.
260
262
  *
261
263
  * Sometimes there is a need for defining the order of ranges inside the created selection. This can be achieved by providing
262
264
  * the range order array as an additional parameter:
263
265
  *
264
266
  * ```ts
265
- * const { root, selection } = parse( '{fo}ob{ar}{ba}z', { order: [ 2, 3, 1 ] } );
267
+ * const { root, selection } = _parseView( '{fo}ob{ar}{ba}z', { order: [ 2, 3, 1 ] } );
266
268
  * ```
267
269
  *
268
270
  * In the example above, the first range (`{fo}`) will be added to the selection as the second one, the second range (`{ar}`) will be
269
271
  * added as the third and the third range (`{ba}`) will be added as the first one.
270
272
  *
271
273
  * If the selection's last range should be added as a backward one
272
- * (so the {@link module:engine/view/documentselection~DocumentSelection#anchor selection anchor} is represented
273
- * by the `end` position and {@link module:engine/view/documentselection~DocumentSelection#focus selection focus} is
274
+ * (so the {@link module:engine/view/documentselection~ViewDocumentSelection#anchor selection anchor} is represented
275
+ * by the `end` position and {@link module:engine/view/documentselection~ViewDocumentSelection#focus selection focus} is
274
276
  * represented by the `start` position), use the `lastRangeBackward` flag:
275
277
  *
276
278
  * ```ts
277
- * const { root, selection } = parse( `{foo}bar{baz}`, { lastRangeBackward: true } );
279
+ * const { root, selection } = _parseView( `{foo}bar{baz}`, { lastRangeBackward: true } );
278
280
  * ```
279
281
  *
280
282
  * Some more examples and edge cases:
281
283
  *
282
284
  * ```ts
283
285
  * // Returns an empty document fragment.
284
- * parse( '' );
286
+ * _parseView( '' );
285
287
  *
286
288
  * // Returns an empty document fragment and a collapsed selection.
287
- * const { root, selection } = parse( '[]' );
289
+ * const { root, selection } = _parseView( '[]' );
288
290
  *
289
291
  * // Returns an element and a selection that is placed inside the document fragment containing that element.
290
- * const { root, selection } = parse( '[<a></a>]' );
292
+ * const { root, selection } = _parseView( '[<a></a>]' );
291
293
  * ```
292
294
  *
293
295
  * @param data An HTML-like string to be parsed.
294
296
  * @param options.order An array with the order of parsed ranges added to the returned
295
- * {@link module:engine/view/documentselection~DocumentSelection Selection} instance. Each element should represent the
297
+ * {@link module:engine/view/documentselection~ViewDocumentSelection Selection} instance. Each element should represent the
296
298
  * desired position of each range in the selection instance. For example: `[2, 3, 1]` means that the first range will be
297
299
  * placed as the second, the second as the third and the third as the first.
298
300
  * @param options.lastRangeBackward If set to `true`, the last range will be added as backward to the returned
299
- * {@link module:engine/view/documentselection~DocumentSelection selection} instance.
301
+ * {@link module:engine/view/documentselection~ViewDocumentSelection selection} instance.
300
302
  * @param options.rootElement The default root to use when parsing elements.
301
303
  * When set to `null`, the root element will be created automatically. If set to
302
- * {@link module:engine/view/element~Element Element} or {@link module:engine/view/documentfragment~DocumentFragment DocumentFragment},
304
+ * {@link module:engine/view/element~ViewElement Element} or
305
+ * {@link module:engine/view/documentfragment~ViewDocumentFragment DocumentFragment},
303
306
  * this node will be used as the root for all parsed nodes.
304
307
  * @param options.sameSelectionCharacters When set to `false`, the selection inside the text should be marked using
305
308
  * `{` and `}` and the selection outside the ext using `[` and `]`. When set to `true`, both should be marked with `[` and `]` only.
306
309
  * @returns Returns the parsed view node or an object with two fields: `view` and `selection` when selection ranges were included in the
307
310
  * data to parse.
308
311
  */
309
- export declare function parse(data: string, options?: {
312
+ export declare function _parseView(data: string, options?: {
310
313
  order?: Array<number>;
311
314
  lastRangeBackward?: boolean;
312
315
  rootElement?: ViewElement | ViewDocumentFragment;
@@ -314,5 +317,5 @@ export declare function parse(data: string, options?: {
314
317
  inlineObjectElements?: Array<string>;
315
318
  }): ViewNode | ViewDocumentFragment | {
316
319
  view: ViewNode | ViewDocumentFragment;
317
- selection: DocumentSelection;
320
+ selection: ViewDocumentSelection;
318
321
  };