@ckeditor/ckeditor5-engine 45.2.1-alpha.9 → 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
@@ -2,16 +2,16 @@
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 Observer from './observer.js';
6
- import BubblingEventInfo from './bubblingeventinfo.js';
5
+ import { Observer } from './observer.js';
6
+ import { BubblingEventInfo } from './bubblingeventinfo.js';
7
7
  import { keyCodes } from '@ckeditor/ckeditor5-utils';
8
8
  /**
9
- * Tab observer introduces the {@link module:engine/view/document~Document#event:tab `Document#tab`} event.
9
+ * Tab observer introduces the {@link module:engine/view/document~ViewDocument#event:tab `Document#tab`} event.
10
10
  *
11
11
  * Note that because {@link module:engine/view/observer/tabobserver~TabObserver} is attached by the
12
- * {@link module:engine/view/view~View}, this event is available by default.
12
+ * {@link module:engine/view/view~EditingView}, this event is available by default.
13
13
  */
14
- export default class TabObserver extends Observer {
14
+ export class TabObserver extends Observer {
15
15
  /**
16
16
  * @inheritDoc
17
17
  */
@@ -5,15 +5,15 @@
5
5
  /**
6
6
  * @module engine/view/observer/touchobserver
7
7
  */
8
- import DomEventObserver from './domeventobserver.js';
9
- import type DomEventData from './domeventdata.js';
8
+ import { DomEventObserver } from './domeventobserver.js';
9
+ import { type ViewDocumentDomEventData } from './domeventdata.js';
10
10
  /**
11
11
  * Touch events observer.
12
12
  *
13
13
  * Note that this observer is not available by default. To make it available it needs to be added to
14
- * {@link module:engine/view/view~View} by {@link module:engine/view/view~View#addObserver} method.
14
+ * {@link module:engine/view/view~EditingView} by {@link module:engine/view/view~EditingView#addObserver} method.
15
15
  */
16
- export default class TouchObserver extends DomEventObserver<'touchstart' | 'touchend' | 'touchmove'> {
16
+ export declare class TouchObserver extends DomEventObserver<'touchstart' | 'touchend' | 'touchmove'> {
17
17
  /**
18
18
  * @inheritDoc
19
19
  */
@@ -29,15 +29,15 @@ export default class TouchObserver extends DomEventObserver<'touchstart' | 'touc
29
29
  * Introduced by {@link module:engine/view/observer/touchobserver~TouchObserver}.
30
30
  *
31
31
  * Note that this event is not available by default. To make it available, {@link module:engine/view/observer/touchobserver~TouchObserver}
32
- * needs to be added to {@link module:engine/view/view~View} by the {@link module:engine/view/view~View#addObserver} method.
32
+ * needs to be added to {@link module:engine/view/view~EditingView} by the {@link module:engine/view/view~EditingView#addObserver} method.
33
33
  *
34
34
  * @see module:engine/view/observer/touchobserver~TouchObserver
35
- * @eventName module:engine/view/document~Document#touchstart
35
+ * @eventName module:engine/view/document~ViewDocument#touchstart
36
36
  * @param data The event data.
37
37
  */
38
38
  export type ViewDocumentTouchStartEvent = {
39
39
  name: 'touchstart';
40
- args: [data: DomEventData<TouchEvent>];
40
+ args: [data: ViewDocumentDomEventData<TouchEvent>];
41
41
  };
42
42
  /**
43
43
  * Fired when a touch ends on one of the editing roots of the editor.
@@ -45,15 +45,15 @@ export type ViewDocumentTouchStartEvent = {
45
45
  * Introduced by {@link module:engine/view/observer/touchobserver~TouchObserver}.
46
46
  *
47
47
  * Note that this event is not available by default. To make it available, {@link module:engine/view/observer/touchobserver~TouchObserver}
48
- * needs to be added to {@link module:engine/view/view~View} by the {@link module:engine/view/view~View#addObserver} method.
48
+ * needs to be added to {@link module:engine/view/view~EditingView} by the {@link module:engine/view/view~EditingView#addObserver} method.
49
49
  *
50
50
  * @see module:engine/view/observer/touchobserver~TouchObserver
51
- * @eventName module:engine/view/document~Document#touchend
51
+ * @eventName module:engine/view/document~ViewDocument#touchend
52
52
  * @param data The event data.
53
53
  */
54
54
  export type ViewDocumentTouchEndEvent = {
55
55
  name: 'touchend';
56
- args: [data: DomEventData<TouchEvent>];
56
+ args: [data: ViewDocumentDomEventData<TouchEvent>];
57
57
  };
58
58
  /**
59
59
  * Fired when a touch is moved on one of the editing roots of the editor.
@@ -61,13 +61,13 @@ export type ViewDocumentTouchEndEvent = {
61
61
  * Introduced by {@link module:engine/view/observer/touchobserver~TouchObserver}.
62
62
  *
63
63
  * Note that this event is not available by default. To make it available, {@link module:engine/view/observer/touchobserver~TouchObserver}
64
- * needs to be added to {@link module:engine/view/view~View} by the {@link module:engine/view/view~View#addObserver} method.
64
+ * needs to be added to {@link module:engine/view/view~EditingView} by the {@link module:engine/view/view~EditingView#addObserver} method.
65
65
  *
66
66
  * @see module:engine/view/observer/touchobserver~TouchObserver
67
- * @eventName module:engine/view/document~Document#touchmove
67
+ * @eventName module:engine/view/document~ViewDocument#touchmove
68
68
  * @param data The event data.
69
69
  */
70
70
  export type ViewDocumentTouchMoveEvent = {
71
71
  name: 'touchmove';
72
- args: [data: DomEventData<TouchEvent>];
72
+ args: [data: ViewDocumentDomEventData<TouchEvent>];
73
73
  };
@@ -5,14 +5,14 @@
5
5
  /**
6
6
  * @module engine/view/observer/touchobserver
7
7
  */
8
- import DomEventObserver from './domeventobserver.js';
8
+ import { DomEventObserver } from './domeventobserver.js';
9
9
  /**
10
10
  * Touch events observer.
11
11
  *
12
12
  * Note that this observer is not available by default. To make it available it needs to be added to
13
- * {@link module:engine/view/view~View} by {@link module:engine/view/view~View#addObserver} method.
13
+ * {@link module:engine/view/view~EditingView} by {@link module:engine/view/view~EditingView#addObserver} method.
14
14
  */
15
- export default class TouchObserver extends DomEventObserver {
15
+ export class TouchObserver extends DomEventObserver {
16
16
  /**
17
17
  * @inheritDoc
18
18
  */
@@ -6,17 +6,17 @@
6
6
  * @module engine/view/placeholder
7
7
  */
8
8
  import '../../theme/placeholder.css';
9
- import type DowncastWriter from './downcastwriter.js';
10
- import type EditableElement from './editableelement.js';
11
- import type Element from './element.js';
12
- import type View from './view.js';
9
+ import { type ViewDowncastWriter } from './downcastwriter.js';
10
+ import { type ViewEditableElement } from './editableelement.js';
11
+ import { type ViewElement } from './element.js';
12
+ import { type EditingView } from './view.js';
13
13
  /**
14
14
  * A helper that enables a placeholder on the provided view element (also updates its visibility).
15
15
  * The placeholder is a CSS pseudo–element (with a text content) attached to the element.
16
16
  *
17
17
  * To change the placeholder text, change value of the `placeholder` property in the provided `element`.
18
18
  *
19
- * To disable the placeholder, use {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} helper.
19
+ * To disable the placeholder, use {@link module:engine/view/placeholder~disableViewPlaceholder `disableViewPlaceholder()`} helper.
20
20
  *
21
21
  * @param options Configuration options of the placeholder.
22
22
  * @param options.view Editing view instance.
@@ -26,12 +26,12 @@ import type View from './view.js';
26
26
  * Useful when attaching placeholders to elements that can host other elements (not just text), for instance,
27
27
  * editable root elements.
28
28
  * @param options.text Placeholder text. It's **deprecated** and will be removed soon. Use
29
- * {@link module:engine/view/placeholder~PlaceholderableElement#placeholder `options.element.placeholder`} instead.
29
+ * {@link module:engine/view/placeholder~PlaceholderableViewElement#placeholder `options.element.placeholder`} instead.
30
30
  * @param options.keepOnFocus If set `true`, the placeholder stay visible when the host element is focused.
31
31
  */
32
- export declare function enablePlaceholder({ view, element, text, isDirectHost, keepOnFocus }: {
33
- view: View;
34
- element: PlaceholderableElement | EditableElement;
32
+ export declare function enableViewPlaceholder({ view, element, text, isDirectHost, keepOnFocus }: {
33
+ view: EditingView;
34
+ element: PlaceholderableViewElement | ViewEditableElement;
35
35
  isDirectHost?: boolean;
36
36
  text?: string;
37
37
  keepOnFocus?: boolean;
@@ -39,38 +39,38 @@ export declare function enablePlaceholder({ view, element, text, isDirectHost, k
39
39
  /**
40
40
  * Disables the placeholder functionality from a given element.
41
41
  *
42
- * See {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} to learn more.
42
+ * See {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} to learn more.
43
43
  */
44
- export declare function disablePlaceholder(view: View, element: Element): void;
44
+ export declare function disableViewPlaceholder(view: EditingView, element: ViewElement): void;
45
45
  /**
46
46
  * Shows a placeholder in the provided element by changing related attributes and CSS classes.
47
47
  *
48
48
  * **Note**: This helper will not update the placeholder visibility nor manage the
49
49
  * it in any way in the future. What it does is a one–time state change of an element. Use
50
- * {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} and
51
- * {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} for full
50
+ * {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} and
51
+ * {@link module:engine/view/placeholder~disableViewPlaceholder `disableViewPlaceholder()`} for full
52
52
  * placeholder functionality.
53
53
  *
54
54
  * **Note**: This helper will blindly show the placeholder directly in the root editable element if
55
55
  * one is passed, which could result in a visual clash if the editable element has some children
56
- * (for instance, an empty paragraph). Use {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`}
56
+ * (for instance, an empty paragraph). Use {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`}
57
57
  * in that case or make sure the correct element is passed to the helper.
58
58
  *
59
59
  * @returns `true`, if any changes were made to the `element`.
60
60
  */
61
- export declare function showPlaceholder(writer: DowncastWriter, element: Element): boolean;
61
+ export declare function showViewPlaceholder(writer: ViewDowncastWriter, element: ViewElement): boolean;
62
62
  /**
63
63
  * Hides a placeholder in the element by changing related attributes and CSS classes.
64
64
  *
65
65
  * **Note**: This helper will not update the placeholder visibility nor manage the
66
66
  * it in any way in the future. What it does is a one–time state change of an element. Use
67
- * {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} and
68
- * {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} for full
67
+ * {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} and
68
+ * {@link module:engine/view/placeholder~disableViewPlaceholder `disableViewPlaceholder()`} for full
69
69
  * placeholder functionality.
70
70
  *
71
71
  * @returns `true`, if any changes were made to the `element`.
72
72
  */
73
- export declare function hidePlaceholder(writer: DowncastWriter, element: Element): boolean;
73
+ export declare function hideViewPlaceholder(writer: ViewDowncastWriter, element: ViewElement): boolean;
74
74
  /**
75
75
  * Checks if a placeholder should be displayed in the element.
76
76
  *
@@ -78,17 +78,17 @@ export declare function hidePlaceholder(writer: DowncastWriter, element: Element
78
78
  * root editable element if one is passed, which may not be the expected result. If an element can
79
79
  * host other elements (not just text), most likely one of its children should be checked instead
80
80
  * because it will be the final host for the placeholder. Use
81
- * {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} in that case or make
81
+ * {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} in that case or make
82
82
  * sure the correct element is passed to the helper.
83
83
  *
84
84
  * @param element Element that holds the placeholder.
85
85
  * @param keepOnFocus Focusing the element will keep the placeholder visible.
86
86
  */
87
- export declare function needsPlaceholder(element: Element, keepOnFocus: boolean): boolean;
87
+ export declare function needsViewPlaceholder(element: ViewElement, keepOnFocus: boolean): boolean;
88
88
  /**
89
89
  * Element that could have a placeholder.
90
90
  */
91
- export interface PlaceholderableElement extends Element {
91
+ export interface PlaceholderableViewElement extends ViewElement {
92
92
  /**
93
93
  * The text of element's placeholder.
94
94
  */
@@ -16,7 +16,7 @@ let hasDisplayedPlaceholderDeprecationWarning = false;
16
16
  *
17
17
  * To change the placeholder text, change value of the `placeholder` property in the provided `element`.
18
18
  *
19
- * To disable the placeholder, use {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} helper.
19
+ * To disable the placeholder, use {@link module:engine/view/placeholder~disableViewPlaceholder `disableViewPlaceholder()`} helper.
20
20
  *
21
21
  * @param options Configuration options of the placeholder.
22
22
  * @param options.view Editing view instance.
@@ -26,10 +26,10 @@ let hasDisplayedPlaceholderDeprecationWarning = false;
26
26
  * Useful when attaching placeholders to elements that can host other elements (not just text), for instance,
27
27
  * editable root elements.
28
28
  * @param options.text Placeholder text. It's **deprecated** and will be removed soon. Use
29
- * {@link module:engine/view/placeholder~PlaceholderableElement#placeholder `options.element.placeholder`} instead.
29
+ * {@link module:engine/view/placeholder~PlaceholderableViewElement#placeholder `options.element.placeholder`} instead.
30
30
  * @param options.keepOnFocus If set `true`, the placeholder stay visible when the host element is focused.
31
31
  */
32
- export function enablePlaceholder({ view, element, text, isDirectHost = true, keepOnFocus = false }) {
32
+ export function enableViewPlaceholder({ view, element, text, isDirectHost = true, keepOnFocus = false }) {
33
33
  const doc = view.document;
34
34
  // Use a single post fixer per—document to update all placeholders.
35
35
  if (!documentPlaceholders.has(doc)) {
@@ -52,7 +52,7 @@ export function enablePlaceholder({ view, element, text, isDirectHost = true, ke
52
52
  setPlaceholder(text);
53
53
  }
54
54
  if (text) {
55
- showPlaceholderTextDeprecationWarning();
55
+ showViewPlaceholderTextDeprecationWarning();
56
56
  }
57
57
  function setPlaceholder(text) {
58
58
  const config = {
@@ -70,9 +70,9 @@ export function enablePlaceholder({ view, element, text, isDirectHost = true, ke
70
70
  /**
71
71
  * Disables the placeholder functionality from a given element.
72
72
  *
73
- * See {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} to learn more.
73
+ * See {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} to learn more.
74
74
  */
75
- export function disablePlaceholder(view, element) {
75
+ export function disableViewPlaceholder(view, element) {
76
76
  const doc = element.document;
77
77
  if (!documentPlaceholders.has(doc)) {
78
78
  return;
@@ -81,7 +81,7 @@ export function disablePlaceholder(view, element) {
81
81
  const placeholders = documentPlaceholders.get(doc);
82
82
  const config = placeholders.get(element);
83
83
  writer.removeAttribute('data-placeholder', config.hostElement);
84
- hidePlaceholder(writer, config.hostElement);
84
+ hideViewPlaceholder(writer, config.hostElement);
85
85
  placeholders.delete(element);
86
86
  });
87
87
  }
@@ -90,18 +90,18 @@ export function disablePlaceholder(view, element) {
90
90
  *
91
91
  * **Note**: This helper will not update the placeholder visibility nor manage the
92
92
  * it in any way in the future. What it does is a one–time state change of an element. Use
93
- * {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} and
94
- * {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} for full
93
+ * {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} and
94
+ * {@link module:engine/view/placeholder~disableViewPlaceholder `disableViewPlaceholder()`} for full
95
95
  * placeholder functionality.
96
96
  *
97
97
  * **Note**: This helper will blindly show the placeholder directly in the root editable element if
98
98
  * one is passed, which could result in a visual clash if the editable element has some children
99
- * (for instance, an empty paragraph). Use {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`}
99
+ * (for instance, an empty paragraph). Use {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`}
100
100
  * in that case or make sure the correct element is passed to the helper.
101
101
  *
102
102
  * @returns `true`, if any changes were made to the `element`.
103
103
  */
104
- export function showPlaceholder(writer, element) {
104
+ export function showViewPlaceholder(writer, element) {
105
105
  if (!element.hasClass('ck-placeholder')) {
106
106
  writer.addClass('ck-placeholder', element);
107
107
  return true;
@@ -113,13 +113,13 @@ export function showPlaceholder(writer, element) {
113
113
  *
114
114
  * **Note**: This helper will not update the placeholder visibility nor manage the
115
115
  * it in any way in the future. What it does is a one–time state change of an element. Use
116
- * {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} and
117
- * {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} for full
116
+ * {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} and
117
+ * {@link module:engine/view/placeholder~disableViewPlaceholder `disableViewPlaceholder()`} for full
118
118
  * placeholder functionality.
119
119
  *
120
120
  * @returns `true`, if any changes were made to the `element`.
121
121
  */
122
- export function hidePlaceholder(writer, element) {
122
+ export function hideViewPlaceholder(writer, element) {
123
123
  if (element.hasClass('ck-placeholder')) {
124
124
  writer.removeClass('ck-placeholder', element);
125
125
  return true;
@@ -133,13 +133,13 @@ export function hidePlaceholder(writer, element) {
133
133
  * root editable element if one is passed, which may not be the expected result. If an element can
134
134
  * host other elements (not just text), most likely one of its children should be checked instead
135
135
  * because it will be the final host for the placeholder. Use
136
- * {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} in that case or make
136
+ * {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} in that case or make
137
137
  * sure the correct element is passed to the helper.
138
138
  *
139
139
  * @param element Element that holds the placeholder.
140
140
  * @param keepOnFocus Focusing the element will keep the placeholder visible.
141
141
  */
142
- export function needsPlaceholder(element, keepOnFocus) {
142
+ export function needsViewPlaceholder(element, keepOnFocus) {
143
143
  if (!element.isAttached()) {
144
144
  return false;
145
145
  }
@@ -229,12 +229,12 @@ function updatePlaceholder(writer, element, config) {
229
229
  }
230
230
  // If the host element is not a direct host then placeholder is needed only when there is only one element.
231
231
  const isOnlyChild = isDirectHost || element.childCount == 1;
232
- if (isOnlyChild && needsPlaceholder(hostElement, config.keepOnFocus)) {
233
- if (showPlaceholder(writer, hostElement)) {
232
+ if (isOnlyChild && needsViewPlaceholder(hostElement, config.keepOnFocus)) {
233
+ if (showViewPlaceholder(writer, hostElement)) {
234
234
  wasViewModified = true;
235
235
  }
236
236
  }
237
- else if (hidePlaceholder(writer, hostElement)) {
237
+ else if (hideViewPlaceholder(writer, hostElement)) {
238
238
  wasViewModified = true;
239
239
  }
240
240
  return wasViewModified;
@@ -256,18 +256,18 @@ function getChildPlaceholderHostSubstitute(parent) {
256
256
  /**
257
257
  * Displays a deprecation warning message in the console, but only once per page load.
258
258
  */
259
- function showPlaceholderTextDeprecationWarning() {
259
+ function showViewPlaceholderTextDeprecationWarning() {
260
260
  if (!hasDisplayedPlaceholderDeprecationWarning) {
261
261
  /**
262
- * The "text" option in the {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`}
262
+ * The "text" option in the {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`}
263
263
  * function is deprecated and will be removed soon.
264
264
  *
265
265
  * See the {@glink updating/guides/update-to-39#view-element-placeholder Migration to v39} guide for
266
266
  * more information on how to apply this change.
267
267
  *
268
- * @error enableplaceholder-deprecated-text-option
268
+ * @error enableViewPlaceholder-deprecated-text-option
269
269
  */
270
- logWarning('enableplaceholder-deprecated-text-option');
270
+ logWarning('enableViewPlaceholder-deprecated-text-option');
271
271
  }
272
272
  hasDisplayedPlaceholderDeprecationWarning = true;
273
273
  }
@@ -5,26 +5,26 @@
5
5
  /**
6
6
  * @module engine/view/position
7
7
  */
8
- import TypeCheckable from './typecheckable.js';
9
- import EditableElement from './editableelement.js';
10
- import type DocumentFragment from './documentfragment.js';
11
- import type Item from './item.js';
12
- import type Node from './node.js';
13
- import { default as TreeWalker, type TreeWalkerValue, type TreeWalkerOptions } from './treewalker.js';
8
+ import { ViewTypeCheckable } from './typecheckable.js';
9
+ import { ViewEditableElement } from './editableelement.js';
10
+ import { type ViewDocumentFragment } from './documentfragment.js';
11
+ import { type ViewItem } from './item.js';
12
+ import { type ViewNode } from './node.js';
13
+ import { ViewTreeWalker, type ViewTreeWalkerValue, type ViewTreeWalkerOptions } from './treewalker.js';
14
14
  /**
15
15
  * Position in the view tree. Position is represented by its parent node and an offset in this parent.
16
16
  *
17
17
  * In order to create a new position instance use the `createPosition*()` factory methods available in:
18
18
  *
19
- * * {@link module:engine/view/view~View}
20
- * * {@link module:engine/view/downcastwriter~DowncastWriter}
21
- * * {@link module:engine/view/upcastwriter~UpcastWriter}
19
+ * * {@link module:engine/view/view~EditingView}
20
+ * * {@link module:engine/view/downcastwriter~ViewDowncastWriter}
21
+ * * {@link module:engine/view/upcastwriter~ViewUpcastWriter}
22
22
  */
23
- export default class Position extends TypeCheckable {
23
+ export declare class ViewPosition extends ViewTypeCheckable {
24
24
  /**
25
25
  * Position parent.
26
26
  */
27
- readonly parent: Node | DocumentFragment;
27
+ readonly parent: ViewNode | ViewDocumentFragment;
28
28
  /**
29
29
  * Position offset.
30
30
  */
@@ -35,44 +35,44 @@ export default class Position extends TypeCheckable {
35
35
  * @param parent Position parent.
36
36
  * @param offset Position offset.
37
37
  */
38
- constructor(parent: Node | DocumentFragment, offset: number);
38
+ constructor(parent: ViewNode | ViewDocumentFragment, offset: number);
39
39
  /**
40
40
  * Node directly after the position. Equals `null` when there is no node after position or position is located
41
41
  * inside text node.
42
42
  */
43
- get nodeAfter(): Node | null;
43
+ get nodeAfter(): ViewNode | null;
44
44
  /**
45
45
  * Node directly before the position. Equals `null` when there is no node before position or position is located
46
46
  * inside text node.
47
47
  */
48
- get nodeBefore(): Node | null;
48
+ get nodeBefore(): ViewNode | null;
49
49
  /**
50
- * Is `true` if position is at the beginning of its {@link module:engine/view/position~Position#parent parent}, `false` otherwise.
50
+ * Is `true` if position is at the beginning of its {@link module:engine/view/position~ViewPosition#parent parent}, `false` otherwise.
51
51
  */
52
52
  get isAtStart(): boolean;
53
53
  /**
54
- * Is `true` if position is at the end of its {@link module:engine/view/position~Position#parent parent}, `false` otherwise.
54
+ * Is `true` if position is at the end of its {@link module:engine/view/position~ViewPosition#parent parent}, `false` otherwise.
55
55
  */
56
56
  get isAtEnd(): boolean;
57
57
  /**
58
58
  * Position's root, that is the root of the position's parent element.
59
59
  */
60
- get root(): Node | DocumentFragment;
60
+ get root(): ViewNode | ViewDocumentFragment;
61
61
  /**
62
- * {@link module:engine/view/editableelement~EditableElement EditableElement} instance that contains this position, or `null` if
62
+ * {@link module:engine/view/editableelement~ViewEditableElement ViewEditableElement} instance that contains this position, or `null` if
63
63
  * position is not inside an editable element.
64
64
  */
65
- get editableElement(): EditableElement | null;
65
+ get editableElement(): ViewEditableElement | null;
66
66
  /**
67
67
  * Returns a new instance of Position with offset incremented by `shift` value.
68
68
  *
69
69
  * @param shift How position offset should get changed. Accepts negative values.
70
70
  * @returns Shifted position.
71
71
  */
72
- getShiftedBy(shift: number): Position;
72
+ getShiftedBy(shift: number): ViewPosition;
73
73
  /**
74
74
  * Gets the farthest position which matches the callback using
75
- * {@link module:engine/view/treewalker~TreeWalker TreeWalker}.
75
+ * {@link module:engine/view/treewalker~ViewTreeWalker TreeWalker}.
76
76
  *
77
77
  * For example:
78
78
  *
@@ -82,107 +82,107 @@ export default class Position extends TypeCheckable {
82
82
  * getLastMatchingPosition( value => false ); // Do not move the position.
83
83
  * ```
84
84
  *
85
- * @param skip Callback function. Gets {@link module:engine/view/treewalker~TreeWalkerValue} and should
85
+ * @param skip Callback function. Gets {@link module:engine/view/treewalker~ViewTreeWalkerValue} and should
86
86
  * return `true` if the value should be skipped or `false` if not.
87
- * @param options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}.
87
+ * @param options Object with configuration options. See {@link module:engine/view/treewalker~ViewTreeWalker}.
88
88
  * @returns The position after the last item which matches the `skip` callback test.
89
89
  */
90
- getLastMatchingPosition(skip: (value: TreeWalkerValue) => boolean, options?: TreeWalkerOptions): Position;
90
+ getLastMatchingPosition(skip: (value: ViewTreeWalkerValue) => boolean, options?: ViewTreeWalkerOptions): ViewPosition;
91
91
  /**
92
92
  * Returns ancestors array of this position, that is this position's parent and it's ancestors.
93
93
  *
94
94
  * @returns Array with ancestors.
95
95
  */
96
- getAncestors(): Array<Node | DocumentFragment>;
96
+ getAncestors(): Array<ViewNode | ViewDocumentFragment>;
97
97
  /**
98
- * Returns a {@link module:engine/view/node~Node} or {@link module:engine/view/documentfragment~DocumentFragment}
98
+ * Returns a {@link module:engine/view/node~ViewNode} or {@link module:engine/view/documentfragment~ViewDocumentFragment}
99
99
  * which is a common ancestor of both positions.
100
100
  */
101
- getCommonAncestor(position: Position): Node | DocumentFragment | null;
101
+ getCommonAncestor(position: ViewPosition): ViewNode | ViewDocumentFragment | null;
102
102
  /**
103
103
  * Checks whether this position equals given position.
104
104
  *
105
105
  * @param otherPosition Position to compare with.
106
106
  * @returns True if positions are same.
107
107
  */
108
- isEqual(otherPosition: Position): boolean;
108
+ isEqual(otherPosition: ViewPosition): boolean;
109
109
  /**
110
110
  * Checks whether this position is located before given position. When method returns `false` it does not mean that
111
111
  * this position is after give one. Two positions may be located inside separate roots and in that situation this
112
112
  * method will still return `false`.
113
113
  *
114
- * @see module:engine/view/position~Position#isAfter
115
- * @see module:engine/view/position~Position#compareWith
114
+ * @see module:engine/view/position~ViewPosition#isAfter
115
+ * @see module:engine/view/position~ViewPosition#compareWith
116
116
  * @param otherPosition Position to compare with.
117
117
  * @returns Returns `true` if this position is before given position.
118
118
  */
119
- isBefore(otherPosition: Position): boolean;
119
+ isBefore(otherPosition: ViewPosition): boolean;
120
120
  /**
121
121
  * Checks whether this position is located after given position. When method returns `false` it does not mean that
122
122
  * this position is before give one. Two positions may be located inside separate roots and in that situation this
123
123
  * method will still return `false`.
124
124
  *
125
- * @see module:engine/view/position~Position#isBefore
126
- * @see module:engine/view/position~Position#compareWith
125
+ * @see module:engine/view/position~ViewPosition#isBefore
126
+ * @see module:engine/view/position~ViewPosition#compareWith
127
127
  * @param otherPosition Position to compare with.
128
128
  * @returns Returns `true` if this position is after given position.
129
129
  */
130
- isAfter(otherPosition: Position): boolean;
130
+ isAfter(otherPosition: ViewPosition): boolean;
131
131
  /**
132
132
  * Checks whether this position is before, after or in same position that other position. Two positions may be also
133
133
  * different when they are located in separate roots.
134
134
  *
135
135
  * @param otherPosition Position to compare with.
136
136
  */
137
- compareWith(otherPosition: Position): PositionRelation;
137
+ compareWith(otherPosition: ViewPosition): ViewPositionRelation;
138
138
  /**
139
- * Creates a {@link module:engine/view/treewalker~TreeWalker TreeWalker} instance with this positions as a start position.
139
+ * Creates a {@link module:engine/view/treewalker~ViewTreeWalker TreeWalker} instance with this positions as a start position.
140
140
  *
141
- * @param options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}
141
+ * @param options Object with configuration options. See {@link module:engine/view/treewalker~ViewTreeWalker}
142
142
  */
143
- getWalker(options?: TreeWalkerOptions): TreeWalker;
143
+ getWalker(options?: ViewTreeWalkerOptions): ViewTreeWalker;
144
144
  /**
145
145
  * Clones this position.
146
146
  */
147
- clone(): Position;
147
+ clone(): ViewPosition;
148
148
  /**
149
149
  * Creates position at the given location. The location can be specified as:
150
150
  *
151
- * * a {@link module:engine/view/position~Position position},
151
+ * * a {@link module:engine/view/position~ViewPosition position},
152
152
  * * parent element and offset (offset defaults to `0`),
153
153
  * * parent element and `'end'` (sets position at the end of that element),
154
- * * {@link module:engine/view/item~Item view item} and `'before'` or `'after'` (sets position before or after given view item).
154
+ * * {@link module:engine/view/item~ViewItem view item} and `'before'` or `'after'` (sets position before or after given view item).
155
155
  *
156
156
  * This method is a shortcut to other constructors such as:
157
157
  *
158
- * * {@link module:engine/view/position~Position._createBefore},
159
- * * {@link module:engine/view/position~Position._createAfter}.
158
+ * * {@link module:engine/view/position~ViewPosition._createBefore},
159
+ * * {@link module:engine/view/position~ViewPosition._createAfter}.
160
160
  *
161
161
  * @internal
162
- * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~Item view item}.
162
+ * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.
163
163
  */
164
- static _createAt(itemOrPosition: Item | Position, offset?: PositionOffset): Position;
164
+ static _createAt(itemOrPosition: ViewItem | ViewPosition, offset?: ViewPositionOffset): ViewPosition;
165
165
  /**
166
166
  * Creates a new position after given view item.
167
167
  *
168
168
  * @internal
169
169
  * @param item View item after which the position should be located.
170
170
  */
171
- static _createAfter(item: Item): Position;
171
+ static _createAfter(item: ViewItem): ViewPosition;
172
172
  /**
173
173
  * Creates a new position before given view item.
174
174
  *
175
175
  * @internal
176
176
  * @param item View item before which the position should be located.
177
177
  */
178
- static _createBefore(item: Item): Position;
178
+ static _createBefore(item: ViewItem): ViewPosition;
179
179
  }
180
180
  /**
181
181
  * A flag indicating whether this position is `'before'` or `'after'` or `'same'` as given position.
182
182
  * If positions are in different roots `'different'` flag is returned.
183
183
  */
184
- export type PositionRelation = 'before' | 'after' | 'same' | 'different';
184
+ export type ViewPositionRelation = 'before' | 'after' | 'same' | 'different';
185
185
  /**
186
186
  * Offset or one of the flags.
187
187
  */
188
- export type PositionOffset = number | 'before' | 'after' | 'end';
188
+ export type ViewPositionOffset = number | 'before' | 'after' | 'end';