@ckeditor/ckeditor5-engine 45.2.1 → 46.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2563 -2257
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/controller/datacontroller.d.ts +33 -32
- package/src/controller/datacontroller.js +29 -28
- package/src/controller/editingcontroller.d.ts +8 -8
- package/src/controller/editingcontroller.js +10 -10
- package/src/conversion/conversion.d.ts +18 -19
- package/src/conversion/conversion.js +4 -4
- package/src/conversion/conversionhelpers.d.ts +1 -1
- package/src/conversion/conversionhelpers.js +1 -1
- package/src/conversion/downcastdispatcher.d.ts +63 -69
- package/src/conversion/downcastdispatcher.js +16 -16
- package/src/conversion/downcasthelpers.d.ts +94 -83
- package/src/conversion/downcasthelpers.js +63 -53
- package/src/conversion/mapper.d.ts +27 -27
- package/src/conversion/mapper.js +15 -15
- package/src/conversion/modelconsumable.d.ts +26 -26
- package/src/conversion/modelconsumable.js +23 -23
- package/src/conversion/upcastdispatcher.d.ts +33 -32
- package/src/conversion/upcastdispatcher.js +19 -19
- package/src/conversion/upcasthelpers.d.ts +46 -38
- package/src/conversion/upcasthelpers.js +33 -24
- package/src/conversion/viewconsumable.d.ts +50 -45
- package/src/conversion/viewconsumable.js +32 -27
- package/src/dataprocessor/basichtmlwriter.d.ts +4 -2
- package/src/dataprocessor/basichtmlwriter.js +3 -1
- package/src/dataprocessor/dataprocessor.d.ts +7 -6
- package/src/dataprocessor/htmldataprocessor.d.ts +10 -10
- package/src/dataprocessor/htmldataprocessor.js +6 -6
- package/src/dataprocessor/htmlwriter.d.ts +1 -1
- package/src/dataprocessor/xmldataprocessor.d.ts +10 -10
- package/src/dataprocessor/xmldataprocessor.js +6 -6
- package/src/dev-utils/model.d.ts +25 -26
- package/src/dev-utils/model.js +35 -36
- package/src/dev-utils/operationreplayer.d.ts +5 -3
- package/src/dev-utils/operationreplayer.js +4 -2
- package/src/dev-utils/utils.d.ts +8 -0
- package/src/dev-utils/utils.js +8 -0
- package/src/dev-utils/view.d.ts +66 -63
- package/src/dev-utils/view.js +144 -134
- package/src/index.d.ts +135 -106
- package/src/index.js +120 -71
- package/src/legacyerrors.d.ts +5 -0
- package/src/legacyerrors.js +17 -0
- package/src/model/batch.d.ts +2 -15
- package/src/model/batch.js +1 -23
- package/src/model/differ.d.ts +54 -31
- package/src/model/differ.js +15 -15
- package/src/model/document.d.ts +31 -31
- package/src/model/document.js +13 -13
- package/src/model/documentfragment.d.ts +45 -45
- package/src/model/documentfragment.js +40 -40
- package/src/model/documentselection.d.ts +92 -92
- package/src/model/documentselection.js +71 -70
- package/src/model/element.d.ts +31 -31
- package/src/model/element.js +29 -29
- package/src/model/history.d.ts +3 -3
- package/src/model/history.js +2 -2
- package/src/model/item.d.ts +4 -5
- package/src/model/liveposition.d.ts +31 -31
- package/src/model/liveposition.js +18 -18
- package/src/model/liverange.d.ts +42 -38
- package/src/model/liverange.js +17 -16
- package/src/model/markercollection.d.ts +41 -40
- package/src/model/markercollection.js +22 -20
- package/src/model/model.d.ts +82 -81
- package/src/model/model.js +54 -54
- package/src/model/node.d.ts +48 -48
- package/src/model/node.js +31 -31
- package/src/model/nodelist.d.ts +17 -17
- package/src/model/nodelist.js +11 -11
- package/src/model/operation/attributeoperation.d.ts +10 -10
- package/src/model/operation/attributeoperation.js +7 -7
- package/src/model/operation/detachoperation.d.ts +11 -9
- package/src/model/operation/detachoperation.js +8 -6
- package/src/model/operation/insertoperation.d.ts +13 -13
- package/src/model/operation/insertoperation.js +15 -15
- package/src/model/operation/markeroperation.d.ts +12 -12
- package/src/model/operation/markeroperation.js +5 -5
- package/src/model/operation/mergeoperation.d.ts +16 -16
- package/src/model/operation/mergeoperation.js +18 -18
- package/src/model/operation/moveoperation.d.ts +16 -16
- package/src/model/operation/moveoperation.js +18 -15
- package/src/model/operation/nooperation.d.ts +4 -4
- package/src/model/operation/nooperation.js +2 -2
- package/src/model/operation/operation.d.ts +10 -10
- package/src/model/operation/operation.js +5 -5
- package/src/model/operation/operationfactory.d.ts +4 -4
- package/src/model/operation/operationfactory.js +12 -12
- package/src/model/operation/renameoperation.d.ts +10 -10
- package/src/model/operation/renameoperation.js +7 -7
- package/src/model/operation/rootattributeoperation.d.ts +12 -12
- package/src/model/operation/rootattributeoperation.js +8 -8
- package/src/model/operation/rootoperation.d.ts +8 -8
- package/src/model/operation/rootoperation.js +3 -3
- package/src/model/operation/splitoperation.d.ts +17 -17
- package/src/model/operation/splitoperation.js +19 -19
- package/src/model/operation/transform.d.ts +11 -8
- package/src/model/operation/transform.js +66 -49
- package/src/model/operation/utils.d.ts +24 -23
- package/src/model/operation/utils.js +20 -20
- package/src/model/position.d.ts +101 -97
- package/src/model/position.js +69 -64
- package/src/model/range.d.ts +90 -90
- package/src/model/range.js +87 -87
- package/src/model/rootelement.d.ts +11 -11
- package/src/model/rootelement.js +9 -9
- package/src/model/schema.d.ts +158 -154
- package/src/model/schema.js +93 -90
- package/src/model/selection.d.ts +73 -73
- package/src/model/selection.js +62 -62
- package/src/model/text.d.ts +11 -10
- package/src/model/text.js +11 -10
- package/src/model/textproxy.d.ts +39 -38
- package/src/model/textproxy.js +31 -30
- package/src/model/treewalker.d.ts +37 -37
- package/src/model/treewalker.js +14 -14
- package/src/model/typecheckable.d.ts +45 -45
- package/src/model/typecheckable.js +1 -1
- package/src/model/utils/autoparagraphing.d.ts +7 -7
- package/src/model/utils/deletecontent.d.ts +7 -5
- package/src/model/utils/deletecontent.js +13 -11
- package/src/model/utils/getselectedcontent.d.ts +6 -5
- package/src/model/utils/getselectedcontent.js +2 -1
- package/src/model/utils/insertcontent.d.ts +9 -8
- package/src/model/utils/insertcontent.js +41 -40
- package/src/model/utils/insertobject.d.ts +9 -9
- package/src/model/utils/insertobject.js +4 -4
- package/src/model/utils/modifyselection.d.ts +5 -4
- package/src/model/utils/modifyselection.js +12 -11
- package/src/model/utils/selection-post-fixer.d.ts +12 -8
- package/src/model/utils/selection-post-fixer.js +15 -11
- package/src/model/writer.d.ts +102 -101
- package/src/model/writer.js +99 -98
- package/src/view/attributeelement.d.ts +29 -29
- package/src/view/attributeelement.js +25 -25
- package/src/view/containerelement.d.ts +16 -15
- package/src/view/containerelement.js +15 -14
- package/src/view/datatransfer.d.ts +7 -7
- package/src/view/datatransfer.js +1 -1
- package/src/view/document.d.ts +25 -25
- package/src/view/document.js +15 -15
- package/src/view/documentfragment.d.ts +21 -21
- package/src/view/documentfragment.js +14 -14
- package/src/view/documentselection.d.ts +65 -63
- package/src/view/documentselection.js +27 -25
- package/src/view/domconverter.d.ts +94 -89
- package/src/view/domconverter.js +78 -73
- package/src/view/downcastwriter.d.ts +185 -181
- package/src/view/downcastwriter.js +222 -210
- package/src/view/editableelement.d.ts +13 -13
- package/src/view/editableelement.js +8 -8
- package/src/view/element.d.ts +75 -74
- package/src/view/element.js +58 -58
- package/src/view/elementdefinition.d.ts +3 -4
- package/src/view/emptyelement.d.ts +13 -13
- package/src/view/emptyelement.js +13 -13
- package/src/view/filler.d.ts +14 -3
- package/src/view/filler.js +12 -1
- package/src/view/item.d.ts +4 -5
- package/src/view/matcher.d.ts +22 -19
- package/src/view/matcher.js +6 -6
- package/src/view/node.d.ts +33 -33
- package/src/view/node.js +9 -9
- package/src/view/observer/arrowkeysobserver.d.ts +10 -10
- package/src/view/observer/arrowkeysobserver.js +5 -5
- package/src/view/observer/bubblingemittermixin.d.ts +5 -5
- package/src/view/observer/bubblingemittermixin.js +2 -9
- package/src/view/observer/bubblingeventinfo.d.ts +9 -9
- package/src/view/observer/bubblingeventinfo.js +1 -1
- package/src/view/observer/clickobserver.d.ts +8 -8
- package/src/view/observer/clickobserver.js +4 -4
- package/src/view/observer/compositionobserver.d.ts +19 -19
- package/src/view/observer/compositionobserver.js +6 -6
- package/src/view/observer/domeventdata.d.ts +9 -9
- package/src/view/observer/domeventdata.js +2 -2
- package/src/view/observer/domeventobserver.d.ts +3 -3
- package/src/view/observer/domeventobserver.js +5 -5
- package/src/view/observer/fakeselectionobserver.d.ts +9 -9
- package/src/view/observer/fakeselectionobserver.js +8 -8
- package/src/view/observer/focusobserver.d.ts +16 -16
- package/src/view/observer/focusobserver.js +7 -7
- package/src/view/observer/inputobserver.d.ts +18 -18
- package/src/view/observer/inputobserver.js +5 -5
- package/src/view/observer/keyobserver.d.ts +11 -11
- package/src/view/observer/keyobserver.js +3 -3
- package/src/view/observer/mouseobserver.d.ts +16 -16
- package/src/view/observer/mouseobserver.js +3 -3
- package/src/view/observer/mutationobserver.d.ts +21 -21
- package/src/view/observer/mutationobserver.js +7 -7
- package/src/view/observer/observer.d.ts +12 -12
- package/src/view/observer/observer.js +6 -6
- package/src/view/observer/selectionobserver.d.ts +33 -33
- package/src/view/observer/selectionobserver.js +14 -14
- package/src/view/observer/tabobserver.d.ts +10 -10
- package/src/view/observer/tabobserver.js +5 -5
- package/src/view/observer/touchobserver.d.ts +13 -13
- package/src/view/observer/touchobserver.js +3 -3
- package/src/view/placeholder.d.ts +21 -21
- package/src/view/placeholder.js +23 -23
- package/src/view/position.d.ts +49 -49
- package/src/view/position.js +42 -42
- package/src/view/range.d.ts +76 -74
- package/src/view/range.js +67 -65
- package/src/view/rawelement.d.ts +19 -19
- package/src/view/rawelement.js +16 -16
- package/src/view/renderer.d.ts +14 -14
- package/src/view/renderer.js +7 -7
- package/src/view/rooteditableelement.d.ts +8 -7
- package/src/view/rooteditableelement.js +7 -6
- package/src/view/selection.d.ts +66 -64
- package/src/view/selection.js +50 -48
- package/src/view/styles/background.d.ts +2 -2
- package/src/view/styles/background.js +9 -9
- package/src/view/styles/border.d.ts +2 -2
- package/src/view/styles/border.js +13 -13
- package/src/view/styles/margin.d.ts +2 -2
- package/src/view/styles/margin.js +5 -5
- package/src/view/styles/padding.d.ts +2 -2
- package/src/view/styles/padding.js +5 -5
- package/src/view/styles/utils.d.ts +24 -24
- package/src/view/styles/utils.js +25 -25
- package/src/view/stylesmap.d.ts +28 -32
- package/src/view/stylesmap.js +52 -39
- package/src/view/text.d.ts +11 -11
- package/src/view/text.js +10 -10
- package/src/view/textproxy.d.ts +33 -32
- package/src/view/textproxy.js +23 -22
- package/src/view/tokenlist.d.ts +14 -14
- package/src/view/tokenlist.js +10 -10
- package/src/view/treewalker.d.ts +42 -40
- package/src/view/treewalker.js +36 -35
- package/src/view/typecheckable.d.ts +76 -75
- package/src/view/typecheckable.js +1 -1
- package/src/view/uielement.d.ts +22 -21
- package/src/view/uielement.js +17 -16
- package/src/view/upcastwriter.d.ts +70 -70
- package/src/view/upcastwriter.js +42 -42
- package/src/view/view.d.ts +70 -69
- 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~
|
|
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~
|
|
12
|
+
* {@link module:engine/view/view~EditingView}, this event is available by default.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
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
|
|
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~
|
|
14
|
+
* {@link module:engine/view/view~EditingView} by {@link module:engine/view/view~EditingView#addObserver} method.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
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~
|
|
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~
|
|
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:
|
|
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~
|
|
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~
|
|
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:
|
|
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~
|
|
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~
|
|
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:
|
|
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~
|
|
13
|
+
* {@link module:engine/view/view~EditingView} by {@link module:engine/view/view~EditingView#addObserver} method.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
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
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
12
|
-
import type
|
|
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~
|
|
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~
|
|
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
|
|
33
|
-
view:
|
|
34
|
-
element:
|
|
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~
|
|
42
|
+
* See {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} to learn more.
|
|
43
43
|
*/
|
|
44
|
-
export declare function
|
|
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~
|
|
51
|
-
* {@link module:engine/view/placeholder~
|
|
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~
|
|
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
|
|
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~
|
|
68
|
-
* {@link module:engine/view/placeholder~
|
|
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
|
|
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~
|
|
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
|
|
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
|
|
91
|
+
export interface PlaceholderableViewElement extends ViewElement {
|
|
92
92
|
/**
|
|
93
93
|
* The text of element's placeholder.
|
|
94
94
|
*/
|
package/src/view/placeholder.js
CHANGED
|
@@ -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~
|
|
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~
|
|
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
|
|
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
|
-
|
|
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~
|
|
73
|
+
* See {@link module:engine/view/placeholder~enableViewPlaceholder `enableViewPlaceholder()`} to learn more.
|
|
74
74
|
*/
|
|
75
|
-
export function
|
|
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
|
-
|
|
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~
|
|
94
|
-
* {@link module:engine/view/placeholder~
|
|
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~
|
|
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
|
|
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~
|
|
117
|
-
* {@link module:engine/view/placeholder~
|
|
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
|
|
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~
|
|
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
|
|
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 &&
|
|
233
|
-
if (
|
|
232
|
+
if (isOnlyChild && needsViewPlaceholder(hostElement, config.keepOnFocus)) {
|
|
233
|
+
if (showViewPlaceholder(writer, hostElement)) {
|
|
234
234
|
wasViewModified = true;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
else if (
|
|
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
|
|
259
|
+
function showViewPlaceholderTextDeprecationWarning() {
|
|
260
260
|
if (!hasDisplayedPlaceholderDeprecationWarning) {
|
|
261
261
|
/**
|
|
262
|
-
* The "text" option in the {@link module:engine/view/placeholder~
|
|
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
|
|
268
|
+
* @error enableViewPlaceholder-deprecated-text-option
|
|
269
269
|
*/
|
|
270
|
-
logWarning('
|
|
270
|
+
logWarning('enableViewPlaceholder-deprecated-text-option');
|
|
271
271
|
}
|
|
272
272
|
hasDisplayedPlaceholderDeprecationWarning = true;
|
|
273
273
|
}
|
package/src/view/position.d.ts
CHANGED
|
@@ -5,26 +5,26 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/position
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
12
|
-
import type
|
|
13
|
-
import {
|
|
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~
|
|
20
|
-
* * {@link module:engine/view/downcastwriter~
|
|
21
|
-
* * {@link module:engine/view/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
|
|
23
|
+
export declare class ViewPosition extends ViewTypeCheckable {
|
|
24
24
|
/**
|
|
25
25
|
* Position parent.
|
|
26
26
|
*/
|
|
27
|
-
readonly parent:
|
|
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:
|
|
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():
|
|
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():
|
|
48
|
+
get nodeBefore(): ViewNode | null;
|
|
49
49
|
/**
|
|
50
|
-
* Is `true` if position is at the beginning of its {@link module:engine/view/position~
|
|
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~
|
|
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():
|
|
60
|
+
get root(): ViewNode | ViewDocumentFragment;
|
|
61
61
|
/**
|
|
62
|
-
* {@link module:engine/view/editableelement~
|
|
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():
|
|
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):
|
|
72
|
+
getShiftedBy(shift: number): ViewPosition;
|
|
73
73
|
/**
|
|
74
74
|
* Gets the farthest position which matches the callback using
|
|
75
|
-
* {@link module:engine/view/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~
|
|
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~
|
|
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:
|
|
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<
|
|
96
|
+
getAncestors(): Array<ViewNode | ViewDocumentFragment>;
|
|
97
97
|
/**
|
|
98
|
-
* Returns a {@link module:engine/view/node~
|
|
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:
|
|
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:
|
|
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~
|
|
115
|
-
* @see module:engine/view/position~
|
|
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:
|
|
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~
|
|
126
|
-
* @see module:engine/view/position~
|
|
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:
|
|
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:
|
|
137
|
+
compareWith(otherPosition: ViewPosition): ViewPositionRelation;
|
|
138
138
|
/**
|
|
139
|
-
* Creates a {@link module:engine/view/treewalker~
|
|
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~
|
|
141
|
+
* @param options Object with configuration options. See {@link module:engine/view/treewalker~ViewTreeWalker}
|
|
142
142
|
*/
|
|
143
|
-
getWalker(options?:
|
|
143
|
+
getWalker(options?: ViewTreeWalkerOptions): ViewTreeWalker;
|
|
144
144
|
/**
|
|
145
145
|
* Clones this position.
|
|
146
146
|
*/
|
|
147
|
-
clone():
|
|
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~
|
|
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~
|
|
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~
|
|
159
|
-
* * {@link module:engine/view/position~
|
|
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~
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
184
|
+
export type ViewPositionRelation = 'before' | 'after' | 'same' | 'different';
|
|
185
185
|
/**
|
|
186
186
|
* Offset or one of the flags.
|
|
187
187
|
*/
|
|
188
|
-
export type
|
|
188
|
+
export type ViewPositionOffset = number | 'before' | 'after' | 'end';
|