@ckeditor/ckeditor5-engine 41.3.0-alpha.4 → 41.3.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 (132) hide show
  1. package/package.json +2 -3
  2. package/src/model/node.d.ts +1 -0
  3. package/src/model/node.js +2 -0
  4. package/src/model/position.d.ts +1 -0
  5. package/src/model/position.js +2 -0
  6. package/src/view/node.d.ts +1 -0
  7. package/src/view/node.js +2 -0
  8. package/src/view/position.d.ts +1 -0
  9. package/src/view/position.js +2 -0
  10. package/dist/content-index.css +0 -4
  11. package/dist/editor-index.css +0 -23
  12. package/dist/index.css +0 -49
  13. package/dist/index.css.map +0 -1
  14. package/dist/types/controller/datacontroller.d.ts +0 -339
  15. package/dist/types/controller/editingcontroller.d.ts +0 -102
  16. package/dist/types/conversion/conversion.d.ts +0 -482
  17. package/dist/types/conversion/conversionhelpers.d.ts +0 -30
  18. package/dist/types/conversion/downcastdispatcher.d.ts +0 -566
  19. package/dist/types/conversion/downcasthelpers.d.ts +0 -1194
  20. package/dist/types/conversion/mapper.d.ts +0 -507
  21. package/dist/types/conversion/modelconsumable.d.ts +0 -205
  22. package/dist/types/conversion/upcastdispatcher.d.ts +0 -496
  23. package/dist/types/conversion/upcasthelpers.d.ts +0 -503
  24. package/dist/types/conversion/viewconsumable.d.ts +0 -373
  25. package/dist/types/dataprocessor/basichtmlwriter.d.ts +0 -22
  26. package/dist/types/dataprocessor/dataprocessor.d.ts +0 -65
  27. package/dist/types/dataprocessor/htmldataprocessor.d.ts +0 -80
  28. package/dist/types/dataprocessor/htmlwriter.d.ts +0 -20
  29. package/dist/types/dataprocessor/xmldataprocessor.d.ts +0 -94
  30. package/dist/types/dev-utils/model.d.ts +0 -128
  31. package/dist/types/dev-utils/operationreplayer.d.ts +0 -55
  32. package/dist/types/dev-utils/utils.d.ts +0 -41
  33. package/dist/types/dev-utils/view.d.ts +0 -323
  34. package/dist/types/index.d.ts +0 -117
  35. package/dist/types/model/batch.d.ts +0 -110
  36. package/dist/types/model/differ.d.ts +0 -419
  37. package/dist/types/model/document.d.ts +0 -278
  38. package/dist/types/model/documentfragment.d.ts +0 -204
  39. package/dist/types/model/documentselection.d.ts +0 -424
  40. package/dist/types/model/element.d.ts +0 -169
  41. package/dist/types/model/history.d.ts +0 -118
  42. package/dist/types/model/item.d.ts +0 -18
  43. package/dist/types/model/liveposition.d.ts +0 -81
  44. package/dist/types/model/liverange.d.ts +0 -106
  45. package/dist/types/model/markercollection.d.ts +0 -339
  46. package/dist/types/model/model.d.ts +0 -923
  47. package/dist/types/model/node.d.ts +0 -259
  48. package/dist/types/model/nodelist.d.ts +0 -95
  49. package/dist/types/model/operation/attributeoperation.d.ts +0 -107
  50. package/dist/types/model/operation/detachoperation.d.ts +0 -64
  51. package/dist/types/model/operation/insertoperation.d.ts +0 -94
  52. package/dist/types/model/operation/markeroperation.d.ts +0 -95
  53. package/dist/types/model/operation/mergeoperation.d.ts +0 -104
  54. package/dist/types/model/operation/moveoperation.d.ts +0 -100
  55. package/dist/types/model/operation/nooperation.d.ts +0 -42
  56. package/dist/types/model/operation/operation.d.ts +0 -100
  57. package/dist/types/model/operation/operationfactory.d.ts +0 -22
  58. package/dist/types/model/operation/renameoperation.d.ts +0 -87
  59. package/dist/types/model/operation/rootattributeoperation.d.ts +0 -102
  60. package/dist/types/model/operation/rootoperation.d.ts +0 -80
  61. package/dist/types/model/operation/splitoperation.d.ts +0 -113
  62. package/dist/types/model/operation/transform.d.ts +0 -104
  63. package/dist/types/model/operation/utils.d.ts +0 -75
  64. package/dist/types/model/position.d.ts +0 -542
  65. package/dist/types/model/range.d.ts +0 -462
  66. package/dist/types/model/rootelement.d.ts +0 -64
  67. package/dist/types/model/schema.d.ts +0 -1210
  68. package/dist/types/model/selection.d.ts +0 -486
  69. package/dist/types/model/text.d.ts +0 -70
  70. package/dist/types/model/textproxy.d.ts +0 -148
  71. package/dist/types/model/treewalker.d.ts +0 -190
  72. package/dist/types/model/typecheckable.d.ts +0 -289
  73. package/dist/types/model/utils/autoparagraphing.d.ts +0 -41
  74. package/dist/types/model/utils/deletecontent.d.ts +0 -62
  75. package/dist/types/model/utils/getselectedcontent.d.ts +0 -34
  76. package/dist/types/model/utils/insertcontent.d.ts +0 -50
  77. package/dist/types/model/utils/insertobject.d.ts +0 -51
  78. package/dist/types/model/utils/modifyselection.d.ts +0 -52
  79. package/dist/types/model/utils/selection-post-fixer.d.ts +0 -78
  80. package/dist/types/model/writer.d.ts +0 -855
  81. package/dist/types/view/attributeelement.d.ts +0 -112
  82. package/dist/types/view/containerelement.d.ts +0 -53
  83. package/dist/types/view/datatransfer.d.ts +0 -83
  84. package/dist/types/view/document.d.ts +0 -188
  85. package/dist/types/view/documentfragment.d.ts +0 -157
  86. package/dist/types/view/documentselection.d.ts +0 -310
  87. package/dist/types/view/domconverter.d.ts +0 -656
  88. package/dist/types/view/downcastwriter.d.ts +0 -1000
  89. package/dist/types/view/editableelement.d.ts +0 -66
  90. package/dist/types/view/element.d.ts +0 -472
  91. package/dist/types/view/elementdefinition.d.ts +0 -91
  92. package/dist/types/view/emptyelement.d.ts +0 -45
  93. package/dist/types/view/filler.d.ts +0 -115
  94. package/dist/types/view/item.d.ts +0 -18
  95. package/dist/types/view/matcher.d.ts +0 -490
  96. package/dist/types/view/node.d.ts +0 -166
  97. package/dist/types/view/observer/arrowkeysobserver.d.ts +0 -49
  98. package/dist/types/view/observer/bubblingemittermixin.d.ts +0 -170
  99. package/dist/types/view/observer/bubblingeventinfo.d.ts +0 -51
  100. package/dist/types/view/observer/clickobserver.d.ts +0 -47
  101. package/dist/types/view/observer/compositionobserver.d.ts +0 -86
  102. package/dist/types/view/observer/domeventdata.d.ts +0 -54
  103. package/dist/types/view/observer/domeventobserver.d.ts +0 -77
  104. package/dist/types/view/observer/fakeselectionobserver.d.ts +0 -51
  105. package/dist/types/view/observer/focusobserver.d.ts +0 -86
  106. package/dist/types/view/observer/inputobserver.d.ts +0 -90
  107. package/dist/types/view/observer/keyobserver.d.ts +0 -70
  108. package/dist/types/view/observer/mouseobserver.d.ts +0 -93
  109. package/dist/types/view/observer/mutationobserver.d.ts +0 -90
  110. package/dist/types/view/observer/observer.d.ts +0 -93
  111. package/dist/types/view/observer/selectionobserver.d.ts +0 -152
  112. package/dist/types/view/observer/tabobserver.d.ts +0 -50
  113. package/dist/types/view/placeholder.d.ts +0 -100
  114. package/dist/types/view/position.d.ts +0 -192
  115. package/dist/types/view/range.d.ts +0 -283
  116. package/dist/types/view/rawelement.d.ts +0 -77
  117. package/dist/types/view/renderer.d.ts +0 -269
  118. package/dist/types/view/rooteditableelement.d.ts +0 -45
  119. package/dist/types/view/selection.d.ts +0 -379
  120. package/dist/types/view/styles/background.d.ts +0 -37
  121. package/dist/types/view/styles/border.d.ts +0 -47
  122. package/dist/types/view/styles/margin.d.ts +0 -33
  123. package/dist/types/view/styles/padding.d.ts +0 -33
  124. package/dist/types/view/styles/utils.d.ts +0 -97
  125. package/dist/types/view/stylesmap.d.ts +0 -677
  126. package/dist/types/view/text.d.ts +0 -78
  127. package/dist/types/view/textproxy.d.ts +0 -101
  128. package/dist/types/view/treewalker.d.ts +0 -199
  129. package/dist/types/view/typecheckable.d.ts +0 -452
  130. package/dist/types/view/uielement.d.ts +0 -100
  131. package/dist/types/view/upcastwriter.d.ts +0 -421
  132. package/dist/types/view/view.d.ts +0 -491
@@ -1,152 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module engine/view/observer/selectionobserver
11
- */
12
- import Observer from './observer.js';
13
- import MutationObserver from './mutationobserver.js';
14
- import type View from '../view.js';
15
- import type DocumentSelection from '../documentselection.js';
16
- import type DomConverter from '../domconverter.js';
17
- import type Selection from '../selection.js';
18
- import FocusObserver from './focusobserver.js';
19
- type DomSelection = globalThis.Selection;
20
- /**
21
- * Selection observer class observes selection changes in the document. If a selection changes on the document this
22
- * observer checks if the DOM selection is different from the {@link module:engine/view/document~Document#selection view selection}.
23
- * The selection observer fires {@link module:engine/view/document~Document#event:selectionChange} event only if
24
- * a selection change was the only change in the document and the DOM selection is different from the view selection.
25
- *
26
- * This observer also manages the {@link module:engine/view/document~Document#isSelecting} property of the view document.
27
- *
28
- * Note that this observer is attached by the {@link module:engine/view/view~View} and is available by default.
29
- */
30
- export default class SelectionObserver extends Observer {
31
- /**
32
- * Instance of the mutation observer. Selection observer calls
33
- * {@link module:engine/view/observer/mutationobserver~MutationObserver#flush} to ensure that the mutations will be handled
34
- * before the {@link module:engine/view/document~Document#event:selectionChange} event is fired.
35
- */
36
- readonly mutationObserver: MutationObserver;
37
- /**
38
- * Instance of the focus observer. Focus observer calls
39
- * {@link module:engine/view/observer/focusobserver~FocusObserver#flush} to mark the latest focus change as complete.
40
- */
41
- readonly focusObserver: FocusObserver;
42
- /**
43
- * Reference to the view {@link module:engine/view/documentselection~DocumentSelection} object used to compare
44
- * new selection with it.
45
- */
46
- readonly selection: DocumentSelection;
47
- /**
48
- * Reference to the {@link module:engine/view/view~View#domConverter}.
49
- */
50
- readonly domConverter: DomConverter;
51
- /**
52
- * A set of documents which have added `selectionchange` listener to avoid adding a listener twice to the same
53
- * document.
54
- */
55
- private readonly _documents;
56
- /**
57
- * Fires debounced event `selectionChangeDone`. It uses `lodash#debounce` method to delay function call.
58
- */
59
- private readonly _fireSelectionChangeDoneDebounced;
60
- /**
61
- * When called, starts clearing the {@link #_loopbackCounter} counter in time intervals. When the number of selection
62
- * changes exceeds a certain limit within the interval of time, the observer will not fire `selectionChange` but warn about
63
- * possible infinite selection loop.
64
- */
65
- private readonly _clearInfiniteLoopInterval;
66
- /**
67
- * Unlocks the `isSelecting` state of the view document in case the selection observer did not record this fact
68
- * correctly (for whatever reason). It is a safeguard (paranoid check), that returns document to the normal state
69
- * after a certain period of time (debounced, postponed by each selectionchange event).
70
- */
71
- private readonly _documentIsSelectingInactivityTimeoutDebounced;
72
- /**
73
- * Private property to check if the code does not enter infinite loop.
74
- */
75
- private _loopbackCounter;
76
- constructor(view: View);
77
- /**
78
- * @inheritDoc
79
- */
80
- observe(domElement: HTMLElement): void;
81
- /**
82
- * @inheritDoc
83
- */
84
- stopObserving(domElement: HTMLElement): void;
85
- /**
86
- * @inheritDoc
87
- */
88
- destroy(): void;
89
- private _reportInfiniteLoop;
90
- /**
91
- * Selection change listener. {@link module:engine/view/observer/mutationobserver~MutationObserver#flush Flush} mutations, check if
92
- * a selection changes and fires {@link module:engine/view/document~Document#event:selectionChange} event on every change
93
- * and {@link module:engine/view/document~Document#event:selectionChangeDone} when a selection stop changing.
94
- *
95
- * @param domEvent DOM event.
96
- * @param domDocument DOM document.
97
- */
98
- private _handleSelectionChange;
99
- /**
100
- * Clears `SelectionObserver` internal properties connected with preventing infinite loop.
101
- */
102
- private _clearInfiniteLoop;
103
- }
104
- /**
105
- * The value of {@link ~ViewDocumentSelectionChangeEvent} and {@link ~ViewDocumentSelectionChangeDoneEvent} events.
106
- */
107
- export type ViewDocumentSelectionEventData = {
108
- /**
109
- * Old View selection which is {@link module:engine/view/document~Document#selection}.
110
- */
111
- oldSelection: DocumentSelection;
112
- /**
113
- * New View selection which is converted DOM selection.
114
- */
115
- newSelection: Selection;
116
- /**
117
- * Native DOM selection.
118
- */
119
- domSelection: DomSelection | null;
120
- };
121
- /**
122
- * Fired when a selection has changed. This event is fired only when the selection change was the only change that happened
123
- * in the document, and the old selection is different then the new selection.
124
- *
125
- * Introduced by {@link module:engine/view/observer/selectionobserver~SelectionObserver}.
126
- *
127
- * Note that because {@link module:engine/view/observer/selectionobserver~SelectionObserver} is attached by the
128
- * {@link module:engine/view/view~View} this event is available by default.
129
- *
130
- * @see module:engine/view/observer/selectionobserver~SelectionObserver
131
- * @eventName module:engine/view/document~Document#selectionChange
132
- */
133
- export type ViewDocumentSelectionChangeEvent = {
134
- name: 'selectionChange';
135
- args: [ViewDocumentSelectionEventData];
136
- };
137
- /**
138
- * Fired when selection stops changing.
139
- *
140
- * Introduced by {@link module:engine/view/observer/selectionobserver~SelectionObserver}.
141
- *
142
- * Note that because {@link module:engine/view/observer/selectionobserver~SelectionObserver} is attached by the
143
- * {@link module:engine/view/view~View} this event is available by default.
144
- *
145
- * @see module:engine/view/observer/selectionobserver~SelectionObserver
146
- * @eventName module:engine/view/document~Document#selectionChangeDone
147
- */
148
- export type ViewDocumentSelectionChangeDoneEvent = {
149
- name: 'selectionChangeDone';
150
- args: [ViewDocumentSelectionEventData];
151
- };
152
- export {};
@@ -1,50 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module engine/view/observer/tabobserver
11
- */
12
- import type View from '../view.js';
13
- import Observer from './observer.js';
14
- import type { KeyEventData } from './keyobserver.js';
15
- import type { BubblingEvent } from './bubblingemittermixin.js';
16
- /**
17
- * Tab observer introduces the {@link module:engine/view/document~Document#event:tab `Document#tab`} event.
18
- *
19
- * Note that because {@link module:engine/view/observer/tabobserver~TabObserver} is attached by the
20
- * {@link module:engine/view/view~View}, this event is available by default.
21
- */
22
- export default class TabObserver extends Observer {
23
- /**
24
- * @inheritDoc
25
- */
26
- constructor(view: View);
27
- /**
28
- * @inheritDoc
29
- */
30
- observe(): void;
31
- /**
32
- * @inheritDoc
33
- */
34
- stopObserving(): void;
35
- }
36
- /**
37
- * Event fired when the user presses a tab key.
38
- *
39
- * Introduced by {@link module:engine/view/observer/tabobserver~TabObserver}.
40
- *
41
- * Note that because {@link module:engine/view/observer/tabobserver~TabObserver} is attached by the
42
- * {@link module:engine/view/view~View}, this event is available by default.
43
- *
44
- * @eventName module:engine/view/document~Document#tab
45
- * @param data
46
- */
47
- export type ViewDocumentTabEvent = BubblingEvent<{
48
- name: 'tab';
49
- args: [data: KeyEventData];
50
- }>;
@@ -1,100 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module engine/view/placeholder
11
- */
12
- import '../../theme/placeholder.css';
13
- import type DowncastWriter from './downcastwriter.js';
14
- import type EditableElement from './editableelement.js';
15
- import type Element from './element.js';
16
- import type View from './view.js';
17
- /**
18
- * A helper that enables a placeholder on the provided view element (also updates its visibility).
19
- * The placeholder is a CSS pseudo–element (with a text content) attached to the element.
20
- *
21
- * To change the placeholder text, change value of the `placeholder` property in the provided `element`.
22
- *
23
- * To disable the placeholder, use {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} helper.
24
- *
25
- * @param options Configuration options of the placeholder.
26
- * @param options.view Editing view instance.
27
- * @param options.element Element that will gain a placeholder. See `options.isDirectHost` to learn more.
28
- * @param options.isDirectHost If set `false`, the placeholder will not be enabled directly
29
- * in the passed `element` but in one of its children (selected automatically, i.e. a first empty child element).
30
- * Useful when attaching placeholders to elements that can host other elements (not just text), for instance,
31
- * editable root elements.
32
- * @param options.text Placeholder text. It's **deprecated** and will be removed soon. Use
33
- * {@link module:engine/view/placeholder~PlaceholderableElement#placeholder `options.element.placeholder`} instead.
34
- * @param options.keepOnFocus If set `true`, the placeholder stay visible when the host element is focused.
35
- */
36
- export declare function enablePlaceholder({ view, element, text, isDirectHost, keepOnFocus }: {
37
- view: View;
38
- element: PlaceholderableElement | EditableElement;
39
- isDirectHost?: boolean;
40
- text?: string;
41
- keepOnFocus?: boolean;
42
- }): void;
43
- /**
44
- * Disables the placeholder functionality from a given element.
45
- *
46
- * See {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} to learn more.
47
- */
48
- export declare function disablePlaceholder(view: View, element: Element): void;
49
- /**
50
- * Shows a placeholder in the provided element by changing related attributes and CSS classes.
51
- *
52
- * **Note**: This helper will not update the placeholder visibility nor manage the
53
- * it in any way in the future. What it does is a one–time state change of an element. Use
54
- * {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} and
55
- * {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} for full
56
- * placeholder functionality.
57
- *
58
- * **Note**: This helper will blindly show the placeholder directly in the root editable element if
59
- * one is passed, which could result in a visual clash if the editable element has some children
60
- * (for instance, an empty paragraph). Use {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`}
61
- * in that case or make sure the correct element is passed to the helper.
62
- *
63
- * @returns `true`, if any changes were made to the `element`.
64
- */
65
- export declare function showPlaceholder(writer: DowncastWriter, element: Element): boolean;
66
- /**
67
- * Hides a placeholder in the element by changing related attributes and CSS classes.
68
- *
69
- * **Note**: This helper will not update the placeholder visibility nor manage the
70
- * it in any way in the future. What it does is a one–time state change of an element. Use
71
- * {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} and
72
- * {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} for full
73
- * placeholder functionality.
74
- *
75
- * @returns `true`, if any changes were made to the `element`.
76
- */
77
- export declare function hidePlaceholder(writer: DowncastWriter, element: Element): boolean;
78
- /**
79
- * Checks if a placeholder should be displayed in the element.
80
- *
81
- * **Note**: This helper will blindly check the possibility of showing a placeholder directly in the
82
- * root editable element if one is passed, which may not be the expected result. If an element can
83
- * host other elements (not just text), most likely one of its children should be checked instead
84
- * because it will be the final host for the placeholder. Use
85
- * {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`} in that case or make
86
- * sure the correct element is passed to the helper.
87
- *
88
- * @param element Element that holds the placeholder.
89
- * @param keepOnFocus Focusing the element will keep the placeholder visible.
90
- */
91
- export declare function needsPlaceholder(element: Element, keepOnFocus: boolean): boolean;
92
- /**
93
- * Element that could have a placeholder.
94
- */
95
- export interface PlaceholderableElement extends Element {
96
- /**
97
- * The text of element's placeholder.
98
- */
99
- placeholder?: string;
100
- }
@@ -1,192 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
- */
9
- /**
10
- * @module engine/view/position
11
- */
12
- import TypeCheckable from './typecheckable.js';
13
- import EditableElement from './editableelement.js';
14
- import type DocumentFragment from './documentfragment.js';
15
- import type Item from './item.js';
16
- import type Node from './node.js';
17
- import { default as TreeWalker, type TreeWalkerValue, type TreeWalkerOptions } from './treewalker.js';
18
- /**
19
- * Position in the view tree. Position is represented by its parent node and an offset in this parent.
20
- *
21
- * In order to create a new position instance use the `createPosition*()` factory methods available in:
22
- *
23
- * * {@link module:engine/view/view~View}
24
- * * {@link module:engine/view/downcastwriter~DowncastWriter}
25
- * * {@link module:engine/view/upcastwriter~UpcastWriter}
26
- */
27
- export default class Position extends TypeCheckable {
28
- /**
29
- * Position parent.
30
- */
31
- readonly parent: Node | DocumentFragment;
32
- /**
33
- * Position offset.
34
- */
35
- offset: number;
36
- /**
37
- * Creates a position.
38
- *
39
- * @param parent Position parent.
40
- * @param offset Position offset.
41
- */
42
- constructor(parent: Node | DocumentFragment, offset: number);
43
- /**
44
- * Node directly after the position. Equals `null` when there is no node after position or position is located
45
- * inside text node.
46
- */
47
- get nodeAfter(): Node | null;
48
- /**
49
- * Node directly before the position. Equals `null` when there is no node before position or position is located
50
- * inside text node.
51
- */
52
- get nodeBefore(): Node | null;
53
- /**
54
- * Is `true` if position is at the beginning of its {@link module:engine/view/position~Position#parent parent}, `false` otherwise.
55
- */
56
- get isAtStart(): boolean;
57
- /**
58
- * Is `true` if position is at the end of its {@link module:engine/view/position~Position#parent parent}, `false` otherwise.
59
- */
60
- get isAtEnd(): boolean;
61
- /**
62
- * Position's root, that is the root of the position's parent element.
63
- */
64
- get root(): Node | DocumentFragment;
65
- /**
66
- * {@link module:engine/view/editableelement~EditableElement EditableElement} instance that contains this position, or `null` if
67
- * position is not inside an editable element.
68
- */
69
- get editableElement(): EditableElement | null;
70
- /**
71
- * Returns a new instance of Position with offset incremented by `shift` value.
72
- *
73
- * @param shift How position offset should get changed. Accepts negative values.
74
- * @returns Shifted position.
75
- */
76
- getShiftedBy(shift: number): Position;
77
- /**
78
- * Gets the farthest position which matches the callback using
79
- * {@link module:engine/view/treewalker~TreeWalker TreeWalker}.
80
- *
81
- * For example:
82
- *
83
- * ```ts
84
- * getLastMatchingPosition( value => value.type == 'text' ); // <p>{}foo</p> -> <p>foo[]</p>
85
- * getLastMatchingPosition( value => value.type == 'text', { direction: 'backward' } ); // <p>foo[]</p> -> <p>{}foo</p>
86
- * getLastMatchingPosition( value => false ); // Do not move the position.
87
- * ```
88
- *
89
- * @param skip Callback function. Gets {@link module:engine/view/treewalker~TreeWalkerValue} and should
90
- * return `true` if the value should be skipped or `false` if not.
91
- * @param options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}.
92
- * @returns The position after the last item which matches the `skip` callback test.
93
- */
94
- getLastMatchingPosition(skip: (value: TreeWalkerValue) => boolean, options?: TreeWalkerOptions): Position;
95
- /**
96
- * Returns ancestors array of this position, that is this position's parent and it's ancestors.
97
- *
98
- * @returns Array with ancestors.
99
- */
100
- getAncestors(): Array<Node | DocumentFragment>;
101
- /**
102
- * Returns a {@link module:engine/view/node~Node} or {@link module:engine/view/documentfragment~DocumentFragment}
103
- * which is a common ancestor of both positions.
104
- */
105
- getCommonAncestor(position: Position): Node | DocumentFragment | null;
106
- /**
107
- * Checks whether this position equals given position.
108
- *
109
- * @param otherPosition Position to compare with.
110
- * @returns True if positions are same.
111
- */
112
- isEqual(otherPosition: Position): boolean;
113
- /**
114
- * Checks whether this position is located before given position. When method returns `false` it does not mean that
115
- * this position is after give one. Two positions may be located inside separate roots and in that situation this
116
- * method will still return `false`.
117
- *
118
- * @see module:engine/view/position~Position#isAfter
119
- * @see module:engine/view/position~Position#compareWith
120
- * @param otherPosition Position to compare with.
121
- * @returns Returns `true` if this position is before given position.
122
- */
123
- isBefore(otherPosition: Position): boolean;
124
- /**
125
- * Checks whether this position is located after given position. When method returns `false` it does not mean that
126
- * this position is before give one. Two positions may be located inside separate roots and in that situation this
127
- * method will still return `false`.
128
- *
129
- * @see module:engine/view/position~Position#isBefore
130
- * @see module:engine/view/position~Position#compareWith
131
- * @param otherPosition Position to compare with.
132
- * @returns Returns `true` if this position is after given position.
133
- */
134
- isAfter(otherPosition: Position): boolean;
135
- /**
136
- * Checks whether this position is before, after or in same position that other position. Two positions may be also
137
- * different when they are located in separate roots.
138
- *
139
- * @param otherPosition Position to compare with.
140
- */
141
- compareWith(otherPosition: Position): PositionRelation;
142
- /**
143
- * Creates a {@link module:engine/view/treewalker~TreeWalker TreeWalker} instance with this positions as a start position.
144
- *
145
- * @param options Object with configuration options. See {@link module:engine/view/treewalker~TreeWalker}
146
- */
147
- getWalker(options?: TreeWalkerOptions): TreeWalker;
148
- /**
149
- * Clones this position.
150
- */
151
- clone(): Position;
152
- /**
153
- * Creates position at the given location. The location can be specified as:
154
- *
155
- * * a {@link module:engine/view/position~Position position},
156
- * * parent element and offset (offset defaults to `0`),
157
- * * parent element and `'end'` (sets position at the end of that element),
158
- * * {@link module:engine/view/item~Item view item} and `'before'` or `'after'` (sets position before or after given view item).
159
- *
160
- * This method is a shortcut to other constructors such as:
161
- *
162
- * * {@link module:engine/view/position~Position._createBefore},
163
- * * {@link module:engine/view/position~Position._createAfter}.
164
- *
165
- * @internal
166
- * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~Item view item}.
167
- */
168
- static _createAt(itemOrPosition: Item | Position, offset?: PositionOffset): Position;
169
- /**
170
- * Creates a new position after given view item.
171
- *
172
- * @internal
173
- * @param item View item after which the position should be located.
174
- */
175
- static _createAfter(item: Item): Position;
176
- /**
177
- * Creates a new position before given view item.
178
- *
179
- * @internal
180
- * @param item View item before which the position should be located.
181
- */
182
- static _createBefore(item: Item): Position;
183
- }
184
- /**
185
- * A flag indicating whether this position is `'before'` or `'after'` or `'same'` as given position.
186
- * If positions are in different roots `'different'` flag is returned.
187
- */
188
- export type PositionRelation = 'before' | 'after' | 'same' | 'different';
189
- /**
190
- * Offset or one of the flags.
191
- */
192
- export type PositionOffset = number | 'before' | 'after' | 'end';