@ckeditor/ckeditor5-engine 48.2.0 → 48.3.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 (129) hide show
  1. package/dist/controller/datacontroller.d.ts +329 -328
  2. package/dist/controller/editingcontroller.d.ts +95 -94
  3. package/dist/conversion/comparemarkers.d.ts +45 -45
  4. package/dist/conversion/conversion.d.ts +474 -474
  5. package/dist/conversion/conversionhelpers.d.ts +21 -21
  6. package/dist/conversion/downcastdispatcher.d.ts +539 -538
  7. package/dist/conversion/downcasthelpers.d.ts +1129 -1129
  8. package/dist/conversion/mapper.d.ts +692 -697
  9. package/dist/conversion/modelconsumable.d.ts +196 -196
  10. package/dist/conversion/upcastdispatcher.d.ts +483 -482
  11. package/dist/conversion/upcasthelpers.d.ts +491 -491
  12. package/dist/conversion/viewconsumable.d.ts +330 -330
  13. package/dist/dataprocessor/basichtmlwriter.d.ts +15 -15
  14. package/dist/dataprocessor/dataprocessor.d.ts +57 -57
  15. package/dist/dataprocessor/htmldataprocessor.d.ts +72 -72
  16. package/dist/dataprocessor/htmlwriter.d.ts +11 -11
  17. package/dist/dataprocessor/xmldataprocessor.d.ts +86 -86
  18. package/dist/dev-utils/model.d.ts +128 -123
  19. package/dist/dev-utils/operationreplayer.d.ts +49 -49
  20. package/dist/dev-utils/utils.d.ts +33 -33
  21. package/dist/dev-utils/view.d.ts +314 -309
  22. package/dist/engineconfig.d.ts +39 -39
  23. package/dist/index.css.map +1 -1
  24. package/dist/index.d.ts +150 -150
  25. package/dist/index.js +34026 -40107
  26. package/dist/index.js.map +1 -1
  27. package/dist/legacyerrors.d.ts +0 -4
  28. package/dist/model/batch.d.ts +86 -86
  29. package/dist/model/differ.d.ts +504 -504
  30. package/dist/model/document.d.ts +265 -268
  31. package/dist/model/documentfragment.d.ts +214 -214
  32. package/dist/model/documentselection.d.ts +406 -410
  33. package/dist/model/element.d.ts +182 -182
  34. package/dist/model/history.d.ts +109 -109
  35. package/dist/model/item.d.ts +9 -9
  36. package/dist/model/liveposition.d.ts +70 -69
  37. package/dist/model/liverange.d.ts +93 -92
  38. package/dist/model/markercollection.d.ts +317 -324
  39. package/dist/model/model.d.ts +889 -909
  40. package/dist/model/node.d.ts +254 -254
  41. package/dist/model/nodelist.d.ts +110 -110
  42. package/dist/model/operation/attributeoperation.d.ts +98 -98
  43. package/dist/model/operation/detachoperation.d.ts +57 -57
  44. package/dist/model/operation/insertoperation.d.ts +85 -85
  45. package/dist/model/operation/markeroperation.d.ts +87 -87
  46. package/dist/model/operation/mergeoperation.d.ts +95 -95
  47. package/dist/model/operation/moveoperation.d.ts +97 -97
  48. package/dist/model/operation/nooperation.d.ts +33 -33
  49. package/dist/model/operation/operation.d.ts +94 -94
  50. package/dist/model/operation/operationfactory.d.ts +14 -14
  51. package/dist/model/operation/renameoperation.d.ts +78 -78
  52. package/dist/model/operation/rootattributeoperation.d.ts +93 -93
  53. package/dist/model/operation/rootoperation.d.ts +71 -71
  54. package/dist/model/operation/splitoperation.d.ts +104 -104
  55. package/dist/model/operation/transform.d.ts +91 -91
  56. package/dist/model/operation/utils.d.ts +58 -58
  57. package/dist/model/position.d.ts +535 -535
  58. package/dist/model/range.d.ts +458 -453
  59. package/dist/model/rootelement.d.ts +55 -55
  60. package/dist/model/schema.d.ts +1325 -1327
  61. package/dist/model/selection.d.ts +452 -471
  62. package/dist/model/text.d.ts +62 -62
  63. package/dist/model/textproxy.d.ts +140 -140
  64. package/dist/model/treewalker.d.ts +190 -190
  65. package/dist/model/typecheckable.d.ts +281 -281
  66. package/dist/model/utils/autoparagraphing.d.ts +29 -29
  67. package/dist/model/utils/deletecontent.d.ts +68 -68
  68. package/dist/model/utils/getselectedcontent.d.ts +27 -27
  69. package/dist/model/utils/insertcontent.d.ts +42 -42
  70. package/dist/model/utils/insertobject.d.ts +41 -41
  71. package/dist/model/utils/modifyselection.d.ts +44 -44
  72. package/dist/model/utils/selection-post-fixer.d.ts +71 -71
  73. package/dist/model/writer.d.ts +854 -854
  74. package/dist/view/attributeelement.d.ts +123 -123
  75. package/dist/view/containerelement.d.ts +49 -49
  76. package/dist/view/datatransfer.d.ts +70 -70
  77. package/dist/view/document.d.ts +175 -177
  78. package/dist/view/documentfragment.d.ts +158 -157
  79. package/dist/view/documentselection.d.ts +308 -307
  80. package/dist/view/domconverter.d.ts +612 -657
  81. package/dist/view/downcastwriter.d.ts +1006 -1006
  82. package/dist/view/editableelement.d.ts +64 -63
  83. package/dist/view/element.d.ts +754 -754
  84. package/dist/view/elementdefinition.d.ts +79 -79
  85. package/dist/view/emptyelement.d.ts +42 -42
  86. package/dist/view/filler.d.ts +75 -75
  87. package/dist/view/item.d.ts +9 -9
  88. package/dist/view/matcher.d.ts +412 -487
  89. package/dist/view/node.d.ts +164 -163
  90. package/dist/view/observer/arrowkeysobserver.d.ts +37 -37
  91. package/dist/view/observer/bubblingemittermixin.d.ts +163 -153
  92. package/dist/view/observer/bubblingeventinfo.d.ts +45 -42
  93. package/dist/view/observer/clickobserver.d.ts +36 -36
  94. package/dist/view/observer/compositionobserver.d.ts +67 -67
  95. package/dist/view/observer/domeventdata.d.ts +46 -46
  96. package/dist/view/observer/domeventobserver.d.ts +77 -74
  97. package/dist/view/observer/fakeselectionobserver.d.ts +42 -42
  98. package/dist/view/observer/focusobserver.d.ts +84 -84
  99. package/dist/view/observer/inputobserver.d.ts +76 -76
  100. package/dist/view/observer/keyobserver.d.ts +53 -53
  101. package/dist/view/observer/mouseobserver.d.ts +73 -73
  102. package/dist/view/observer/mutationobserver.d.ts +101 -101
  103. package/dist/view/observer/observer.d.ts +84 -83
  104. package/dist/view/observer/pointerobserver.d.ts +63 -63
  105. package/dist/view/observer/selectionobserver.d.ts +136 -136
  106. package/dist/view/observer/tabobserver.d.ts +38 -38
  107. package/dist/view/observer/touchobserver.d.ts +60 -60
  108. package/dist/view/placeholder.d.ts +80 -80
  109. package/dist/view/position.d.ts +187 -187
  110. package/dist/view/range.d.ts +282 -282
  111. package/dist/view/rawelement.d.ts +72 -72
  112. package/dist/view/renderer.d.ts +270 -272
  113. package/dist/view/rooteditableelement.d.ts +43 -43
  114. package/dist/view/selection.d.ts +356 -369
  115. package/dist/view/styles/background.d.ts +15 -15
  116. package/dist/view/styles/border.d.ts +27 -27
  117. package/dist/view/styles/margin.d.ts +12 -12
  118. package/dist/view/styles/padding.d.ts +12 -12
  119. package/dist/view/styles/utils.d.ts +72 -72
  120. package/dist/view/stylesmap.d.ts +715 -715
  121. package/dist/view/text.d.ts +75 -75
  122. package/dist/view/textproxy.d.ts +92 -92
  123. package/dist/view/tokenlist.d.ts +104 -104
  124. package/dist/view/treewalker.d.ts +201 -201
  125. package/dist/view/typecheckable.d.ts +445 -445
  126. package/dist/view/uielement.d.ts +93 -93
  127. package/dist/view/upcastwriter.d.ts +412 -412
  128. package/dist/view/view.d.ts +466 -469
  129. package/package.json +2 -2
@@ -1,486 +1,483 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module engine/view/view
7
- */
8
- import { ViewDocument } from './document.js';
9
- import { ViewDowncastWriter } from './downcastwriter.js';
10
- import { ViewDomConverter } from './domconverter.js';
11
- import { ViewPosition, type ViewPositionOffset } from './position.js';
12
- import { ViewRange } from './range.js';
13
- import { ViewSelection, type ViewPlaceOrOffset, type ViewSelectable, type ViewSelectionOptions } from './selection.js';
14
- import type { Observer, ObserverConstructor } from './observer/observer.js';
15
- import type { ViewDocumentFragment } from './documentfragment.js';
16
- import type { StylesProcessor } from './stylesmap.js';
17
- import { type ViewElement } from './element.js';
18
- import type { ViewNode } from './node.js';
19
- import { type ViewItem } from './item.js';
20
- import { KeyObserver } from './observer/keyobserver.js';
21
- import { FakeSelectionObserver } from './observer/fakeselectionobserver.js';
22
- import { MutationObserver } from './observer/mutationobserver.js';
23
- import { SelectionObserver } from './observer/selectionobserver.js';
24
- import { FocusObserver } from './observer/focusobserver.js';
25
- import { CompositionObserver } from './observer/compositionobserver.js';
26
- import { InputObserver } from './observer/inputobserver.js';
27
- import { ArrowKeysObserver } from './observer/arrowkeysobserver.js';
28
- import { TabObserver } from './observer/tabobserver.js';
29
- import { type IfTrue } from '@ckeditor/ckeditor5-utils';
6
+ * @module engine/view/view
7
+ */
8
+ import { ViewDocument } from "./document.js";
9
+ import { ViewDowncastWriter } from "./downcastwriter.js";
10
+ import { ViewDomConverter } from "./domconverter.js";
11
+ import { ViewPosition, type ViewPositionOffset } from "./position.js";
12
+ import { ViewRange } from "./range.js";
13
+ import { ViewSelection, type ViewPlaceOrOffset, type ViewSelectable, type ViewSelectionOptions } from "./selection.js";
14
+ import type { Observer, ObserverConstructor } from "./observer/observer.js";
15
+ import type { ViewDocumentFragment } from "./documentfragment.js";
16
+ import type { StylesProcessor } from "./stylesmap.js";
17
+ import { type ViewElement } from "./element.js";
18
+ import type { ViewNode } from "./node.js";
19
+ import { type ViewItem } from "./item.js";
20
+ import { KeyObserver } from "./observer/keyobserver.js";
21
+ import { FakeSelectionObserver } from "./observer/fakeselectionobserver.js";
22
+ import { MutationObserver } from "./observer/mutationobserver.js";
23
+ import { SelectionObserver } from "./observer/selectionobserver.js";
24
+ import { FocusObserver } from "./observer/focusobserver.js";
25
+ import { CompositionObserver } from "./observer/compositionobserver.js";
26
+ import { InputObserver } from "./observer/inputobserver.js";
27
+ import { ArrowKeysObserver } from "./observer/arrowkeysobserver.js";
28
+ import { TabObserver } from "./observer/tabobserver.js";
29
+ import { type IfTrue, type ObservableMixinConstructor } from "@ckeditor/ckeditor5-utils";
30
30
  type DomRange = globalThis.Range;
31
- declare const EditingView_base: {
32
- new (): import("@ckeditor/ckeditor5-utils").Observable;
33
- prototype: import("@ckeditor/ckeditor5-utils").Observable;
34
- };
31
+ declare const EditingViewBase: ObservableMixinConstructor;
35
32
  /**
36
- * Editor's view controller class. Its main responsibility is DOM - View management for editing purposes, to provide
37
- * abstraction over the DOM structure and events and hide all browsers quirks.
38
- *
39
- * View controller renders view document to DOM whenever view structure changes. To determine when view can be rendered,
40
- * all changes need to be done using the {@link module:engine/view/view~EditingView#change} method, using
41
- * {@link module:engine/view/downcastwriter~ViewDowncastWriter}:
42
- *
43
- * ```ts
44
- * view.change( writer => {
45
- * writer.insert( position, writer.createText( 'foo' ) );
46
- * } );
47
- * ```
48
- *
49
- * View controller also register {@link module:engine/view/observer/observer~Observer observers} which observes changes
50
- * on DOM and fire events on the {@link module:engine/view/document~ViewDocument Document}.
51
- * Note that the following observers are added by the class constructor and are always available:
52
- *
53
- * * {@link module:engine/view/observer/selectionobserver~SelectionObserver},
54
- * * {@link module:engine/view/observer/focusobserver~FocusObserver},
55
- * * {@link module:engine/view/observer/keyobserver~KeyObserver},
56
- * * {@link module:engine/view/observer/fakeselectionobserver~FakeSelectionObserver}.
57
- * * {@link module:engine/view/observer/compositionobserver~CompositionObserver}.
58
- * * {@link module:engine/view/observer/inputobserver~InputObserver}.
59
- * * {@link module:engine/view/observer/arrowkeysobserver~ArrowKeysObserver}.
60
- * * {@link module:engine/view/observer/tabobserver~TabObserver}.
61
- *
62
- * This class also {@link module:engine/view/view~EditingView#attachDomRoot binds the DOM and the view elements}.
63
- *
64
- * If you do not need full a DOM - view management, and only want to transform a tree of view elements to a tree of DOM
65
- * elements you do not need this controller. You can use the {@link module:engine/view/domconverter~ViewDomConverter ViewDomConverter}
66
- * instead.
67
- */
68
- export declare class EditingView extends /* #__PURE__ */ EditingView_base {
69
- /**
70
- * Instance of the {@link module:engine/view/document~ViewDocument} associated with this view controller.
71
- */
72
- readonly document: ViewDocument;
73
- /**
74
- * Instance of the {@link module:engine/view/domconverter~ViewDomConverter domConverter} used by
75
- * {@link module:engine/view/view~EditingView#_renderer renderer}
76
- * and {@link module:engine/view/observer/observer~Observer observers}.
77
- */
78
- readonly domConverter: ViewDomConverter;
79
- /**
80
- * Roots of the DOM tree. Map on the `HTMLElement`s with roots names as keys.
81
- */
82
- readonly domRoots: Map<string, HTMLElement>;
83
- /**
84
- * Used to prevent calling {@link #forceRender} and {@link #change} during rendering view to the DOM.
85
- *
86
- * @observable
87
- * @readonly
88
- */
89
- isRenderingInProgress: boolean;
90
- /**
91
- * Informs whether the DOM selection is inside any of the DOM roots managed by the view.
92
- *
93
- * @observable
94
- * @readonly
95
- */
96
- hasDomSelection: boolean;
97
- /**
98
- * Instance of the {@link module:engine/view/renderer~ViewRenderer renderer}.
99
- */
100
- private readonly _renderer;
101
- /**
102
- * A DOM root attributes cache. It saves the initial values of DOM root attributes before the DOM element
103
- * is {@link module:engine/view/view~EditingView#attachDomRoot attached} to the view so later on, when
104
- * the view is destroyed ({@link module:engine/view/view~EditingView#detachDomRoot}), they can be easily restored.
105
- * This way, the DOM element can go back to the (clean) state as if the editing view never used it.
106
- */
107
- private readonly _initialDomRootAttributes;
108
- /**
109
- * Map of registered {@link module:engine/view/observer/observer~Observer observers}.
110
- */
111
- private readonly _observers;
112
- /**
113
- * ViewDowncastWriter instance used in {@link #change change method} callbacks.
114
- */
115
- private readonly _writer;
116
- /**
117
- * Is set to `true` when {@link #change view changes} are currently in progress.
118
- */
119
- private _ongoingChange;
120
- /**
121
- * Used to prevent calling {@link #forceRender} and {@link #change} during rendering view to the DOM.
122
- */
123
- private _postFixersInProgress;
124
- /**
125
- * Internal flag to temporary disable rendering. See the usage in the {@link #_disableRendering}.
126
- */
127
- private _renderingDisabled;
128
- /**
129
- * Internal flag that disables rendering when there are no changes since the last rendering.
130
- * It stores information about changed selection and changed elements from attached document roots.
131
- */
132
- private _hasChangedSinceTheLastRendering;
133
- /**
134
- * @param stylesProcessor The styles processor instance.
135
- */
136
- constructor(stylesProcessor: StylesProcessor);
137
- /**
138
- * Attaches a DOM root element to the view element and enable all observers on that element.
139
- * Also {@link module:engine/view/renderer~ViewRenderer#markToSync mark element} to be synchronized
140
- * with the view what means that all child nodes will be removed and replaced with content of the view root.
141
- *
142
- * This method also will change view element name as the same as tag name of given dom root.
143
- * Name is always transformed to lower case.
144
- *
145
- * **Note:** Use {@link #detachDomRoot `detachDomRoot()`} to revert this action.
146
- *
147
- * @param domRoot DOM root element.
148
- * @param name Name of the root.
149
- */
150
- attachDomRoot(domRoot: HTMLElement, name?: string): void;
151
- /**
152
- * Detaches a DOM root element from the view element and restores its attributes to the state before
153
- * {@link #attachDomRoot `attachDomRoot()`}.
154
- *
155
- * @param name Name of the root to detach.
156
- */
157
- detachDomRoot(name: string): void;
158
- /**
159
- * Gets DOM root element.
160
- *
161
- * @param name Name of the root.
162
- * @returns DOM root element instance.
163
- */
164
- getDomRoot(name?: string): HTMLElement | undefined;
165
- /**
166
- * Creates observer of the given type if not yet created, {@link module:engine/view/observer/observer~Observer#enable enables} it
167
- * and {@link module:engine/view/observer/observer~Observer#observe attaches} to all existing and future
168
- * {@link #domRoots DOM roots}.
169
- *
170
- * Note: Observers are recognized by their constructor (classes). A single observer will be instantiated and used only
171
- * when registered for the first time. This means that features and other components can register a single observer
172
- * multiple times without caring whether it has been already added or not.
173
- *
174
- * @param ObserverConstructor The constructor of an observer to add.
175
- * Should create an instance inheriting from {@link module:engine/view/observer/observer~Observer}.
176
- * @returns Added observer instance.
177
- */
178
- addObserver(ObserverConstructor: ObserverConstructor): Observer;
179
- getObserver<T extends ObserverConstructor>(ObserverConstructor: T): T extends AlwaysRegisteredViewObservers ? InstanceType<T> : InstanceType<T> | undefined;
180
- /**
181
- * Disables all added observers.
182
- */
183
- disableObservers(): void;
184
- /**
185
- * Enables all added observers.
186
- */
187
- enableObservers(): void;
188
- /**
189
- * Scrolls the page viewport and {@link #domRoots} with their ancestors to reveal the
190
- * caret, **if not already visible to the user**.
191
- *
192
- * **Note**: Calling this method fires the {@link module:engine/view/view~ViewScrollToTheSelectionEvent} event that
193
- * allows custom behaviors.
194
- *
195
- * @param options Additional configuration of the scrolling behavior.
196
- * @param options.viewportOffset A distance between the DOM selection and the viewport boundary to be maintained
197
- * while scrolling to the selection (default is 20px). Setting this value to `0` will reveal the selection precisely at
198
- * the viewport boundary.
199
- * @param options.ancestorOffset A distance between the DOM selection and scrollable DOM root ancestor(s) to be maintained
200
- * while scrolling to the selection (default is 20px). Setting this value to `0` will reveal the selection precisely at
201
- * the scrollable ancestor(s) boundary.
202
- * @param options.alignToTop When set `true`, the DOM selection will be aligned to the top of the viewport if not already visible
203
- * (see `forceScroll` to learn more).
204
- * @param options.forceScroll When set `true`, the DOM selection will be aligned to the top of the viewport and scrollable ancestors
205
- * whether it is already visible or not. This option will only work when `alignToTop` is `true`.
206
- */
207
- scrollToTheSelection<T extends boolean, U extends IfTrue<T>>({ alignToTop, forceScroll, viewportOffset, ancestorOffset }?: {
208
- readonly viewportOffset?: number | {
209
- top: number;
210
- bottom: number;
211
- left: number;
212
- right: number;
213
- };
214
- readonly ancestorOffset?: number;
215
- readonly alignToTop?: T;
216
- readonly forceScroll?: U;
217
- }): void;
218
- /**
219
- * It will focus DOM element representing {@link module:engine/view/editableelement~ViewEditableElement ViewEditableElement}
220
- * that is currently having selection inside.
221
- */
222
- focus(): void;
223
- /**
224
- * The `change()` method is the primary way of changing the view. You should use it to modify any node in the view tree.
225
- * It makes sure that after all changes are made the view is rendered to the DOM (assuming that the view will be changed
226
- * inside the callback). It prevents situations when the DOM is updated when the view state is not yet correct. It allows
227
- * to nest calls one inside another and still performs a single rendering after all those changes are made.
228
- * It also returns the return value of its callback.
229
- *
230
- * ```ts
231
- * const text = view.change( writer => {
232
- * const newText = writer.createText( 'foo' );
233
- * writer.insert( position1, newText );
234
- *
235
- * view.change( writer => {
236
- * writer.insert( position2, writer.createText( 'bar' ) );
237
- * } );
238
- *
239
- * writer.remove( range );
240
- *
241
- * return newText;
242
- * } );
243
- * ```
244
- *
245
- * When the outermost change block is done and rendering to the DOM is over the
246
- * {@link module:engine/view/view~EditingView#event:render `View#render`} event is fired.
247
- *
248
- * This method throws a `applying-view-changes-on-rendering` error when
249
- * the change block is used after rendering to the DOM has started.
250
- *
251
- * @param callback Callback function which may modify the view.
252
- * @returns Value returned by the callback.
253
- */
254
- change<TReturn>(callback: (writer: ViewDowncastWriter) => TReturn): TReturn;
255
- /**
256
- * Forces rendering {@link module:engine/view/document~ViewDocument view document} to DOM. If any view changes are
257
- * currently in progress, rendering will start after all {@link #change change blocks} are processed.
258
- *
259
- * Note that this method is dedicated for special cases. All view changes should be wrapped in the {@link #change}
260
- * block and the view will automatically check whether it needs to render DOM or not.
261
- *
262
- * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `applying-view-changes-on-rendering` when
263
- * trying to re-render when rendering to DOM has already started.
264
- */
265
- forceRender(): void;
266
- /**
267
- * Destroys this instance. Makes sure that all observers are destroyed and listeners removed.
268
- */
269
- destroy(): void;
270
- /**
271
- * Creates position at the given location. The location can be specified as:
272
- *
273
- * * a {@link module:engine/view/position~ViewPosition position},
274
- * * parent element and offset (offset defaults to `0`),
275
- * * parent element and `'end'` (sets position at the end of that element),
276
- * * {@link module:engine/view/item~ViewItem view item} and `'before'` or `'after'` (sets position before or after given view item).
277
- *
278
- * This method is a shortcut to other constructors such as:
279
- *
280
- * * {@link #createPositionBefore},
281
- * * {@link #createPositionAfter},
282
- *
283
- * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.
284
- */
285
- createPositionAt(itemOrPosition: ViewItem | ViewPosition, offset?: ViewPositionOffset): ViewPosition;
286
- /**
287
- * Creates a new position after given view item.
288
- *
289
- * @param item View item after which the position should be located.
290
- */
291
- createPositionAfter(item: ViewItem): ViewPosition;
292
- /**
293
- * Creates a new position before given view item.
294
- *
295
- * @param item View item before which the position should be located.
296
- */
297
- createPositionBefore(item: ViewItem): ViewPosition;
298
- /**
299
- * Creates a range spanning from `start` position to `end` position.
300
- *
301
- * **Note:** This factory method creates it's own {@link module:engine/view/position~ViewPosition} instances basing on passed values.
302
- *
303
- * @param start Start position.
304
- * @param end End position. If not set, range will be collapsed at `start` position.
305
- */
306
- createRange(start: ViewPosition, end?: ViewPosition | null): ViewRange;
307
- /**
308
- * Creates a range that starts before given {@link module:engine/view/item~ViewItem view item} and ends after it.
309
- */
310
- createRangeOn(item: ViewItem): ViewRange;
311
- /**
312
- * Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of
313
- * that element and ends after the last child of that element.
314
- *
315
- * @param element Element which is a parent for the range.
316
- */
317
- createRangeIn(element: ViewElement | ViewDocumentFragment): ViewRange;
318
- /**
319
- * Creates new {@link module:engine/view/selection~ViewSelection} instance.
320
- *
321
- * ```ts
322
- * // Creates collapsed selection at the position of given item and offset.
323
- * const paragraph = view.createContainerElement( 'paragraph' );
324
- * const selection = view.createSelection( paragraph, offset );
325
- *
326
- * // Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the
327
- * // first child of that element and ends after the last child of that element.
328
- * const selection = view.createSelection( paragraph, 'in' );
329
- *
330
- * // Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends
331
- * // just after the item.
332
- * const selection = view.createSelection( paragraph, 'on' );
333
- * ```
334
- *
335
- * `Selection`'s factory method allow passing additional options (`backward`, `fake` and `label`) as the last argument.
336
- *
337
- * ```ts
338
- * // Creates backward selection.
339
- * const selection = view.createSelection( paragraph, 'in', { backward: true } );
340
- * ```
341
- *
342
- * Fake selection does not render as browser native selection over selected elements and is hidden to the user.
343
- * This way, no native selection UI artifacts are displayed to the user and selection over elements can be
344
- * represented in other way, for example by applying proper CSS class.
345
- *
346
- * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
347
- * (and be properly handled by screen readers).
348
- *
349
- * ```ts
350
- * // Creates fake selection with label.
351
- * const selection = view.createSelection( element, 'in', { fake: true, label: 'foo' } );
352
- * ```
353
- *
354
- * See also: {@link #createSelection:SELECTABLE `createSelection( selectable, options )`}.
355
- *
356
- * @label NODE_OFFSET
357
- */
358
- createSelection(selectable: ViewNode, placeOrOffset: ViewPlaceOrOffset, options?: ViewSelectionOptions): ViewSelection;
359
- /**
360
- * Creates new {@link module:engine/view/selection~ViewSelection} instance.
361
- *
362
- * ```ts
363
- * // Creates empty selection without ranges.
364
- * const selection = view.createSelection();
365
- *
366
- * // Creates selection at the given range.
367
- * const range = view.createRange( start, end );
368
- * const selection = view.createSelection( range );
369
- *
370
- * // Creates selection at the given ranges
371
- * const ranges = [ view.createRange( start1, end2 ), view.createRange( star2, end2 ) ];
372
- * const selection = view.createSelection( ranges );
373
- *
374
- * // Creates selection from the other selection.
375
- * const otherSelection = view.createSelection();
376
- * const selection = view.createSelection( otherSelection );
377
- *
378
- * // Creates selection from the document selection.
379
- * const selection = view.createSelection( editor.editing.view.document.selection );
380
- *
381
- * // Creates selection at the given position.
382
- * const position = view.createPositionFromPath( root, path );
383
- * const selection = view.createSelection( position );
384
- * ```
385
- *
386
- * `Selection`'s factory method allow passing additional options (`backward`, `fake` and `label`) as the last argument.
387
- *
388
- * ```ts
389
- * // Creates backward selection.
390
- * const selection = view.createSelection( range, { backward: true } );
391
- * ```
392
- *
393
- * Fake selection does not render as browser native selection over selected elements and is hidden to the user.
394
- * This way, no native selection UI artifacts are displayed to the user and selection over elements can be
395
- * represented in other way, for example by applying proper CSS class.
396
- *
397
- * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
398
- * (and be properly handled by screen readers).
399
- *
400
- * ```ts
401
- * // Creates fake selection with label.
402
- * const selection = view.createSelection( range, { fake: true, label: 'foo' } );
403
- * ```
404
- *
405
- * See also: {@link #createSelection:NODE_OFFSET `createSelection( node, placeOrOffset, options )`}.
406
- *
407
- * @label SELECTABLE
408
- */
409
- createSelection(selectable?: Exclude<ViewSelectable, ViewNode>, options?: ViewSelectionOptions): ViewSelection;
410
- /**
411
- * Disables or enables rendering. If the flag is set to `true` then the rendering will be disabled.
412
- * If the flag is set to `false` and if there was some change in the meantime, then the rendering action will be performed.
413
- *
414
- * @internal
415
- * @param flag A flag indicates whether the rendering should be disabled.
416
- */
417
- _disableRendering(flag: boolean): void;
418
- /**
419
- * Renders all changes. In order to avoid triggering the observers (e.g. selection) all observers are disabled
420
- * before rendering and re-enabled after that.
421
- */
422
- private _render;
33
+ * Editor's view controller class. Its main responsibility is DOM - View management for editing purposes, to provide
34
+ * abstraction over the DOM structure and events and hide all browsers quirks.
35
+ *
36
+ * View controller renders view document to DOM whenever view structure changes. To determine when view can be rendered,
37
+ * all changes need to be done using the {@link module:engine/view/view~EditingView#change} method, using
38
+ * {@link module:engine/view/downcastwriter~ViewDowncastWriter}:
39
+ *
40
+ * ```ts
41
+ * view.change( writer => {
42
+ * writer.insert( position, writer.createText( 'foo' ) );
43
+ * } );
44
+ * ```
45
+ *
46
+ * View controller also register {@link module:engine/view/observer/observer~Observer observers} which observes changes
47
+ * on DOM and fire events on the {@link module:engine/view/document~ViewDocument Document}.
48
+ * Note that the following observers are added by the class constructor and are always available:
49
+ *
50
+ * * {@link module:engine/view/observer/selectionobserver~SelectionObserver},
51
+ * * {@link module:engine/view/observer/focusobserver~FocusObserver},
52
+ * * {@link module:engine/view/observer/keyobserver~KeyObserver},
53
+ * * {@link module:engine/view/observer/fakeselectionobserver~FakeSelectionObserver}.
54
+ * * {@link module:engine/view/observer/compositionobserver~CompositionObserver}.
55
+ * * {@link module:engine/view/observer/inputobserver~InputObserver}.
56
+ * * {@link module:engine/view/observer/arrowkeysobserver~ArrowKeysObserver}.
57
+ * * {@link module:engine/view/observer/tabobserver~TabObserver}.
58
+ *
59
+ * This class also {@link module:engine/view/view~EditingView#attachDomRoot binds the DOM and the view elements}.
60
+ *
61
+ * If you do not need full a DOM - view management, and only want to transform a tree of view elements to a tree of DOM
62
+ * elements you do not need this controller. You can use the {@link module:engine/view/domconverter~ViewDomConverter ViewDomConverter}
63
+ * instead.
64
+ */
65
+ export declare class EditingView extends EditingViewBase {
66
+ /**
67
+ * Instance of the {@link module:engine/view/document~ViewDocument} associated with this view controller.
68
+ */
69
+ readonly document: ViewDocument;
70
+ /**
71
+ * Instance of the {@link module:engine/view/domconverter~ViewDomConverter domConverter} used by
72
+ * {@link module:engine/view/view~EditingView#_renderer renderer}
73
+ * and {@link module:engine/view/observer/observer~Observer observers}.
74
+ */
75
+ readonly domConverter: ViewDomConverter;
76
+ /**
77
+ * Roots of the DOM tree. Map on the `HTMLElement`s with roots names as keys.
78
+ */
79
+ readonly domRoots: Map<string, HTMLElement>;
80
+ /**
81
+ * Used to prevent calling {@link #forceRender} and {@link #change} during rendering view to the DOM.
82
+ *
83
+ * @observable
84
+ * @readonly
85
+ */
86
+ isRenderingInProgress: boolean;
87
+ /**
88
+ * Informs whether the DOM selection is inside any of the DOM roots managed by the view.
89
+ *
90
+ * @observable
91
+ * @readonly
92
+ */
93
+ hasDomSelection: boolean;
94
+ /**
95
+ * Instance of the {@link module:engine/view/renderer~ViewRenderer renderer}.
96
+ */
97
+ private readonly _renderer;
98
+ /**
99
+ * A DOM root attributes cache. It saves the initial values of DOM root attributes before the DOM element
100
+ * is {@link module:engine/view/view~EditingView#attachDomRoot attached} to the view so later on, when
101
+ * the view is destroyed ({@link module:engine/view/view~EditingView#detachDomRoot}), they can be easily restored.
102
+ * This way, the DOM element can go back to the (clean) state as if the editing view never used it.
103
+ */
104
+ private readonly _initialDomRootAttributes;
105
+ /**
106
+ * Map of registered {@link module:engine/view/observer/observer~Observer observers}.
107
+ */
108
+ private readonly _observers;
109
+ /**
110
+ * ViewDowncastWriter instance used in {@link #change change method} callbacks.
111
+ */
112
+ private readonly _writer;
113
+ /**
114
+ * Is set to `true` when {@link #change view changes} are currently in progress.
115
+ */
116
+ private _ongoingChange;
117
+ /**
118
+ * Used to prevent calling {@link #forceRender} and {@link #change} during rendering view to the DOM.
119
+ */
120
+ private _postFixersInProgress;
121
+ /**
122
+ * Internal flag to temporary disable rendering. See the usage in the {@link #_disableRendering}.
123
+ */
124
+ private _renderingDisabled;
125
+ /**
126
+ * Internal flag that disables rendering when there are no changes since the last rendering.
127
+ * It stores information about changed selection and changed elements from attached document roots.
128
+ */
129
+ private _hasChangedSinceTheLastRendering;
130
+ /**
131
+ * @param stylesProcessor The styles processor instance.
132
+ */
133
+ constructor(stylesProcessor: StylesProcessor);
134
+ /**
135
+ * Attaches a DOM root element to the view element and enable all observers on that element.
136
+ * Also {@link module:engine/view/renderer~ViewRenderer#markToSync mark element} to be synchronized
137
+ * with the view what means that all child nodes will be removed and replaced with content of the view root.
138
+ *
139
+ * This method also will change view element name as the same as tag name of given dom root.
140
+ * Name is always transformed to lower case.
141
+ *
142
+ * **Note:** Use {@link #detachDomRoot `detachDomRoot()`} to revert this action.
143
+ *
144
+ * @param domRoot DOM root element.
145
+ * @param name Name of the root.
146
+ */
147
+ attachDomRoot(domRoot: HTMLElement, name?: string): void;
148
+ /**
149
+ * Detaches a DOM root element from the view element and restores its attributes to the state before
150
+ * {@link #attachDomRoot `attachDomRoot()`}.
151
+ *
152
+ * @param name Name of the root to detach.
153
+ */
154
+ detachDomRoot(name: string): void;
155
+ /**
156
+ * Gets DOM root element.
157
+ *
158
+ * @param name Name of the root.
159
+ * @returns DOM root element instance.
160
+ */
161
+ getDomRoot(name?: string): HTMLElement | undefined;
162
+ /**
163
+ * Creates observer of the given type if not yet created, {@link module:engine/view/observer/observer~Observer#enable enables} it
164
+ * and {@link module:engine/view/observer/observer~Observer#observe attaches} to all existing and future
165
+ * {@link #domRoots DOM roots}.
166
+ *
167
+ * Note: Observers are recognized by their constructor (classes). A single observer will be instantiated and used only
168
+ * when registered for the first time. This means that features and other components can register a single observer
169
+ * multiple times without caring whether it has been already added or not.
170
+ *
171
+ * @param ObserverConstructor The constructor of an observer to add.
172
+ * Should create an instance inheriting from {@link module:engine/view/observer/observer~Observer}.
173
+ * @returns Added observer instance.
174
+ */
175
+ addObserver(ObserverConstructor: ObserverConstructor): Observer;
176
+ getObserver<T extends ObserverConstructor>(ObserverConstructor: T): T extends AlwaysRegisteredViewObservers ? InstanceType<T> : InstanceType<T> | undefined;
177
+ /**
178
+ * Disables all added observers.
179
+ */
180
+ disableObservers(): void;
181
+ /**
182
+ * Enables all added observers.
183
+ */
184
+ enableObservers(): void;
185
+ /**
186
+ * Scrolls the page viewport and {@link #domRoots} with their ancestors to reveal the
187
+ * caret, **if not already visible to the user**.
188
+ *
189
+ * **Note**: Calling this method fires the {@link module:engine/view/view~ViewScrollToTheSelectionEvent} event that
190
+ * allows custom behaviors.
191
+ *
192
+ * @param options Additional configuration of the scrolling behavior.
193
+ * @param options.viewportOffset A distance between the DOM selection and the viewport boundary to be maintained
194
+ * while scrolling to the selection (default is 20px). Setting this value to `0` will reveal the selection precisely at
195
+ * the viewport boundary.
196
+ * @param options.ancestorOffset A distance between the DOM selection and scrollable DOM root ancestor(s) to be maintained
197
+ * while scrolling to the selection (default is 20px). Setting this value to `0` will reveal the selection precisely at
198
+ * the scrollable ancestor(s) boundary.
199
+ * @param options.alignToTop When set `true`, the DOM selection will be aligned to the top of the viewport if not already visible
200
+ * (see `forceScroll` to learn more).
201
+ * @param options.forceScroll When set `true`, the DOM selection will be aligned to the top of the viewport and scrollable ancestors
202
+ * whether it is already visible or not. This option will only work when `alignToTop` is `true`.
203
+ */
204
+ scrollToTheSelection<
205
+ T extends boolean,
206
+ U extends IfTrue<T>
207
+ >({ alignToTop, forceScroll, viewportOffset, ancestorOffset }?: {
208
+ readonly viewportOffset?: number | {
209
+ top: number;
210
+ bottom: number;
211
+ left: number;
212
+ right: number;
213
+ };
214
+ readonly ancestorOffset?: number;
215
+ readonly alignToTop?: T;
216
+ readonly forceScroll?: U;
217
+ }): void;
218
+ /**
219
+ * It will focus DOM element representing {@link module:engine/view/editableelement~ViewEditableElement ViewEditableElement}
220
+ * that is currently having selection inside.
221
+ */
222
+ focus(): void;
223
+ /**
224
+ * The `change()` method is the primary way of changing the view. You should use it to modify any node in the view tree.
225
+ * It makes sure that after all changes are made the view is rendered to the DOM (assuming that the view will be changed
226
+ * inside the callback). It prevents situations when the DOM is updated when the view state is not yet correct. It allows
227
+ * to nest calls one inside another and still performs a single rendering after all those changes are made.
228
+ * It also returns the return value of its callback.
229
+ *
230
+ * ```ts
231
+ * const text = view.change( writer => {
232
+ * const newText = writer.createText( 'foo' );
233
+ * writer.insert( position1, newText );
234
+ *
235
+ * view.change( writer => {
236
+ * writer.insert( position2, writer.createText( 'bar' ) );
237
+ * } );
238
+ *
239
+ * writer.remove( range );
240
+ *
241
+ * return newText;
242
+ * } );
243
+ * ```
244
+ *
245
+ * When the outermost change block is done and rendering to the DOM is over the
246
+ * {@link module:engine/view/view~EditingView#event:render `View#render`} event is fired.
247
+ *
248
+ * This method throws a `applying-view-changes-on-rendering` error when
249
+ * the change block is used after rendering to the DOM has started.
250
+ *
251
+ * @param callback Callback function which may modify the view.
252
+ * @returns Value returned by the callback.
253
+ */
254
+ change<TReturn>(callback: (writer: ViewDowncastWriter) => TReturn): TReturn;
255
+ /**
256
+ * Forces rendering {@link module:engine/view/document~ViewDocument view document} to DOM. If any view changes are
257
+ * currently in progress, rendering will start after all {@link #change change blocks} are processed.
258
+ *
259
+ * Note that this method is dedicated for special cases. All view changes should be wrapped in the {@link #change}
260
+ * block and the view will automatically check whether it needs to render DOM or not.
261
+ *
262
+ * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `applying-view-changes-on-rendering` when
263
+ * trying to re-render when rendering to DOM has already started.
264
+ */
265
+ forceRender(): void;
266
+ /**
267
+ * Destroys this instance. Makes sure that all observers are destroyed and listeners removed.
268
+ */
269
+ destroy(): void;
270
+ /**
271
+ * Creates position at the given location. The location can be specified as:
272
+ *
273
+ * * a {@link module:engine/view/position~ViewPosition position},
274
+ * * parent element and offset (offset defaults to `0`),
275
+ * * parent element and `'end'` (sets position at the end of that element),
276
+ * * {@link module:engine/view/item~ViewItem view item} and `'before'` or `'after'` (sets position before or after given view item).
277
+ *
278
+ * This method is a shortcut to other constructors such as:
279
+ *
280
+ * * {@link #createPositionBefore},
281
+ * * {@link #createPositionAfter},
282
+ *
283
+ * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.
284
+ */
285
+ createPositionAt(itemOrPosition: ViewItem | ViewPosition, offset?: ViewPositionOffset): ViewPosition;
286
+ /**
287
+ * Creates a new position after given view item.
288
+ *
289
+ * @param item View item after which the position should be located.
290
+ */
291
+ createPositionAfter(item: ViewItem): ViewPosition;
292
+ /**
293
+ * Creates a new position before given view item.
294
+ *
295
+ * @param item View item before which the position should be located.
296
+ */
297
+ createPositionBefore(item: ViewItem): ViewPosition;
298
+ /**
299
+ * Creates a range spanning from `start` position to `end` position.
300
+ *
301
+ * **Note:** This factory method creates it's own {@link module:engine/view/position~ViewPosition} instances basing on passed values.
302
+ *
303
+ * @param start Start position.
304
+ * @param end End position. If not set, range will be collapsed at `start` position.
305
+ */
306
+ createRange(start: ViewPosition, end?: ViewPosition | null): ViewRange;
307
+ /**
308
+ * Creates a range that starts before given {@link module:engine/view/item~ViewItem view item} and ends after it.
309
+ */
310
+ createRangeOn(item: ViewItem): ViewRange;
311
+ /**
312
+ * Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of
313
+ * that element and ends after the last child of that element.
314
+ *
315
+ * @param element Element which is a parent for the range.
316
+ */
317
+ createRangeIn(element: ViewElement | ViewDocumentFragment): ViewRange;
318
+ /**
319
+ * Creates new {@link module:engine/view/selection~ViewSelection} instance.
320
+ *
321
+ * ```ts
322
+ * // Creates collapsed selection at the position of given item and offset.
323
+ * const paragraph = view.createContainerElement( 'paragraph' );
324
+ * const selection = view.createSelection( paragraph, offset );
325
+ *
326
+ * // Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the
327
+ * // first child of that element and ends after the last child of that element.
328
+ * const selection = view.createSelection( paragraph, 'in' );
329
+ *
330
+ * // Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends
331
+ * // just after the item.
332
+ * const selection = view.createSelection( paragraph, 'on' );
333
+ * ```
334
+ *
335
+ * `Selection`'s factory method allow passing additional options (`backward`, `fake` and `label`) as the last argument.
336
+ *
337
+ * ```ts
338
+ * // Creates backward selection.
339
+ * const selection = view.createSelection( paragraph, 'in', { backward: true } );
340
+ * ```
341
+ *
342
+ * Fake selection does not render as browser native selection over selected elements and is hidden to the user.
343
+ * This way, no native selection UI artifacts are displayed to the user and selection over elements can be
344
+ * represented in other way, for example by applying proper CSS class.
345
+ *
346
+ * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
347
+ * (and be properly handled by screen readers).
348
+ *
349
+ * ```ts
350
+ * // Creates fake selection with label.
351
+ * const selection = view.createSelection( element, 'in', { fake: true, label: 'foo' } );
352
+ * ```
353
+ *
354
+ * See also: {@link #createSelection:SELECTABLE `createSelection( selectable, options )`}.
355
+ *
356
+ * @label NODE_OFFSET
357
+ */
358
+ createSelection(selectable: ViewNode, placeOrOffset: ViewPlaceOrOffset, options?: ViewSelectionOptions): ViewSelection;
359
+ /**
360
+ * Creates new {@link module:engine/view/selection~ViewSelection} instance.
361
+ *
362
+ * ```ts
363
+ * // Creates empty selection without ranges.
364
+ * const selection = view.createSelection();
365
+ *
366
+ * // Creates selection at the given range.
367
+ * const range = view.createRange( start, end );
368
+ * const selection = view.createSelection( range );
369
+ *
370
+ * // Creates selection at the given ranges
371
+ * const ranges = [ view.createRange( start1, end2 ), view.createRange( star2, end2 ) ];
372
+ * const selection = view.createSelection( ranges );
373
+ *
374
+ * // Creates selection from the other selection.
375
+ * const otherSelection = view.createSelection();
376
+ * const selection = view.createSelection( otherSelection );
377
+ *
378
+ * // Creates selection from the document selection.
379
+ * const selection = view.createSelection( editor.editing.view.document.selection );
380
+ *
381
+ * // Creates selection at the given position.
382
+ * const position = view.createPositionFromPath( root, path );
383
+ * const selection = view.createSelection( position );
384
+ * ```
385
+ *
386
+ * `Selection`'s factory method allow passing additional options (`backward`, `fake` and `label`) as the last argument.
387
+ *
388
+ * ```ts
389
+ * // Creates backward selection.
390
+ * const selection = view.createSelection( range, { backward: true } );
391
+ * ```
392
+ *
393
+ * Fake selection does not render as browser native selection over selected elements and is hidden to the user.
394
+ * This way, no native selection UI artifacts are displayed to the user and selection over elements can be
395
+ * represented in other way, for example by applying proper CSS class.
396
+ *
397
+ * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
398
+ * (and be properly handled by screen readers).
399
+ *
400
+ * ```ts
401
+ * // Creates fake selection with label.
402
+ * const selection = view.createSelection( range, { fake: true, label: 'foo' } );
403
+ * ```
404
+ *
405
+ * See also: {@link #createSelection:NODE_OFFSET `createSelection( node, placeOrOffset, options )`}.
406
+ *
407
+ * @label SELECTABLE
408
+ */
409
+ createSelection(selectable?: Exclude<ViewSelectable, ViewNode>, options?: ViewSelectionOptions): ViewSelection;
410
+ /**
411
+ * Disables or enables rendering. If the flag is set to `true` then the rendering will be disabled.
412
+ * If the flag is set to `false` and if there was some change in the meantime, then the rendering action will be performed.
413
+ *
414
+ * @internal
415
+ * @param flag A flag indicates whether the rendering should be disabled.
416
+ */
417
+ _disableRendering(flag: boolean): void;
418
+ /**
419
+ * Renders all changes. In order to avoid triggering the observers (e.g. selection) all observers are disabled
420
+ * before rendering and re-enabled after that.
421
+ */
422
+ private _render;
423
423
  }
424
424
  /**
425
- * Fired after a topmost {@link module:engine/view/view~EditingView#change change block} and all
426
- * {@link module:engine/view/document~ViewDocument#registerPostFixer post-fixers} are executed.
427
- *
428
- * Actual rendering is performed as a first listener on 'normal' priority.
429
- *
430
- * ```ts
431
- * view.on( 'render', () => {
432
- * // Rendering to the DOM is complete.
433
- * } );
434
- * ```
435
- *
436
- * This event is useful when you want to update interface elements after the rendering, e.g. position of the
437
- * balloon panel. If you wants to change view structure use
438
- * {@link module:engine/view/document~ViewDocument#registerPostFixer post-fixers}.
439
- *
440
- * @eventName ~EditingView#render
441
- */
425
+ * Fired after a topmost {@link module:engine/view/view~EditingView#change change block} and all
426
+ * {@link module:engine/view/document~ViewDocument#registerPostFixer post-fixers} are executed.
427
+ *
428
+ * Actual rendering is performed as a first listener on 'normal' priority.
429
+ *
430
+ * ```ts
431
+ * view.on( 'render', () => {
432
+ * // Rendering to the DOM is complete.
433
+ * } );
434
+ * ```
435
+ *
436
+ * This event is useful when you want to update interface elements after the rendering, e.g. position of the
437
+ * balloon panel. If you wants to change view structure use
438
+ * {@link module:engine/view/document~ViewDocument#registerPostFixer post-fixers}.
439
+ *
440
+ * @eventName ~EditingView#render
441
+ */
442
442
  export type ViewRenderEvent = {
443
- name: 'render';
444
- args: [];
443
+ name: "render";
444
+ args: [];
445
445
  };
446
446
  /**
447
- * An event fired at the moment of {@link module:engine/view/view~EditingView#scrollToTheSelection} being called. It
448
- * carries two objects in its payload (`args`):
449
- *
450
- * * The first argument is the {@link module:engine/view/view~ViewScrollToTheSelectionEventData object containing data} that gets
451
- * passed down to the {@link module:utils/dom/scroll~scrollViewportToShowTarget} helper. If some event listener modifies it, it can
452
- * adjust the behavior of the scrolling (e.g. include additional `viewportOffset`).
453
- * * The second argument corresponds to the original arguments passed to {@link module:utils/dom/scroll~scrollViewportToShowTarget}.
454
- * It allows listeners to re-execute the `scrollViewportToShowTarget()` method with its original arguments if there is such a need,
455
- * for instance, if the integration requires re–scrolling after certain interaction.
456
- *
457
- * @eventName ~EditingView#scrollToTheSelection
458
- */
447
+ * An event fired at the moment of {@link module:engine/view/view~EditingView#scrollToTheSelection} being called. It
448
+ * carries two objects in its payload (`args`):
449
+ *
450
+ * * The first argument is the {@link module:engine/view/view~ViewScrollToTheSelectionEventData object containing data} that gets
451
+ * passed down to the {@link module:utils/dom/scroll~scrollViewportToShowTarget} helper. If some event listener modifies it, it can
452
+ * adjust the behavior of the scrolling (e.g. include additional `viewportOffset`).
453
+ * * The second argument corresponds to the original arguments passed to {@link module:utils/dom/scroll~scrollViewportToShowTarget}.
454
+ * It allows listeners to re-execute the `scrollViewportToShowTarget()` method with its original arguments if there is such a need,
455
+ * for instance, if the integration requires re–scrolling after certain interaction.
456
+ *
457
+ * @eventName ~EditingView#scrollToTheSelection
458
+ */
459
459
  export type ViewScrollToTheSelectionEvent = {
460
- name: 'scrollToTheSelection';
461
- args: [
462
- ViewScrollToTheSelectionEventData,
463
- Parameters<EditingView['scrollToTheSelection']>[0]
464
- ];
460
+ name: "scrollToTheSelection";
461
+ args: [ViewScrollToTheSelectionEventData, Parameters<EditingView["scrollToTheSelection"]>[0]];
465
462
  };
466
463
  /**
467
- * An object passed down to the {@link module:utils/dom/scroll~scrollViewportToShowTarget} helper while calling
468
- * {@link module:engine/view/view~EditingView#scrollToTheSelection}.
469
- */
464
+ * An object passed down to the {@link module:utils/dom/scroll~scrollViewportToShowTarget} helper while calling
465
+ * {@link module:engine/view/view~EditingView#scrollToTheSelection}.
466
+ */
470
467
  export type ViewScrollToTheSelectionEventData = {
471
- target: DomRange;
472
- viewportOffset: {
473
- top: number;
474
- bottom: number;
475
- left: number;
476
- right: number;
477
- };
478
- ancestorOffset: number;
479
- alignToTop?: boolean;
480
- forceScroll?: boolean;
468
+ target: DomRange;
469
+ viewportOffset: {
470
+ top: number;
471
+ bottom: number;
472
+ left: number;
473
+ right: number;
474
+ };
475
+ ancestorOffset: number;
476
+ alignToTop?: boolean;
477
+ forceScroll?: boolean;
481
478
  };
482
479
  /**
483
- * Observers that are always registered.
484
- */
480
+ * Observers that are always registered.
481
+ */
485
482
  export type AlwaysRegisteredViewObservers = typeof MutationObserver | typeof FocusObserver | typeof SelectionObserver | typeof KeyObserver | typeof FakeSelectionObserver | typeof CompositionObserver | typeof ArrowKeysObserver | typeof InputObserver | typeof TabObserver;
486
483
  export {};