@ckeditor/ckeditor5-engine 38.2.0-alpha.0 → 38.2.0-alpha.1

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 (210) hide show
  1. package/package.json +2 -2
  2. package/src/controller/datacontroller.d.ts +15 -15
  3. package/src/controller/datacontroller.js +11 -11
  4. package/src/controller/editingcontroller.d.ts +7 -7
  5. package/src/controller/editingcontroller.js +7 -7
  6. package/src/conversion/conversion.d.ts +6 -6
  7. package/src/conversion/conversion.js +2 -2
  8. package/src/conversion/downcastdispatcher.d.ts +13 -13
  9. package/src/conversion/downcastdispatcher.js +2 -2
  10. package/src/conversion/downcasthelpers.d.ts +19 -19
  11. package/src/conversion/downcasthelpers.js +9 -9
  12. package/src/conversion/mapper.d.ts +9 -9
  13. package/src/conversion/mapper.js +5 -5
  14. package/src/conversion/modelconsumable.d.ts +5 -5
  15. package/src/conversion/modelconsumable.js +1 -1
  16. package/src/conversion/upcastdispatcher.d.ts +12 -12
  17. package/src/conversion/upcastdispatcher.js +5 -5
  18. package/src/conversion/upcasthelpers.d.ts +9 -9
  19. package/src/conversion/upcasthelpers.js +3 -3
  20. package/src/conversion/viewconsumable.d.ts +5 -5
  21. package/src/dataprocessor/basichtmlwriter.d.ts +1 -1
  22. package/src/dataprocessor/dataprocessor.d.ts +2 -2
  23. package/src/dataprocessor/htmldataprocessor.d.ts +6 -6
  24. package/src/dataprocessor/htmldataprocessor.js +2 -2
  25. package/src/dataprocessor/xmldataprocessor.d.ts +6 -6
  26. package/src/dataprocessor/xmldataprocessor.js +2 -2
  27. package/src/dev-utils/model.d.ts +10 -10
  28. package/src/dev-utils/model.js +16 -16
  29. package/src/dev-utils/operationreplayer.d.ts +2 -2
  30. package/src/dev-utils/operationreplayer.js +1 -1
  31. package/src/dev-utils/view.d.ts +8 -8
  32. package/src/dev-utils/view.js +14 -14
  33. package/src/index.d.ts +106 -106
  34. package/src/index.js +64 -64
  35. package/src/model/batch.d.ts +1 -1
  36. package/src/model/differ.d.ts +5 -5
  37. package/src/model/differ.js +2 -2
  38. package/src/model/document.d.ts +11 -9
  39. package/src/model/document.js +4 -4
  40. package/src/model/documentfragment.d.ts +4 -4
  41. package/src/model/documentfragment.js +5 -5
  42. package/src/model/documentselection.d.ts +8 -8
  43. package/src/model/documentselection.js +10 -7
  44. package/src/model/element.d.ts +2 -2
  45. package/src/model/element.js +4 -4
  46. package/src/model/history.d.ts +1 -1
  47. package/src/model/item.d.ts +2 -2
  48. package/src/model/liveposition.d.ts +4 -4
  49. package/src/model/liveposition.js +1 -1
  50. package/src/model/liverange.d.ts +5 -5
  51. package/src/model/liverange.js +1 -1
  52. package/src/model/markercollection.d.ts +4 -4
  53. package/src/model/markercollection.js +2 -2
  54. package/src/model/model.d.ts +14 -14
  55. package/src/model/model.js +18 -18
  56. package/src/model/node.d.ts +5 -5
  57. package/src/model/node.js +2 -2
  58. package/src/model/nodelist.d.ts +1 -1
  59. package/src/model/nodelist.js +1 -1
  60. package/src/model/operation/attributeoperation.d.ts +4 -4
  61. package/src/model/operation/attributeoperation.js +3 -3
  62. package/src/model/operation/detachoperation.d.ts +3 -3
  63. package/src/model/operation/detachoperation.js +3 -3
  64. package/src/model/operation/insertoperation.d.ts +6 -6
  65. package/src/model/operation/insertoperation.js +7 -7
  66. package/src/model/operation/markeroperation.d.ts +5 -5
  67. package/src/model/operation/markeroperation.js +2 -2
  68. package/src/model/operation/mergeoperation.d.ts +5 -5
  69. package/src/model/operation/mergeoperation.js +5 -5
  70. package/src/model/operation/moveoperation.d.ts +4 -4
  71. package/src/model/operation/moveoperation.js +4 -4
  72. package/src/model/operation/nooperation.d.ts +2 -2
  73. package/src/model/operation/nooperation.js +1 -1
  74. package/src/model/operation/operation.d.ts +3 -3
  75. package/src/model/operation/operationfactory.d.ts +2 -2
  76. package/src/model/operation/operationfactory.js +11 -11
  77. package/src/model/operation/renameoperation.d.ts +4 -4
  78. package/src/model/operation/renameoperation.js +3 -3
  79. package/src/model/operation/rootattributeoperation.d.ts +4 -4
  80. package/src/model/operation/rootattributeoperation.js +1 -1
  81. package/src/model/operation/rootoperation.d.ts +3 -3
  82. package/src/model/operation/rootoperation.js +1 -1
  83. package/src/model/operation/splitoperation.d.ts +5 -5
  84. package/src/model/operation/splitoperation.js +5 -5
  85. package/src/model/operation/transform.d.ts +2 -2
  86. package/src/model/operation/transform.js +12 -12
  87. package/src/model/operation/utils.d.ts +6 -6
  88. package/src/model/operation/utils.js +4 -4
  89. package/src/model/position.d.ts +14 -14
  90. package/src/model/position.js +3 -3
  91. package/src/model/range.d.ts +12 -12
  92. package/src/model/range.js +3 -3
  93. package/src/model/rootelement.d.ts +2 -2
  94. package/src/model/rootelement.js +1 -1
  95. package/src/model/schema.d.ts +19 -9
  96. package/src/model/schema.js +5 -5
  97. package/src/model/selection.d.ts +7 -7
  98. package/src/model/selection.js +4 -4
  99. package/src/model/text.d.ts +1 -1
  100. package/src/model/text.js +1 -1
  101. package/src/model/textproxy.d.ts +5 -5
  102. package/src/model/textproxy.js +1 -1
  103. package/src/model/treewalker.d.ts +3 -3
  104. package/src/model/treewalker.js +4 -4
  105. package/src/model/typecheckable.d.ts +13 -13
  106. package/src/model/utils/autoparagraphing.d.ts +4 -4
  107. package/src/model/utils/deletecontent.d.ts +3 -3
  108. package/src/model/utils/deletecontent.js +3 -3
  109. package/src/model/utils/findoptimalinsertionrange.d.ts +4 -4
  110. package/src/model/utils/getselectedcontent.d.ts +4 -4
  111. package/src/model/utils/insertcontent.d.ts +6 -6
  112. package/src/model/utils/insertcontent.js +6 -6
  113. package/src/model/utils/insertobject.d.ts +5 -5
  114. package/src/model/utils/insertobject.js +1 -1
  115. package/src/model/utils/modifyselection.d.ts +3 -3
  116. package/src/model/utils/modifyselection.js +4 -4
  117. package/src/model/utils/selection-post-fixer.d.ts +3 -3
  118. package/src/model/utils/selection-post-fixer.js +2 -2
  119. package/src/model/writer.d.ts +12 -12
  120. package/src/model/writer.js +17 -17
  121. package/src/view/attributeelement.d.ts +3 -3
  122. package/src/view/attributeelement.js +1 -1
  123. package/src/view/containerelement.d.ts +3 -3
  124. package/src/view/containerelement.js +1 -1
  125. package/src/view/document.d.ts +4 -4
  126. package/src/view/document.js +2 -2
  127. package/src/view/documentfragment.d.ts +4 -4
  128. package/src/view/documentfragment.js +3 -3
  129. package/src/view/documentselection.d.ts +8 -8
  130. package/src/view/documentselection.js +2 -2
  131. package/src/view/domconverter.d.ts +50 -66
  132. package/src/view/domconverter.js +258 -224
  133. package/src/view/downcastwriter.d.ts +17 -17
  134. package/src/view/downcastwriter.js +11 -11
  135. package/src/view/editableelement.d.ts +4 -4
  136. package/src/view/editableelement.js +1 -1
  137. package/src/view/element.d.ts +5 -5
  138. package/src/view/element.js +5 -5
  139. package/src/view/emptyelement.d.ts +4 -4
  140. package/src/view/emptyelement.js +2 -2
  141. package/src/view/filler.d.ts +3 -3
  142. package/src/view/filler.js +6 -4
  143. package/src/view/item.d.ts +2 -2
  144. package/src/view/matcher.d.ts +1 -1
  145. package/src/view/node.d.ts +5 -5
  146. package/src/view/node.js +2 -2
  147. package/src/view/observer/arrowkeysobserver.d.ts +4 -4
  148. package/src/view/observer/arrowkeysobserver.js +2 -2
  149. package/src/view/observer/bubblingemittermixin.d.ts +2 -2
  150. package/src/view/observer/bubblingemittermixin.js +1 -1
  151. package/src/view/observer/bubblingeventinfo.d.ts +3 -3
  152. package/src/view/observer/clickobserver.d.ts +3 -3
  153. package/src/view/observer/clickobserver.js +1 -1
  154. package/src/view/observer/compositionobserver.d.ts +3 -3
  155. package/src/view/observer/compositionobserver.js +1 -1
  156. package/src/view/observer/domeventdata.d.ts +3 -3
  157. package/src/view/observer/domeventobserver.d.ts +1 -1
  158. package/src/view/observer/domeventobserver.js +2 -2
  159. package/src/view/observer/fakeselectionobserver.d.ts +2 -2
  160. package/src/view/observer/fakeselectionobserver.js +2 -2
  161. package/src/view/observer/focusobserver.d.ts +3 -3
  162. package/src/view/observer/focusobserver.js +1 -1
  163. package/src/view/observer/inputobserver.d.ts +4 -4
  164. package/src/view/observer/inputobserver.js +2 -2
  165. package/src/view/observer/keyobserver.d.ts +2 -2
  166. package/src/view/observer/keyobserver.js +1 -1
  167. package/src/view/observer/mouseobserver.d.ts +2 -2
  168. package/src/view/observer/mouseobserver.js +1 -1
  169. package/src/view/observer/mutationobserver.d.ts +4 -4
  170. package/src/view/observer/mutationobserver.js +2 -2
  171. package/src/view/observer/observer.d.ts +2 -2
  172. package/src/view/observer/selectionobserver.d.ts +7 -7
  173. package/src/view/observer/selectionobserver.js +3 -3
  174. package/src/view/observer/tabobserver.d.ts +4 -4
  175. package/src/view/observer/tabobserver.js +2 -2
  176. package/src/view/placeholder.d.ts +3 -3
  177. package/src/view/position.d.ts +7 -7
  178. package/src/view/position.js +4 -4
  179. package/src/view/range.d.ts +7 -7
  180. package/src/view/range.js +3 -3
  181. package/src/view/rawelement.d.ts +5 -5
  182. package/src/view/rawelement.js +2 -2
  183. package/src/view/renderer.d.ts +5 -5
  184. package/src/view/renderer.js +3 -3
  185. package/src/view/rooteditableelement.d.ts +2 -2
  186. package/src/view/rooteditableelement.js +1 -1
  187. package/src/view/selection.d.ts +8 -8
  188. package/src/view/selection.js +5 -5
  189. package/src/view/styles/background.d.ts +1 -1
  190. package/src/view/styles/background.js +1 -1
  191. package/src/view/styles/border.d.ts +1 -1
  192. package/src/view/styles/border.js +1 -1
  193. package/src/view/styles/margin.d.ts +1 -1
  194. package/src/view/styles/margin.js +1 -1
  195. package/src/view/styles/padding.d.ts +1 -1
  196. package/src/view/styles/padding.js +1 -1
  197. package/src/view/styles/utils.d.ts +1 -1
  198. package/src/view/text.d.ts +2 -2
  199. package/src/view/text.js +1 -1
  200. package/src/view/textproxy.d.ts +6 -6
  201. package/src/view/textproxy.js +1 -1
  202. package/src/view/treewalker.d.ts +3 -3
  203. package/src/view/treewalker.js +4 -4
  204. package/src/view/typecheckable.d.ts +16 -16
  205. package/src/view/uielement.d.ts +6 -6
  206. package/src/view/uielement.js +2 -2
  207. package/src/view/upcastwriter.d.ts +9 -9
  208. package/src/view/upcastwriter.js +6 -6
  209. package/src/view/view.d.ts +12 -12
  210. package/src/view/view.js +18 -18
@@ -5,12 +5,12 @@
5
5
  /**
6
6
  * @module engine/model/utils/insertcontent
7
7
  */
8
- import DocumentSelection from '../documentselection';
9
- import Element from '../element';
10
- import LivePosition from '../liveposition';
11
- import LiveRange from '../liverange';
12
- import Position from '../position';
13
- import Range from '../range';
8
+ import DocumentSelection from '../documentselection.js';
9
+ import Element from '../element.js';
10
+ import LivePosition from '../liveposition.js';
11
+ import LiveRange from '../liverange.js';
12
+ import Position from '../position.js';
13
+ import Range from '../range.js';
14
14
  import { CKEditorError } from '@ckeditor/ckeditor5-utils';
15
15
  /**
16
16
  * Inserts content into the editor (specified selection) as one would expect the paste functionality to work.
@@ -2,11 +2,11 @@
2
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
- import type DocumentSelection from '../documentselection';
6
- import type Selection from '../selection';
7
- import type Element from '../element';
8
- import type Model from '../model';
9
- import type Range from '../range';
5
+ import type DocumentSelection from '../documentselection.js';
6
+ import type Selection from '../selection.js';
7
+ import type Element from '../element.js';
8
+ import type Model from '../model.js';
9
+ import type Range from '../range.js';
10
10
  /**
11
11
  * Inserts an {@glink framework/deep-dive/schema#object-elements object element} at a specific position in the editor content.
12
12
  *
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module engine/model/utils/insertobject
7
7
  */
8
- import { findOptimalInsertionRange } from './findoptimalinsertionrange';
8
+ import { findOptimalInsertionRange } from './findoptimalinsertionrange.js';
9
9
  import { CKEditorError, first } from '@ckeditor/ckeditor5-utils';
10
10
  /**
11
11
  * Inserts an {@glink framework/deep-dive/schema#object-elements object element} at a specific position in the editor content.
@@ -5,9 +5,9 @@
5
5
  /**
6
6
  * @module engine/model/utils/modifyselection
7
7
  */
8
- import DocumentSelection from '../documentselection';
9
- import type Model from '../model';
10
- import type Selection from '../selection';
8
+ import DocumentSelection from '../documentselection.js';
9
+ import type Model from '../model.js';
10
+ import type Selection from '../selection.js';
11
11
  /**
12
12
  * Modifies the selection. Currently, the supported modifications are:
13
13
  *
@@ -5,10 +5,10 @@
5
5
  /**
6
6
  * @module engine/model/utils/modifyselection
7
7
  */
8
- import DocumentSelection from '../documentselection';
9
- import Position from '../position';
10
- import Range from '../range';
11
- import TreeWalker from '../treewalker';
8
+ import DocumentSelection from '../documentselection.js';
9
+ import Position from '../position.js';
10
+ import Range from '../range.js';
11
+ import TreeWalker from '../treewalker.js';
12
12
  import { isInsideSurrogatePair, isInsideCombinedSymbol, isInsideEmojiSequence } from '@ckeditor/ckeditor5-utils';
13
13
  const wordBoundaryCharacters = ' ,.?!:;"-()';
14
14
  /**
@@ -2,9 +2,9 @@
2
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
- import Range from '../range';
6
- import type Model from '../model';
7
- import type Schema from '../schema';
5
+ import Range from '../range.js';
6
+ import type Model from '../model.js';
7
+ import type Schema from '../schema.js';
8
8
  /**
9
9
  * Injects selection post-fixer to the model.
10
10
  *
@@ -5,8 +5,8 @@
5
5
  /**
6
6
  * @module engine/model/utils/selection-post-fixer
7
7
  */
8
- import Position from '../position';
9
- import Range from '../range';
8
+ import Position from '../position.js';
9
+ import Range from '../range.js';
10
10
  /**
11
11
  * Injects selection post-fixer to the model.
12
12
  *
@@ -2,18 +2,18 @@
2
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
- import DocumentFragment from './documentfragment';
6
- import Element from './element';
7
- import Position, { type PositionOffset, type PositionStickiness } from './position';
8
- import Range from './range';
9
- import RootElement from './rootelement';
10
- import Text from './text';
11
- import type { Marker } from './markercollection';
12
- import type { default as Selection, PlaceOrOffset, Selectable } from './selection';
13
- import type Batch from './batch';
14
- import type Item from './item';
15
- import type Model from './model';
16
- import type { default as Node, NodeAttributes } from './node';
5
+ import DocumentFragment from './documentfragment.js';
6
+ import Element from './element.js';
7
+ import Position, { type PositionOffset, type PositionStickiness } from './position.js';
8
+ import Range from './range.js';
9
+ import RootElement from './rootelement.js';
10
+ import Text from './text.js';
11
+ import type { Marker } from './markercollection.js';
12
+ import type { default as Selection, PlaceOrOffset, Selectable } from './selection.js';
13
+ import type Batch from './batch.js';
14
+ import type Item from './item.js';
15
+ import type Model from './model.js';
16
+ import type { default as Node, NodeAttributes } from './node.js';
17
17
  /**
18
18
  * The model can only be modified by using the writer. It should be used whenever you want to create a node, modify
19
19
  * child nodes, attributes or text, set the selection's position and its attributes.
@@ -5,23 +5,23 @@
5
5
  /**
6
6
  * @module engine/model/writer
7
7
  */
8
- import AttributeOperation from './operation/attributeoperation';
9
- import DetachOperation from './operation/detachoperation';
10
- import InsertOperation from './operation/insertoperation';
11
- import MarkerOperation from './operation/markeroperation';
12
- import MergeOperation from './operation/mergeoperation';
13
- import MoveOperation from './operation/moveoperation';
14
- import RenameOperation from './operation/renameoperation';
15
- import RootAttributeOperation from './operation/rootattributeoperation';
16
- import RootOperation from './operation/rootoperation';
17
- import SplitOperation from './operation/splitoperation';
18
- import DocumentFragment from './documentfragment';
19
- import DocumentSelection from './documentselection';
20
- import Element from './element';
21
- import Position from './position';
22
- import Range from './range';
23
- import RootElement from './rootelement';
24
- import Text from './text';
8
+ import AttributeOperation from './operation/attributeoperation.js';
9
+ import DetachOperation from './operation/detachoperation.js';
10
+ import InsertOperation from './operation/insertoperation.js';
11
+ import MarkerOperation from './operation/markeroperation.js';
12
+ import MergeOperation from './operation/mergeoperation.js';
13
+ import MoveOperation from './operation/moveoperation.js';
14
+ import RenameOperation from './operation/renameoperation.js';
15
+ import RootAttributeOperation from './operation/rootattributeoperation.js';
16
+ import RootOperation from './operation/rootoperation.js';
17
+ import SplitOperation from './operation/splitoperation.js';
18
+ import DocumentFragment from './documentfragment.js';
19
+ import DocumentSelection from './documentselection.js';
20
+ import Element from './element.js';
21
+ import Position from './position.js';
22
+ import Range from './range.js';
23
+ import RootElement from './rootelement.js';
24
+ import Text from './text.js';
25
25
  import { CKEditorError, logWarning, toMap } from '@ckeditor/ckeditor5-utils';
26
26
  /**
27
27
  * The model can only be modified by using the writer. It should be used whenever you want to create a node, modify
@@ -5,9 +5,9 @@
5
5
  /**
6
6
  * @module engine/view/attributeelement
7
7
  */
8
- import Element, { type ElementAttributes } from './element';
9
- import type Document from './document';
10
- import type Node from './node';
8
+ import Element, { type ElementAttributes } from './element.js';
9
+ import type Document from './document.js';
10
+ import type Node from './node.js';
11
11
  /**
12
12
  * Attribute elements are used to represent formatting elements in the view (think – `<b>`, `<span style="font-size: 2em">`, etc.).
13
13
  * Most often they are created when downcasting model text attributes.
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module engine/view/attributeelement
7
7
  */
8
- import Element from './element';
8
+ import Element from './element.js';
9
9
  import { CKEditorError } from '@ckeditor/ckeditor5-utils';
10
10
  // Default attribute priority.
11
11
  const DEFAULT_PRIORITY = 10;
@@ -5,9 +5,9 @@
5
5
  /**
6
6
  * @module engine/view/containerelement
7
7
  */
8
- import Element, { type ElementAttributes } from './element';
9
- import type Document from './document';
10
- import type Node from './node';
8
+ import Element, { type ElementAttributes } from './element.js';
9
+ import type Document from './document.js';
10
+ import type Node from './node.js';
11
11
  /**
12
12
  * Containers are elements which define document structure. They define boundaries for
13
13
  * {@link module:engine/view/attributeelement~AttributeElement attributes}. They are mostly used for block elements like `<p>` or `<div>`.
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module engine/view/containerelement
7
7
  */
8
- import Element from './element';
8
+ import Element from './element.js';
9
9
  /**
10
10
  * Containers are elements which define document structure. They define boundaries for
11
11
  * {@link module:engine/view/attributeelement~AttributeElement attributes}. They are mostly used for block elements like `<p>` or `<div>`.
@@ -5,11 +5,11 @@
5
5
  /**
6
6
  * @module engine/view/document
7
7
  */
8
- import DocumentSelection from './documentselection';
8
+ import DocumentSelection from './documentselection.js';
9
9
  import { Collection } from '@ckeditor/ckeditor5-utils';
10
- import type { StylesProcessor } from './stylesmap';
11
- import type RootEditableElement from './rooteditableelement';
12
- import type DowncastWriter from './downcastwriter';
10
+ import type { StylesProcessor } from './stylesmap.js';
11
+ import type RootEditableElement from './rooteditableelement.js';
12
+ import type DowncastWriter from './downcastwriter.js';
13
13
  declare const Document_base: import("@ckeditor/ckeditor5-utils").Mixed<{
14
14
  new (): import("@ckeditor/ckeditor5-utils").Observable;
15
15
  prototype: import("@ckeditor/ckeditor5-utils").Observable;
@@ -5,8 +5,8 @@
5
5
  /**
6
6
  * @module engine/view/document
7
7
  */
8
- import DocumentSelection from './documentselection';
9
- import BubblingEmitterMixin from './observer/bubblingemittermixin';
8
+ import DocumentSelection from './documentselection.js';
9
+ import BubblingEmitterMixin from './observer/bubblingemittermixin.js';
10
10
  import { Collection, ObservableMixin } from '@ckeditor/ckeditor5-utils';
11
11
  // @if CK_DEBUG_ENGINE // const { logDocument } = require( '../dev-utils/utils' );
12
12
  /**
@@ -5,10 +5,10 @@
5
5
  /**
6
6
  * @module engine/view/documentfragment
7
7
  */
8
- import TypeCheckable from './typecheckable';
9
- import type { default as Document, ChangeType } from './document';
10
- import type Item from './item';
11
- import type Node from './node';
8
+ import TypeCheckable from './typecheckable.js';
9
+ import type { default as Document, ChangeType } from './document.js';
10
+ import type Item from './item.js';
11
+ import type Node from './node.js';
12
12
  declare const DocumentFragment_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof TypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
13
13
  /**
14
14
  * Document fragment.
@@ -5,9 +5,9 @@
5
5
  /**
6
6
  * @module engine/view/documentfragment
7
7
  */
8
- import TypeCheckable from './typecheckable';
9
- import Text from './text';
10
- import TextProxy from './textproxy';
8
+ import TypeCheckable from './typecheckable.js';
9
+ import Text from './text.js';
10
+ import TextProxy from './textproxy.js';
11
11
  import { EmitterMixin, isIterable } from '@ckeditor/ckeditor5-utils';
12
12
  /**
13
13
  * Document fragment.
@@ -5,14 +5,14 @@
5
5
  /**
6
6
  * @module engine/view/documentselection
7
7
  */
8
- import TypeCheckable from './typecheckable';
9
- import Selection, { type PlaceOrOffset, type Selectable, type SelectionOptions, type ViewSelectionChangeEvent } from './selection';
10
- import type EditableElement from './editableelement';
11
- import type Element from './element';
12
- import type Node from './node';
13
- import type Item from './item';
14
- import type { default as Position, PositionOffset } from './position';
15
- import type Range from './range';
8
+ import TypeCheckable from './typecheckable.js';
9
+ import Selection, { type PlaceOrOffset, type Selectable, type SelectionOptions, type ViewSelectionChangeEvent } from './selection.js';
10
+ import type EditableElement from './editableelement.js';
11
+ import type Element from './element.js';
12
+ import type Node from './node.js';
13
+ import type Item from './item.js';
14
+ import type { default as Position, PositionOffset } from './position.js';
15
+ import type Range from './range.js';
16
16
  declare const DocumentSelection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof TypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
17
17
  /**
18
18
  * Class representing the document selection in the view.
@@ -5,8 +5,8 @@
5
5
  /**
6
6
  * @module engine/view/documentselection
7
7
  */
8
- import TypeCheckable from './typecheckable';
9
- import Selection from './selection';
8
+ import TypeCheckable from './typecheckable.js';
9
+ import Selection from './selection.js';
10
10
  import { EmitterMixin } from '@ckeditor/ckeditor5-utils';
11
11
  /**
12
12
  * Class representing the document selection in the view.
@@ -5,19 +5,19 @@
5
5
  /**
6
6
  * @module engine/view/domconverter
7
7
  */
8
- import ViewText from './text';
9
- import ViewElement from './element';
10
- import ViewUIElement from './uielement';
11
- import ViewPosition from './position';
12
- import ViewRange from './range';
13
- import ViewSelection from './selection';
14
- import ViewDocumentFragment from './documentfragment';
15
- import { type MatcherPattern } from './matcher';
16
- import type ViewNode from './node';
17
- import type Document from './document';
18
- import type DocumentSelection from './documentselection';
19
- import type EditableElement from './editableelement';
20
- import type ViewRawElement from './rawelement';
8
+ import ViewText from './text.js';
9
+ import ViewElement from './element.js';
10
+ import ViewUIElement from './uielement.js';
11
+ import ViewPosition from './position.js';
12
+ import ViewRange from './range.js';
13
+ import ViewSelection from './selection.js';
14
+ import ViewDocumentFragment from './documentfragment.js';
15
+ import { type MatcherPattern } from './matcher.js';
16
+ import type ViewNode from './node.js';
17
+ import type Document from './document.js';
18
+ import type DocumentSelection from './documentselection.js';
19
+ import type EditableElement from './editableelement.js';
20
+ import type ViewRawElement from './rawelement.js';
21
21
  type DomNode = globalThis.Node;
22
22
  type DomElement = globalThis.HTMLElement;
23
23
  type DomDocumentFragment = globalThis.DocumentFragment;
@@ -98,9 +98,9 @@ export default class DomConverter {
98
98
  */
99
99
  private readonly _rawContentElementMatcher;
100
100
  /**
101
- * A set of encountered raw content DOM nodes. It is used for preventing left trimming of the following text node.
101
+ * Matcher for inline object view elements. This is an extension of a simple {@link #inlineObjectElements} array of element names.
102
102
  */
103
- private readonly _encounteredRawContentDomNodes;
103
+ private readonly _inlineObjectElementMatcher;
104
104
  /**
105
105
  * Creates a DOM converter.
106
106
  *
@@ -269,9 +269,10 @@ export default class DomConverter {
269
269
  *
270
270
  * @param domElement Parent DOM element.
271
271
  * @param options See {@link module:engine/view/domconverter~DomConverter#domToView} options parameter.
272
+ * @param inlineNodes An array that will be populated with inline nodes. It's used internally for whitespace processing.
272
273
  * @returns View nodes.
273
274
  */
274
- domChildrenToView(domElement: DomElement, options: Parameters<DomConverter['domToView']>[1]): IterableIterator<ViewNode>;
275
+ domChildrenToView(domElement: DomElement, options?: Parameters<DomConverter['domToView']>[1], inlineNodes?: Array<ViewNode>): IterableIterator<ViewNode>;
275
276
  /**
276
277
  * Converts DOM selection to view {@link module:engine/view/selection~Selection}.
277
278
  * Ranges which cannot be converted will be omitted.
@@ -459,6 +460,17 @@ export default class DomConverter {
459
460
  * be treated as raw data.
460
461
  */
461
462
  registerRawContentMatcher(pattern: MatcherPattern): void;
463
+ /**
464
+ * Registers a {@link module:engine/view/matcher~MatcherPattern} for inline object view elements.
465
+ *
466
+ * This is affecting how {@link module:engine/view/domconverter~DomConverter#domToView} and
467
+ * {@link module:engine/view/domconverter~DomConverter#domChildrenToView} process DOM nodes.
468
+ *
469
+ * This is an extension of a simple {@link #inlineObjectElements} array of element names.
470
+ *
471
+ * @param pattern Pattern matching a view element which should be treated as an inline object.
472
+ */
473
+ registerInlineObjectMatcher(pattern: MatcherPattern): void;
462
474
  /**
463
475
  * Returns the block {@link module:engine/view/filler filler} node based on the current {@link #blockFillerMode} setting.
464
476
  */
@@ -471,6 +483,24 @@ export default class DomConverter {
471
483
  * @returns `true` if given position is at a correct place for selection boundary, `false` otherwise.
472
484
  */
473
485
  private _isDomSelectionPositionCorrect;
486
+ /**
487
+ * Internal generator for {@link #domToView}. Also used by {@link #domChildrenToView}.
488
+ * Separates DOM nodes conversion from whitespaces processing.
489
+ *
490
+ * @param domNode DOM node or document fragment to transform.
491
+ * @param inlineNodes An array of recently encountered inline nodes truncated to the block element boundaries.
492
+ * Used later to process whitespaces.
493
+ */
494
+ private _domToView;
495
+ /**
496
+ * Internal helper that walks the list of inline view nodes already generated from DOM nodes
497
+ * and handles whitespaces and NBSPs.
498
+ *
499
+ * @param domParent The DOM parent of the given inline nodes. This should be a document fragment or
500
+ * a block element to whitespace processing start cleaning.
501
+ * @param inlineNodes An array of recently encountered inline nodes truncated to the block element boundaries.
502
+ */
503
+ private _processDomInlineNodes;
474
504
  /**
475
505
  * Takes text data from a given {@link module:engine/view/text~Text#data} and processes it so
476
506
  * it is correctly displayed in the DOM.
@@ -496,36 +526,6 @@ export default class DomConverter {
496
526
  * @returns `true` if given `node` ends with space, `false` otherwise.
497
527
  */
498
528
  private _nodeEndsWithSpace;
499
- /**
500
- * Takes text data from native `Text` node and processes it to a correct {@link module:engine/view/text~Text view text node} data.
501
- *
502
- * Following changes are done:
503
- *
504
- * * multiple whitespaces are replaced to a single space,
505
- * * space at the beginning of a text node is removed if it is the first text node in its container
506
- * element or if the previous text node ends with a space character,
507
- * * space at the end of the text node is removed if there are two spaces at the end of a node or if next node
508
- * starts with a space or if it is the last text node in its container
509
- * * nbsps are converted to spaces.
510
- *
511
- * @param node DOM text node to process.
512
- * @returns Processed data.
513
- */
514
- private _processDataFromDomText;
515
- /**
516
- * Helper function which checks if a DOM text node, preceded by the given `prevNode` should
517
- * be trimmed from the left side.
518
- *
519
- * @param prevNode Either DOM text or `<br>` or one of `#inlineObjectElements`.
520
- */
521
- private _checkShouldLeftTrimDomText;
522
- /**
523
- * Helper function which checks if a DOM text node, succeeded by the given `nextNode` should
524
- * be trimmed from the right side.
525
- *
526
- * @param nextNode Either DOM text or `<br>` or one of `#inlineObjectElements`.
527
- */
528
- private _checkShouldRightTrimDomText;
529
529
  /**
530
530
  * Helper function. For given {@link module:engine/view/text~Text view text node}, it finds previous or next sibling
531
531
  * that is contained in the same container element. If there is no such sibling, `null` is returned.
@@ -536,29 +536,13 @@ export default class DomConverter {
536
536
  */
537
537
  private _getTouchingInlineViewNode;
538
538
  /**
539
- * Helper function. For the given text node, it finds the closest touching node which is either
540
- * a text, `<br>` or an {@link #inlineObjectElements inline object}.
541
- *
542
- * If no such node is found, `null` is returned.
543
- *
544
- * For instance, in the following DOM structure:
545
- *
546
- * ```html
547
- * <p>foo<b>bar</b><br>bom</p>
548
- * ```
549
- *
550
- * * `foo` doesn't have its previous touching inline node (`null` is returned),
551
- * * `foo`'s next touching inline node is `bar`
552
- * * `bar`'s next touching inline node is `<br>`
553
- *
554
- * This method returns text nodes and `<br>` elements because these types of nodes affect how
555
- * spaces in the given text node need to be converted.
539
+ * Returns `true` if a DOM node belongs to {@link #blockElements}. `false` otherwise.
556
540
  */
557
- private _getTouchingInlineDomNode;
541
+ private _isBlockDomElement;
558
542
  /**
559
- * Returns `true` if a DOM node belongs to {@link #blockElements}. `false` otherwise.
543
+ * Returns `true` if a view node belongs to {@link #blockElements}. `false` otherwise.
560
544
  */
561
- private _isBlockElement;
545
+ private _isBlockViewElement;
562
546
  /**
563
547
  * Returns `true` if a DOM node belongs to {@link #inlineObjectElements}. `false` otherwise.
564
548
  */