@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
package/src/view/uielement.d.ts
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/uielement
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
12
|
-
import type
|
|
13
|
-
import type
|
|
8
|
+
import { ViewElement, type ViewElementAttributes } from './element.js';
|
|
9
|
+
import { ViewNode } from './node.js';
|
|
10
|
+
import { type EditingView } from './view.js';
|
|
11
|
+
import { type ViewDocument } from './document.js';
|
|
12
|
+
import { type ViewDomConverter } from './domconverter.js';
|
|
13
|
+
import { type ViewItem } from './item.js';
|
|
14
14
|
type DomDocument = globalThis.Document;
|
|
15
15
|
type DomElement = globalThis.HTMLElement;
|
|
16
16
|
/**
|
|
@@ -19,44 +19,44 @@ type DomElement = globalThis.HTMLElement;
|
|
|
19
19
|
* UI elements can be used.
|
|
20
20
|
*
|
|
21
21
|
* How a UI element is rendered is in your control (you pass a callback to
|
|
22
|
-
* {@link module:engine/view/downcastwriter~
|
|
22
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `downcastWriter#createUIElement()`}).
|
|
23
23
|
* The editor will ignore your UI element – the selection cannot be placed in it, it is skipped (invisible) when
|
|
24
24
|
* the user modifies the selection by using arrow keys and the editor does not listen to any mutations which
|
|
25
25
|
* happen inside your UI elements.
|
|
26
26
|
*
|
|
27
27
|
* The limitation is that you cannot convert a model element to a UI element. UI elements need to be
|
|
28
28
|
* created for {@link module:engine/model/markercollection~Marker markers} or as additinal elements
|
|
29
|
-
* inside normal {@link module:engine/view/containerelement~
|
|
29
|
+
* inside normal {@link module:engine/view/containerelement~ViewContainerElement container elements}.
|
|
30
30
|
*
|
|
31
31
|
* To create a new UI element use the
|
|
32
|
-
* {@link module:engine/view/downcastwriter~
|
|
32
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `downcastWriter#createUIElement()`} method.
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
34
|
+
export declare class ViewUIElement extends ViewElement {
|
|
35
35
|
/**
|
|
36
36
|
* Creates new instance of UIElement.
|
|
37
37
|
*
|
|
38
38
|
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` when third parameter is passed,
|
|
39
39
|
* to inform that usage of UIElement is incorrect (adding child nodes to UIElement is forbidden).
|
|
40
40
|
*
|
|
41
|
-
* @see module:engine/view/downcastwriter~
|
|
41
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement
|
|
42
42
|
* @internal
|
|
43
43
|
* @param document The document instance to which this element belongs.
|
|
44
44
|
* @param name Node name.
|
|
45
45
|
* @param attrs Collection of attributes.
|
|
46
46
|
* @param children A list of nodes to be inserted into created element.
|
|
47
47
|
*/
|
|
48
|
-
constructor(document:
|
|
48
|
+
constructor(document: ViewDocument, name: string, attrs?: ViewElementAttributes, children?: ViewNode | Iterable<ViewNode>);
|
|
49
49
|
/**
|
|
50
|
-
* Overrides {@link module:engine/view/element~
|
|
50
|
+
* Overrides {@link module:engine/view/element~ViewElement#_insertChild} method.
|
|
51
51
|
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` to prevent adding any child nodes
|
|
52
52
|
* to UIElement.
|
|
53
53
|
*
|
|
54
54
|
* @internal
|
|
55
55
|
*/
|
|
56
|
-
_insertChild(index: number, items:
|
|
56
|
+
_insertChild(index: number, items: ViewItem | Iterable<ViewItem>): number;
|
|
57
57
|
/**
|
|
58
|
-
* Renders this {@link module:engine/view/uielement~
|
|
59
|
-
* {@link module:engine/view/domconverter~
|
|
58
|
+
* Renders this {@link module:engine/view/uielement~ViewUIElement} to DOM. This method is called by
|
|
59
|
+
* {@link module:engine/view/domconverter~ViewDomConverter}.
|
|
60
60
|
* Do not use inheritance to create custom rendering method, replace `render()` method instead:
|
|
61
61
|
*
|
|
62
62
|
* ```ts
|
|
@@ -74,9 +74,9 @@ export default class UIElement extends Element {
|
|
|
74
74
|
* the {@link module:ui/editorui/editorui~EditorUI#update `editor.ui.update()`} method
|
|
75
75
|
* after rendering your UI element.
|
|
76
76
|
*
|
|
77
|
-
* @param domConverter Instance of the
|
|
77
|
+
* @param domConverter Instance of the ViewDomConverter used to optimize the output.
|
|
78
78
|
*/
|
|
79
|
-
render(domDocument: DomDocument, domConverter:
|
|
79
|
+
render(domDocument: DomDocument, domConverter: ViewDomConverter): DomElement;
|
|
80
80
|
/**
|
|
81
81
|
* Creates DOM element based on this view UIElement.
|
|
82
82
|
* Note that each time this method is called new DOM element is created.
|
|
@@ -84,13 +84,14 @@ export default class UIElement extends Element {
|
|
|
84
84
|
toDomElement(domDocument: DomDocument): DomElement;
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
* This function injects UI element handling to the given {@link module:engine/view/document~
|
|
87
|
+
* This function injects UI element handling to the given {@link module:engine/view/document~ViewDocument document}.
|
|
88
88
|
*
|
|
89
|
-
* A callback is added to {@link module:engine/view/document~
|
|
89
|
+
* A callback is added to {@link module:engine/view/document~ViewDocument#event:keydown document keydown event}.
|
|
90
90
|
* The callback handles the situation when right arrow key is pressed and selection is collapsed before a UI element.
|
|
91
91
|
* Without this handler, it would be impossible to "jump over" UI element using right arrow key.
|
|
92
92
|
*
|
|
93
93
|
* @param view View controller to which the quirks handling will be injected.
|
|
94
|
+
* @internal
|
|
94
95
|
*/
|
|
95
|
-
export declare function injectUiElementHandling(view:
|
|
96
|
+
export declare function injectUiElementHandling(view: EditingView): void;
|
|
96
97
|
export {};
|
package/src/view/uielement.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/uielement
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import { ViewElement } from './element.js';
|
|
9
|
+
import { ViewNode } from './node.js';
|
|
10
10
|
import { CKEditorError, keyCodes } from '@ckeditor/ckeditor5-utils';
|
|
11
11
|
/**
|
|
12
12
|
* UI element class. It should be used to represent editing UI which needs to be injected into the editing view
|
|
@@ -14,26 +14,26 @@ import { CKEditorError, keyCodes } from '@ckeditor/ckeditor5-utils';
|
|
|
14
14
|
* UI elements can be used.
|
|
15
15
|
*
|
|
16
16
|
* How a UI element is rendered is in your control (you pass a callback to
|
|
17
|
-
* {@link module:engine/view/downcastwriter~
|
|
17
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `downcastWriter#createUIElement()`}).
|
|
18
18
|
* The editor will ignore your UI element – the selection cannot be placed in it, it is skipped (invisible) when
|
|
19
19
|
* the user modifies the selection by using arrow keys and the editor does not listen to any mutations which
|
|
20
20
|
* happen inside your UI elements.
|
|
21
21
|
*
|
|
22
22
|
* The limitation is that you cannot convert a model element to a UI element. UI elements need to be
|
|
23
23
|
* created for {@link module:engine/model/markercollection~Marker markers} or as additinal elements
|
|
24
|
-
* inside normal {@link module:engine/view/containerelement~
|
|
24
|
+
* inside normal {@link module:engine/view/containerelement~ViewContainerElement container elements}.
|
|
25
25
|
*
|
|
26
26
|
* To create a new UI element use the
|
|
27
|
-
* {@link module:engine/view/downcastwriter~
|
|
27
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `downcastWriter#createUIElement()`} method.
|
|
28
28
|
*/
|
|
29
|
-
export
|
|
29
|
+
export class ViewUIElement extends ViewElement {
|
|
30
30
|
/**
|
|
31
31
|
* Creates new instance of UIElement.
|
|
32
32
|
*
|
|
33
33
|
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` when third parameter is passed,
|
|
34
34
|
* to inform that usage of UIElement is incorrect (adding child nodes to UIElement is forbidden).
|
|
35
35
|
*
|
|
36
|
-
* @see module:engine/view/downcastwriter~
|
|
36
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement
|
|
37
37
|
* @internal
|
|
38
38
|
* @param document The document instance to which this element belongs.
|
|
39
39
|
* @param name Node name.
|
|
@@ -45,16 +45,16 @@ export default class UIElement extends Element {
|
|
|
45
45
|
this.getFillerOffset = getFillerOffset;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* Overrides {@link module:engine/view/element~
|
|
48
|
+
* Overrides {@link module:engine/view/element~ViewElement#_insertChild} method.
|
|
49
49
|
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` to prevent adding any child nodes
|
|
50
50
|
* to UIElement.
|
|
51
51
|
*
|
|
52
52
|
* @internal
|
|
53
53
|
*/
|
|
54
54
|
_insertChild(index, items) {
|
|
55
|
-
if (items && (items instanceof
|
|
55
|
+
if (items && (items instanceof ViewNode || Array.from(items).length > 0)) {
|
|
56
56
|
/**
|
|
57
|
-
* Cannot add children to {@link module:engine/view/uielement~
|
|
57
|
+
* Cannot add children to {@link module:engine/view/uielement~ViewUIElement}.
|
|
58
58
|
*
|
|
59
59
|
* @error view-uielement-cannot-add
|
|
60
60
|
*/
|
|
@@ -63,8 +63,8 @@ export default class UIElement extends Element {
|
|
|
63
63
|
return 0;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* Renders this {@link module:engine/view/uielement~
|
|
67
|
-
* {@link module:engine/view/domconverter~
|
|
66
|
+
* Renders this {@link module:engine/view/uielement~ViewUIElement} to DOM. This method is called by
|
|
67
|
+
* {@link module:engine/view/domconverter~ViewDomConverter}.
|
|
68
68
|
* Do not use inheritance to create custom rendering method, replace `render()` method instead:
|
|
69
69
|
*
|
|
70
70
|
* ```ts
|
|
@@ -82,7 +82,7 @@ export default class UIElement extends Element {
|
|
|
82
82
|
* the {@link module:ui/editorui/editorui~EditorUI#update `editor.ui.update()`} method
|
|
83
83
|
* after rendering your UI element.
|
|
84
84
|
*
|
|
85
|
-
* @param domConverter Instance of the
|
|
85
|
+
* @param domConverter Instance of the ViewDomConverter used to optimize the output.
|
|
86
86
|
*/
|
|
87
87
|
render(domDocument, domConverter // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
88
88
|
) {
|
|
@@ -103,7 +103,7 @@ export default class UIElement extends Element {
|
|
|
103
103
|
}
|
|
104
104
|
// The magic of type inference using `is` method is centralized in `TypeCheckable` class.
|
|
105
105
|
// Proper overload would interfere with that.
|
|
106
|
-
|
|
106
|
+
ViewUIElement.prototype.is = function (type, name) {
|
|
107
107
|
if (!name) {
|
|
108
108
|
return type === 'uiElement' || type === 'view:uiElement' ||
|
|
109
109
|
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
|
|
@@ -116,13 +116,14 @@ UIElement.prototype.is = function (type, name) {
|
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
118
|
/**
|
|
119
|
-
* This function injects UI element handling to the given {@link module:engine/view/document~
|
|
119
|
+
* This function injects UI element handling to the given {@link module:engine/view/document~ViewDocument document}.
|
|
120
120
|
*
|
|
121
|
-
* A callback is added to {@link module:engine/view/document~
|
|
121
|
+
* A callback is added to {@link module:engine/view/document~ViewDocument#event:keydown document keydown event}.
|
|
122
122
|
* The callback handles the situation when right arrow key is pressed and selection is collapsed before a UI element.
|
|
123
123
|
* Without this handler, it would be impossible to "jump over" UI element using right arrow key.
|
|
124
124
|
*
|
|
125
125
|
* @param view View controller to which the quirks handling will be injected.
|
|
126
|
+
* @internal
|
|
126
127
|
*/
|
|
127
128
|
export function injectUiElementHandling(view) {
|
|
128
129
|
view.document.on('arrowKey', (evt, data) => jumpOverUiElement(evt, data, view.domConverter), { priority: 'low' });
|
|
@@ -5,54 +5,54 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/upcastwriter
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import type
|
|
15
|
-
import type
|
|
16
|
-
import type
|
|
8
|
+
import { ViewDocumentFragment } from './documentfragment.js';
|
|
9
|
+
import { ViewElement, type ViewElementAttributes } from './element.js';
|
|
10
|
+
import { ViewText } from './text.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 ViewDocument } from './document.js';
|
|
15
|
+
import { type ViewItem } from './item.js';
|
|
16
|
+
import { type ViewNode } from './node.js';
|
|
17
17
|
/**
|
|
18
18
|
* View upcast writer. It provides a set of methods used to manipulate non-semantic view trees.
|
|
19
19
|
*
|
|
20
20
|
* It should be used only while working on a non-semantic view
|
|
21
21
|
* (e.g. a view created from HTML string on paste).
|
|
22
22
|
* To manipulate a view which was or is being downcasted from the the model use the
|
|
23
|
-
* {@link module:engine/view/downcastwriter~
|
|
23
|
+
* {@link module:engine/view/downcastwriter~ViewDowncastWriter downcast writer}.
|
|
24
24
|
*
|
|
25
25
|
* Read more about changing the view in the {@glink framework/architecture/editing-engine#changing-the-view Changing the view}
|
|
26
26
|
* section of the {@glink framework/architecture/editing-engine Editing engine architecture} guide.
|
|
27
27
|
*
|
|
28
|
-
* Unlike `
|
|
29
|
-
* `
|
|
28
|
+
* Unlike `ViewDowncastWriter`, which is available in the {@link module:engine/view/view~EditingView#change `View#change()`} block,
|
|
29
|
+
* `ViewUpcastWriter` can be created wherever you need it:
|
|
30
30
|
*
|
|
31
31
|
* ```ts
|
|
32
|
-
* const writer = new
|
|
32
|
+
* const writer = new ViewUpcastWriter( viewDocument );
|
|
33
33
|
* const text = writer.createText( 'foo!' );
|
|
34
34
|
*
|
|
35
35
|
* writer.appendChild( text, someViewElement );
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
export
|
|
38
|
+
export declare class ViewUpcastWriter {
|
|
39
39
|
/**
|
|
40
40
|
* The view document instance in which this upcast writer operates.
|
|
41
41
|
*/
|
|
42
|
-
readonly document:
|
|
42
|
+
readonly document: ViewDocument;
|
|
43
43
|
/**
|
|
44
44
|
* @param document The view document instance in which this upcast writer operates.
|
|
45
45
|
*/
|
|
46
|
-
constructor(document:
|
|
46
|
+
constructor(document: ViewDocument);
|
|
47
47
|
/**
|
|
48
|
-
* Creates a new {@link module:engine/view/documentfragment~
|
|
48
|
+
* Creates a new {@link module:engine/view/documentfragment~ViewDocumentFragment} instance.
|
|
49
49
|
*
|
|
50
50
|
* @param children A list of nodes to be inserted into the created document fragment.
|
|
51
51
|
* @returns The created document fragment.
|
|
52
52
|
*/
|
|
53
|
-
createDocumentFragment(children?:
|
|
53
|
+
createDocumentFragment(children?: ViewNode | Iterable<ViewNode>): ViewDocumentFragment;
|
|
54
54
|
/**
|
|
55
|
-
* Creates a new {@link module:engine/view/element~
|
|
55
|
+
* Creates a new {@link module:engine/view/element~ViewElement} instance.
|
|
56
56
|
*
|
|
57
57
|
* Attributes can be passed in various formats:
|
|
58
58
|
*
|
|
@@ -67,62 +67,62 @@ export default class UpcastWriter {
|
|
|
67
67
|
* @param children A list of nodes to be inserted into created element.
|
|
68
68
|
* @returns Created element.
|
|
69
69
|
*/
|
|
70
|
-
createElement(name: string, attrs?:
|
|
70
|
+
createElement(name: string, attrs?: ViewElementAttributes, children?: ViewNode | Iterable<ViewNode>): ViewElement;
|
|
71
71
|
/**
|
|
72
|
-
* Creates a new {@link module:engine/view/text~
|
|
72
|
+
* Creates a new {@link module:engine/view/text~ViewText} instance.
|
|
73
73
|
*
|
|
74
74
|
* @param data The text's data.
|
|
75
75
|
* @returns The created text node.
|
|
76
76
|
*/
|
|
77
|
-
createText(data: string):
|
|
77
|
+
createText(data: string): ViewText;
|
|
78
78
|
/**
|
|
79
79
|
* Clones the provided element.
|
|
80
80
|
*
|
|
81
|
-
* @see module:engine/view/element~
|
|
81
|
+
* @see module:engine/view/element~ViewElement#_clone
|
|
82
82
|
* @param element Element to be cloned.
|
|
83
83
|
* @param deep If set to `true` clones element and all its children recursively. When set to `false`,
|
|
84
84
|
* element will be cloned without any children.
|
|
85
85
|
* @returns Clone of this element.
|
|
86
86
|
*/
|
|
87
|
-
clone(element:
|
|
87
|
+
clone(element: ViewElement, deep?: boolean): ViewElement;
|
|
88
88
|
/**
|
|
89
89
|
* Appends a child node or a list of child nodes at the end of this node
|
|
90
90
|
* and sets the parent of these nodes to this element.
|
|
91
91
|
*
|
|
92
|
-
* @see module:engine/view/element~
|
|
92
|
+
* @see module:engine/view/element~ViewElement#_appendChild
|
|
93
93
|
* @param items Items to be inserted.
|
|
94
94
|
* @param element Element to which items will be appended.
|
|
95
95
|
* @returns Number of appended nodes.
|
|
96
96
|
*/
|
|
97
|
-
appendChild(items:
|
|
97
|
+
appendChild(items: ViewItem | string | Iterable<ViewItem | string>, element: ViewElement | ViewDocumentFragment): number;
|
|
98
98
|
/**
|
|
99
99
|
* Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to
|
|
100
100
|
* this element.
|
|
101
101
|
*
|
|
102
|
-
* @see module:engine/view/element~
|
|
102
|
+
* @see module:engine/view/element~ViewElement#_insertChild
|
|
103
103
|
* @param index Offset at which nodes should be inserted.
|
|
104
104
|
* @param items Items to be inserted.
|
|
105
105
|
* @param element Element to which items will be inserted.
|
|
106
106
|
* @returns Number of inserted nodes.
|
|
107
107
|
*/
|
|
108
|
-
insertChild(index: number, items:
|
|
108
|
+
insertChild(index: number, items: ViewItem | Iterable<ViewItem>, element: ViewElement | ViewDocumentFragment): number;
|
|
109
109
|
/**
|
|
110
110
|
* Removes the given number of child nodes starting at the given index and set the parent of these nodes to `null`.
|
|
111
111
|
*
|
|
112
|
-
* @see module:engine/view/element~
|
|
112
|
+
* @see module:engine/view/element~ViewElement#_removeChildren
|
|
113
113
|
* @param index Offset from which nodes will be removed.
|
|
114
114
|
* @param howMany Number of nodes to remove.
|
|
115
115
|
* @param element Element which children will be removed.
|
|
116
116
|
* @returns The array containing removed nodes.
|
|
117
117
|
*/
|
|
118
|
-
removeChildren(index: number, howMany: number, element:
|
|
118
|
+
removeChildren(index: number, howMany: number, element: ViewElement | ViewDocumentFragment): Array<ViewNode>;
|
|
119
119
|
/**
|
|
120
120
|
* Removes given element from the view structure. Will not have effect on detached elements.
|
|
121
121
|
*
|
|
122
122
|
* @param element Element which will be removed.
|
|
123
123
|
* @returns The array containing removed nodes.
|
|
124
124
|
*/
|
|
125
|
-
remove(element:
|
|
125
|
+
remove(element: ViewNode): Array<ViewNode>;
|
|
126
126
|
/**
|
|
127
127
|
* Replaces given element with the new one in the view structure. Will not have effect on detached elements.
|
|
128
128
|
*
|
|
@@ -130,14 +130,14 @@ export default class UpcastWriter {
|
|
|
130
130
|
* @param newElement Element which will be inserted in the place of the old element.
|
|
131
131
|
* @returns Whether old element was successfully replaced.
|
|
132
132
|
*/
|
|
133
|
-
replace(oldElement:
|
|
133
|
+
replace(oldElement: ViewElement, newElement: ViewElement): boolean;
|
|
134
134
|
/**
|
|
135
135
|
* Removes given element from view structure and places its children in its position.
|
|
136
136
|
* It does nothing if element has no parent.
|
|
137
137
|
*
|
|
138
138
|
* @param element Element to unwrap.
|
|
139
139
|
*/
|
|
140
|
-
unwrapElement(element:
|
|
140
|
+
unwrapElement(element: ViewElement): void;
|
|
141
141
|
/**
|
|
142
142
|
* Renames element by creating a copy of a given element but with its name changed and then moving contents of the
|
|
143
143
|
* old element to the new one.
|
|
@@ -148,7 +148,7 @@ export default class UpcastWriter {
|
|
|
148
148
|
* @param element Element to be renamed.
|
|
149
149
|
* @returns New element or null if the old element was not replaced (happens for detached elements).
|
|
150
150
|
*/
|
|
151
|
-
rename(newName: string, element:
|
|
151
|
+
rename(newName: string, element: ViewElement): ViewElement | null;
|
|
152
152
|
/**
|
|
153
153
|
* Adds or overwrites element's attribute with a specified key and value.
|
|
154
154
|
*
|
|
@@ -156,12 +156,12 @@ export default class UpcastWriter {
|
|
|
156
156
|
* writer.setAttribute( 'href', 'http://ckeditor.com', linkElement );
|
|
157
157
|
* ```
|
|
158
158
|
*
|
|
159
|
-
* @see module:engine/view/element~
|
|
159
|
+
* @see module:engine/view/element~ViewElement#_setAttribute
|
|
160
160
|
* @param key Attribute key.
|
|
161
161
|
* @param value Attribute value.
|
|
162
162
|
* @param element Element for which attribute will be set.
|
|
163
163
|
*/
|
|
164
|
-
setAttribute(key: string, value: unknown, element:
|
|
164
|
+
setAttribute(key: string, value: unknown, element: ViewElement): void;
|
|
165
165
|
/**
|
|
166
166
|
* Removes attribute from the element.
|
|
167
167
|
*
|
|
@@ -169,11 +169,11 @@ export default class UpcastWriter {
|
|
|
169
169
|
* writer.removeAttribute( 'href', linkElement );
|
|
170
170
|
* ```
|
|
171
171
|
*
|
|
172
|
-
* @see module:engine/view/element~
|
|
172
|
+
* @see module:engine/view/element~ViewElement#_removeAttribute
|
|
173
173
|
* @param key Attribute key.
|
|
174
174
|
* @param element Element from which attribute will be removed.
|
|
175
175
|
*/
|
|
176
|
-
removeAttribute(key: string, element:
|
|
176
|
+
removeAttribute(key: string, element: ViewElement): void;
|
|
177
177
|
/**
|
|
178
178
|
* Adds specified class to the element.
|
|
179
179
|
*
|
|
@@ -182,11 +182,11 @@ export default class UpcastWriter {
|
|
|
182
182
|
* writer.addClass( [ 'foo', 'bar' ], linkElement );
|
|
183
183
|
* ```
|
|
184
184
|
*
|
|
185
|
-
* @see module:engine/view/element~
|
|
185
|
+
* @see module:engine/view/element~ViewElement#_addClass
|
|
186
186
|
* @param className Single class name or array of class names which will be added.
|
|
187
187
|
* @param element Element for which class will be added.
|
|
188
188
|
*/
|
|
189
|
-
addClass(className: string | Array<string>, element:
|
|
189
|
+
addClass(className: string | Array<string>, element: ViewElement): void;
|
|
190
190
|
/**
|
|
191
191
|
* Removes specified class from the element.
|
|
192
192
|
*
|
|
@@ -195,11 +195,11 @@ export default class UpcastWriter {
|
|
|
195
195
|
* writer.removeClass( [ 'foo', 'bar' ], linkElement );
|
|
196
196
|
* ```
|
|
197
197
|
*
|
|
198
|
-
* @see module:engine/view/element~
|
|
198
|
+
* @see module:engine/view/element~ViewElement#_removeClass
|
|
199
199
|
* @param className Single class name or array of class names which will be removed.
|
|
200
200
|
* @param element Element from which class will be removed.
|
|
201
201
|
*/
|
|
202
|
-
removeClass(className: string | Array<string>, element:
|
|
202
|
+
removeClass(className: string | Array<string>, element: ViewElement): void;
|
|
203
203
|
/**
|
|
204
204
|
* Adds style to the element.
|
|
205
205
|
*
|
|
@@ -211,13 +211,13 @@ export default class UpcastWriter {
|
|
|
211
211
|
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
212
212
|
* See {@link module:engine/view/stylesmap~StylesMap#set `StylesMap#set()`} for details.
|
|
213
213
|
*
|
|
214
|
-
* @see module:engine/view/element~
|
|
214
|
+
* @see module:engine/view/element~ViewElement#_setStyle
|
|
215
215
|
* @label KEY_VALUE
|
|
216
216
|
* @param property Property name.
|
|
217
217
|
* @param value Value to set.
|
|
218
218
|
* @param element Element for which style will be added.
|
|
219
219
|
*/
|
|
220
|
-
setStyle(property: string, value: string, element:
|
|
220
|
+
setStyle(property: string, value: string, element: ViewElement): void;
|
|
221
221
|
/**
|
|
222
222
|
* Adds style to the element.
|
|
223
223
|
*
|
|
@@ -232,12 +232,12 @@ export default class UpcastWriter {
|
|
|
232
232
|
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
233
233
|
* See {@link module:engine/view/stylesmap~StylesMap#set `StylesMap#set()`} for details.
|
|
234
234
|
*
|
|
235
|
-
* @see module:engine/view/element~
|
|
235
|
+
* @see module:engine/view/element~ViewElement#_setStyle
|
|
236
236
|
* @label OBJECT
|
|
237
237
|
* @param properties Object with key - value pairs.
|
|
238
238
|
* @param element Element for which style will be added.
|
|
239
239
|
*/
|
|
240
|
-
setStyle(properties: Record<string, string>, element:
|
|
240
|
+
setStyle(properties: Record<string, string>, element: ViewElement): void;
|
|
241
241
|
/**
|
|
242
242
|
* Removes specified style from the element.
|
|
243
243
|
*
|
|
@@ -250,91 +250,91 @@ export default class UpcastWriter {
|
|
|
250
250
|
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
251
251
|
* See {@link module:engine/view/stylesmap~StylesMap#remove `StylesMap#remove()`} for details.
|
|
252
252
|
*
|
|
253
|
-
* @see module:engine/view/element~
|
|
253
|
+
* @see module:engine/view/element~ViewElement#_removeStyle
|
|
254
254
|
* @param property Style property name or names to be removed.
|
|
255
255
|
* @param element Element from which style will be removed.
|
|
256
256
|
*/
|
|
257
|
-
removeStyle(property: string | Array<string>, element:
|
|
257
|
+
removeStyle(property: string | Array<string>, element: ViewElement): void;
|
|
258
258
|
/**
|
|
259
259
|
* Sets a custom property on element. Unlike attributes, custom properties are not rendered to the DOM,
|
|
260
260
|
* so they can be used to add special data to elements.
|
|
261
261
|
*
|
|
262
|
-
* @see module:engine/view/element~
|
|
262
|
+
* @see module:engine/view/element~ViewElement#_setCustomProperty
|
|
263
263
|
* @param key Custom property name/key.
|
|
264
264
|
* @param value Custom property value to be stored.
|
|
265
265
|
* @param element Element for which custom property will be set.
|
|
266
266
|
*/
|
|
267
|
-
setCustomProperty(key: string | symbol, value: unknown, element:
|
|
267
|
+
setCustomProperty(key: string | symbol, value: unknown, element: ViewElement | ViewDocumentFragment): void;
|
|
268
268
|
/**
|
|
269
269
|
* Removes a custom property stored under the given key.
|
|
270
270
|
*
|
|
271
|
-
* @see module:engine/view/element~
|
|
271
|
+
* @see module:engine/view/element~ViewElement#_removeCustomProperty
|
|
272
272
|
* @param key Name/key of the custom property to be removed.
|
|
273
273
|
* @param element Element from which the custom property will be removed.
|
|
274
274
|
* @returns Returns true if property was removed.
|
|
275
275
|
*/
|
|
276
|
-
removeCustomProperty(key: string | symbol, element:
|
|
276
|
+
removeCustomProperty(key: string | symbol, element: ViewElement | ViewDocumentFragment): boolean;
|
|
277
277
|
/**
|
|
278
278
|
* Creates position at the given location. The location can be specified as:
|
|
279
279
|
*
|
|
280
|
-
* * a {@link module:engine/view/position~
|
|
280
|
+
* * a {@link module:engine/view/position~ViewPosition position},
|
|
281
281
|
* * parent element and offset (offset defaults to `0`),
|
|
282
282
|
* * parent element and `'end'` (sets position at the end of that element),
|
|
283
|
-
* * {@link module:engine/view/item~
|
|
283
|
+
* * {@link module:engine/view/item~ViewItem view item} and `'before'` or `'after'` (sets position before or after given view item).
|
|
284
284
|
*
|
|
285
285
|
* This method is a shortcut to other constructors such as:
|
|
286
286
|
*
|
|
287
287
|
* * {@link #createPositionBefore},
|
|
288
288
|
* * {@link #createPositionAfter},
|
|
289
289
|
*
|
|
290
|
-
* @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~
|
|
290
|
+
* @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.
|
|
291
291
|
*/
|
|
292
|
-
createPositionAt(itemOrPosition:
|
|
292
|
+
createPositionAt(itemOrPosition: ViewItem | ViewPosition, offset?: ViewPositionOffset): ViewPosition;
|
|
293
293
|
/**
|
|
294
294
|
* Creates a new position after given view item.
|
|
295
295
|
*
|
|
296
296
|
* @param item View item after which the position should be located.
|
|
297
297
|
*/
|
|
298
|
-
createPositionAfter(item:
|
|
298
|
+
createPositionAfter(item: ViewItem): ViewPosition;
|
|
299
299
|
/**
|
|
300
300
|
* Creates a new position before given view item.
|
|
301
301
|
*
|
|
302
302
|
* @param item View item before which the position should be located.
|
|
303
303
|
*/
|
|
304
|
-
createPositionBefore(item:
|
|
304
|
+
createPositionBefore(item: ViewItem): ViewPosition;
|
|
305
305
|
/**
|
|
306
306
|
* Creates a range spanning from `start` position to `end` position.
|
|
307
307
|
*
|
|
308
|
-
* **Note:** This factory method creates it's own {@link module:engine/view/position~
|
|
308
|
+
* **Note:** This factory method creates it's own {@link module:engine/view/position~ViewPosition} instances basing on passed values.
|
|
309
309
|
*
|
|
310
310
|
* @param start Start position.
|
|
311
311
|
* @param end End position. If not set, range will be collapsed at `start` position.
|
|
312
312
|
*/
|
|
313
|
-
createRange(start:
|
|
313
|
+
createRange(start: ViewPosition, end: ViewPosition): ViewRange;
|
|
314
314
|
/**
|
|
315
|
-
* Creates a range that starts before given {@link module:engine/view/item~
|
|
315
|
+
* Creates a range that starts before given {@link module:engine/view/item~ViewItem view item} and ends after it.
|
|
316
316
|
*/
|
|
317
|
-
createRangeOn(item:
|
|
317
|
+
createRangeOn(item: ViewItem): ViewRange;
|
|
318
318
|
/**
|
|
319
|
-
* Creates a range inside an {@link module:engine/view/element~
|
|
319
|
+
* Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of
|
|
320
320
|
* that element and ends after the last child of that element.
|
|
321
321
|
*
|
|
322
322
|
* @param element Element which is a parent for the range.
|
|
323
323
|
*/
|
|
324
|
-
createRangeIn(element:
|
|
324
|
+
createRangeIn(element: ViewElement | ViewDocumentFragment): ViewRange;
|
|
325
325
|
/**
|
|
326
|
-
* Creates a new {@link module:engine/view/selection~
|
|
326
|
+
* Creates a new {@link module:engine/view/selection~ViewSelection} instance.
|
|
327
327
|
*
|
|
328
328
|
* ```ts
|
|
329
329
|
* // Creates collapsed selection at the position of given item and offset.
|
|
330
330
|
* const paragraph = writer.createContainerElement( 'paragraph' );
|
|
331
331
|
* const selection = writer.createSelection( paragraph, offset );
|
|
332
332
|
*
|
|
333
|
-
* // Creates a range inside an {@link module:engine/view/element~
|
|
333
|
+
* // Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the
|
|
334
334
|
* // first child of that element and ends after the last child of that element.
|
|
335
335
|
* const selection = writer.createSelection( paragraph, 'in' );
|
|
336
336
|
*
|
|
337
|
-
* // Creates a range on an {@link module:engine/view/item~
|
|
337
|
+
* // Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends
|
|
338
338
|
* // just after the item.
|
|
339
339
|
* const selection = writer.createSelection( paragraph, 'on' );
|
|
340
340
|
* ```
|
|
@@ -362,9 +362,9 @@ export default class UpcastWriter {
|
|
|
362
362
|
*
|
|
363
363
|
* @label NODE_OFFSET
|
|
364
364
|
*/
|
|
365
|
-
createSelection(selectable:
|
|
365
|
+
createSelection(selectable: ViewNode, placeOrOffset: ViewPlaceOrOffset, options?: ViewSelectionOptions): ViewSelection;
|
|
366
366
|
/**
|
|
367
|
-
* Creates a new {@link module:engine/view/selection~
|
|
367
|
+
* Creates a new {@link module:engine/view/selection~ViewSelection} instance.
|
|
368
368
|
*
|
|
369
369
|
* ```ts
|
|
370
370
|
* // Creates empty selection without ranges.
|
|
@@ -413,5 +413,5 @@ export default class UpcastWriter {
|
|
|
413
413
|
*
|
|
414
414
|
* @label SELECTABLE
|
|
415
415
|
*/
|
|
416
|
-
createSelection(selectable?: Exclude<
|
|
416
|
+
createSelection(selectable?: Exclude<ViewSelectable, ViewNode>, options?: ViewSelectionOptions): ViewSelection;
|
|
417
417
|
}
|