@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/model/selection.d.ts
CHANGED
|
@@ -5,22 +5,22 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/selection
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import type
|
|
13
|
-
import type
|
|
14
|
-
import type
|
|
15
|
-
declare const
|
|
8
|
+
import { ModelTypeCheckable } from './typecheckable.js';
|
|
9
|
+
import { ModelNode } from './node.js';
|
|
10
|
+
import { ModelPosition, type ModelPositionOffset } from './position.js';
|
|
11
|
+
import { ModelRange } from './range.js';
|
|
12
|
+
import { type ModelDocumentSelection } from './documentselection.js';
|
|
13
|
+
import { type ModelElement } from './element.js';
|
|
14
|
+
import { type ModelItem } from './item.js';
|
|
15
|
+
declare const ModelSelection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof ModelTypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
|
|
16
16
|
/**
|
|
17
|
-
* Selection is a set of {@link module:engine/model/range~
|
|
18
|
-
* {@link module:engine/model/selection~
|
|
19
|
-
* (it can be {@link module:engine/model/selection~
|
|
17
|
+
* Selection is a set of {@link module:engine/model/range~ModelRange ranges}. It has a direction specified by its
|
|
18
|
+
* {@link module:engine/model/selection~ModelSelection#anchor anchor} and {@link module:engine/model/selection~ModelSelection#focus focus}
|
|
19
|
+
* (it can be {@link module:engine/model/selection~ModelSelection#isBackward forward or backward}).
|
|
20
20
|
* Additionally, selection may have its own attributes (think – whether text typed in in this selection
|
|
21
21
|
* should have those attributes – e.g. whether you type a bolded text).
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export declare class ModelSelection extends /* #__PURE__ */ ModelSelection_base {
|
|
24
24
|
/**
|
|
25
25
|
* Specifies whether the last added range was added as a backward or forward range.
|
|
26
26
|
*/
|
|
@@ -30,9 +30,9 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
|
30
30
|
*/
|
|
31
31
|
protected _attrs: Map<string, unknown>;
|
|
32
32
|
/** @internal */
|
|
33
|
-
_ranges: Array<
|
|
33
|
+
_ranges: Array<ModelRange>;
|
|
34
34
|
/**
|
|
35
|
-
* Creates a new selection instance based on the given {@link module:engine/model/selection~
|
|
35
|
+
* Creates a new selection instance based on the given {@link module:engine/model/selection~ModelSelectable selectable}
|
|
36
36
|
* or creates an empty selection if no arguments were passed.
|
|
37
37
|
*
|
|
38
38
|
* ```ts
|
|
@@ -65,11 +65,11 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
|
65
65
|
* const paragraph = writer.createElement( 'paragraph' );
|
|
66
66
|
* const selection = writer.createSelection( paragraph, offset );
|
|
67
67
|
*
|
|
68
|
-
* // Creates a range inside an {@link module:engine/model/element~
|
|
68
|
+
* // Creates a range inside an {@link module:engine/model/element~ModelElement element} which starts before the
|
|
69
69
|
* // first child of that element and ends after the last child of that element.
|
|
70
70
|
* const selection = writer.createSelection( paragraph, 'in' );
|
|
71
71
|
*
|
|
72
|
-
* // Creates a range on an {@link module:engine/model/item~
|
|
72
|
+
* // Creates a range on an {@link module:engine/model/item~ModelItem item} which starts before the item and ends
|
|
73
73
|
* // just after the item.
|
|
74
74
|
* const selection = writer.createSelection( paragraph, 'on' );
|
|
75
75
|
* ```
|
|
@@ -84,13 +84,13 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
|
84
84
|
* @internal
|
|
85
85
|
*/
|
|
86
86
|
constructor(...args: [] | [
|
|
87
|
-
selectable:
|
|
88
|
-
placeOrOffset:
|
|
87
|
+
selectable: ModelNode,
|
|
88
|
+
placeOrOffset: ModelPlaceOrOffset,
|
|
89
89
|
options?: {
|
|
90
90
|
backward?: boolean;
|
|
91
91
|
}
|
|
92
92
|
] | [
|
|
93
|
-
selectable?: Exclude<
|
|
93
|
+
selectable?: Exclude<ModelSelectable, ModelNode>,
|
|
94
94
|
options?: {
|
|
95
95
|
backward?: boolean;
|
|
96
96
|
}
|
|
@@ -102,15 +102,15 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
|
102
102
|
* Anchor and {@link #focus} define the direction of the selection, which is important
|
|
103
103
|
* when expanding/shrinking selection. The focus moves, while the anchor should remain in the same place.
|
|
104
104
|
*
|
|
105
|
-
* Anchor is always set to the {@link module:engine/model/range~
|
|
106
|
-
* {@link module:engine/model/range~
|
|
105
|
+
* Anchor is always set to the {@link module:engine/model/range~ModelRange#start start} or
|
|
106
|
+
* {@link module:engine/model/range~ModelRange#end end} position of the last of selection's ranges. Whether it is
|
|
107
107
|
* the `start` or `end` depends on the specified `options.backward`. See the {@link #setTo `setTo()`} method.
|
|
108
108
|
*
|
|
109
109
|
* May be set to `null` if there are no ranges in the selection.
|
|
110
110
|
*
|
|
111
111
|
* @see #focus
|
|
112
112
|
*/
|
|
113
|
-
get anchor():
|
|
113
|
+
get anchor(): ModelPosition | null;
|
|
114
114
|
/**
|
|
115
115
|
* Selection focus. Focus is the position where the selection ends. If a user is making a selection
|
|
116
116
|
* by dragging the mouse, the focus is where the mouse cursor is.
|
|
@@ -119,7 +119,7 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
|
119
119
|
*
|
|
120
120
|
* @see #anchor
|
|
121
121
|
*/
|
|
122
|
-
get focus():
|
|
122
|
+
get focus(): ModelPosition | null;
|
|
123
123
|
/**
|
|
124
124
|
* Whether the selection is collapsed. Selection is collapsed when there is exactly one range in it
|
|
125
125
|
* and it is collapsed.
|
|
@@ -140,48 +140,48 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
|
140
140
|
* @param otherSelection Selection to compare with.
|
|
141
141
|
* @returns `true` if selections are equal, `false` otherwise.
|
|
142
142
|
*/
|
|
143
|
-
isEqual(otherSelection:
|
|
143
|
+
isEqual(otherSelection: ModelSelection | ModelDocumentSelection): boolean;
|
|
144
144
|
/**
|
|
145
145
|
* Returns an iterable object that iterates over copies of selection ranges.
|
|
146
146
|
*/
|
|
147
|
-
getRanges(): IterableIterator<
|
|
147
|
+
getRanges(): IterableIterator<ModelRange>;
|
|
148
148
|
/**
|
|
149
149
|
* Returns a copy of the first range in the selection.
|
|
150
|
-
* First range is the one which {@link module:engine/model/range~
|
|
151
|
-
* {@link module:engine/model/position~
|
|
150
|
+
* First range is the one which {@link module:engine/model/range~ModelRange#start start} position
|
|
151
|
+
* {@link module:engine/model/position~ModelPosition#isBefore is before} start position of all other ranges
|
|
152
152
|
* (not to confuse with the first range added to the selection).
|
|
153
153
|
*
|
|
154
154
|
* Returns `null` if there are no ranges in selection.
|
|
155
155
|
*/
|
|
156
|
-
getFirstRange():
|
|
156
|
+
getFirstRange(): ModelRange | null;
|
|
157
157
|
/**
|
|
158
158
|
* Returns a copy of the last range in the selection.
|
|
159
|
-
* Last range is the one which {@link module:engine/model/range~
|
|
160
|
-
* {@link module:engine/model/position~
|
|
161
|
-
* recently added to the selection).
|
|
159
|
+
* Last range is the one which {@link module:engine/model/range~ModelRange#end end} position
|
|
160
|
+
* {@link module:engine/model/position~ModelPosition#isAfter is after} end position of all other
|
|
161
|
+
* ranges (not to confuse with the range most recently added to the selection).
|
|
162
162
|
*
|
|
163
163
|
* Returns `null` if there are no ranges in selection.
|
|
164
164
|
*/
|
|
165
|
-
getLastRange():
|
|
165
|
+
getLastRange(): ModelRange | null;
|
|
166
166
|
/**
|
|
167
167
|
* Returns the first position in the selection.
|
|
168
|
-
* First position is the position that {@link module:engine/model/position~
|
|
168
|
+
* First position is the position that {@link module:engine/model/position~ModelPosition#isBefore is before}
|
|
169
169
|
* any other position in the selection.
|
|
170
170
|
*
|
|
171
171
|
* Returns `null` if there are no ranges in selection.
|
|
172
172
|
*/
|
|
173
|
-
getFirstPosition():
|
|
173
|
+
getFirstPosition(): ModelPosition | null;
|
|
174
174
|
/**
|
|
175
175
|
* Returns the last position in the selection.
|
|
176
|
-
* Last position is the position that {@link module:engine/model/position~
|
|
176
|
+
* Last position is the position that {@link module:engine/model/position~ModelPosition#isAfter is after}
|
|
177
177
|
* any other position in the selection.
|
|
178
178
|
*
|
|
179
179
|
* Returns `null` if there are no ranges in selection.
|
|
180
180
|
*/
|
|
181
|
-
getLastPosition():
|
|
181
|
+
getLastPosition(): ModelPosition | null;
|
|
182
182
|
/**
|
|
183
183
|
* Sets this selection's ranges and direction to the specified location based on the given
|
|
184
|
-
* {@link module:engine/model/selection~
|
|
184
|
+
* {@link module:engine/model/selection~ModelSelectable selectable}.
|
|
185
185
|
*
|
|
186
186
|
* ```ts
|
|
187
187
|
* // Removes all selection's ranges.
|
|
@@ -202,7 +202,7 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
|
202
202
|
*
|
|
203
203
|
* // Sets selection to the given document selection.
|
|
204
204
|
* // Note: It doesn't copy selection attributes.
|
|
205
|
-
* const documentSelection = new
|
|
205
|
+
* const documentSelection = new ModelDocumentSelection( doc );
|
|
206
206
|
* selection.setTo( documentSelection );
|
|
207
207
|
*
|
|
208
208
|
* // Sets collapsed selection at the given position.
|
|
@@ -213,14 +213,14 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
|
213
213
|
* selection.setTo( paragraph, offset );
|
|
214
214
|
* ```
|
|
215
215
|
*
|
|
216
|
-
* Creates a range inside an {@link module:engine/model/element~
|
|
216
|
+
* Creates a range inside an {@link module:engine/model/element~ModelElement element} which starts before the first child of
|
|
217
217
|
* that element and ends after the last child of that element.
|
|
218
218
|
*
|
|
219
219
|
* ```ts
|
|
220
220
|
* selection.setTo( paragraph, 'in' );
|
|
221
221
|
* ```
|
|
222
222
|
*
|
|
223
|
-
* Creates a range on an {@link module:engine/model/item~
|
|
223
|
+
* Creates a range on an {@link module:engine/model/item~ModelItem item} which starts before the item and ends just after the item.
|
|
224
224
|
*
|
|
225
225
|
* ```ts
|
|
226
226
|
* selection.setTo( paragraph, 'on' );
|
|
@@ -234,38 +234,38 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
|
234
234
|
* ```
|
|
235
235
|
*/
|
|
236
236
|
setTo(...args: [
|
|
237
|
-
selectable:
|
|
238
|
-
placeOrOffset:
|
|
237
|
+
selectable: ModelNode,
|
|
238
|
+
placeOrOffset: ModelPlaceOrOffset,
|
|
239
239
|
options?: {
|
|
240
240
|
backward?: boolean;
|
|
241
241
|
}
|
|
242
242
|
] | [
|
|
243
|
-
selectable?: Exclude<
|
|
243
|
+
selectable?: Exclude<ModelSelectable, ModelNode>,
|
|
244
244
|
options?: {
|
|
245
245
|
backward?: boolean;
|
|
246
246
|
}
|
|
247
247
|
]): void;
|
|
248
248
|
/**
|
|
249
249
|
* Replaces all ranges that were added to the selection with given array of ranges. Last range of the array
|
|
250
|
-
* is treated like the last added range and is used to set {@link module:engine/model/selection~
|
|
251
|
-
* {@link module:engine/model/selection~
|
|
250
|
+
* is treated like the last added range and is used to set {@link module:engine/model/selection~ModelSelection#anchor} and
|
|
251
|
+
* {@link module:engine/model/selection~ModelSelection#focus}. Accepts a flag describing in which direction the selection is made.
|
|
252
252
|
*
|
|
253
253
|
* @fires change:range
|
|
254
254
|
* @param newRanges Ranges to set.
|
|
255
255
|
* @param isLastBackward Flag describing if last added range was selected forward - from start to end (`false`)
|
|
256
256
|
* or backward - from end to start (`true`).
|
|
257
257
|
*/
|
|
258
|
-
protected _setRanges(newRanges: Iterable<
|
|
258
|
+
protected _setRanges(newRanges: Iterable<ModelRange>, isLastBackward?: boolean): void;
|
|
259
259
|
/**
|
|
260
|
-
* Moves {@link module:engine/model/selection~
|
|
260
|
+
* Moves {@link module:engine/model/selection~ModelSelection#focus} to the specified location.
|
|
261
261
|
*
|
|
262
262
|
* The location can be specified in the same form as
|
|
263
|
-
* {@link module:engine/model/writer~
|
|
263
|
+
* {@link module:engine/model/writer~ModelWriter#createPositionAt writer.createPositionAt()} parameters.
|
|
264
264
|
*
|
|
265
265
|
* @fires change:range
|
|
266
|
-
* @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/model/item~
|
|
266
|
+
* @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/model/item~ModelItem model item}.
|
|
267
267
|
*/
|
|
268
|
-
setFocus(itemOrPosition:
|
|
268
|
+
setFocus(itemOrPosition: ModelItem | ModelPosition, offset?: ModelPositionOffset): void;
|
|
269
269
|
/**
|
|
270
270
|
* Gets an attribute value for given key or `undefined` if that attribute is not set on the selection.
|
|
271
271
|
*
|
|
@@ -313,13 +313,13 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
|
313
313
|
*/
|
|
314
314
|
setAttribute(key: string, value: unknown): void;
|
|
315
315
|
/**
|
|
316
|
-
* Returns the selected element. {@link module:engine/model/element~
|
|
316
|
+
* Returns the selected element. {@link module:engine/model/element~ModelElement Element} is considered as selected if there is only
|
|
317
317
|
* one range in the selection, and that range contains exactly one element.
|
|
318
318
|
* Returns `null` if there is no selected element.
|
|
319
319
|
*/
|
|
320
|
-
getSelectedElement():
|
|
320
|
+
getSelectedElement(): ModelElement | null;
|
|
321
321
|
/**
|
|
322
|
-
* Gets elements of type {@link module:engine/model/schema~
|
|
322
|
+
* Gets elements of type {@link module:engine/model/schema~ModelSchema#isBlock "block"} touched by the selection.
|
|
323
323
|
*
|
|
324
324
|
* This method's result can be used for example to apply block styling to all blocks covered by this selection.
|
|
325
325
|
*
|
|
@@ -381,30 +381,30 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
|
381
381
|
* <paragraph>]c</paragraph> // This block will not be returned
|
|
382
382
|
* ```
|
|
383
383
|
*/
|
|
384
|
-
getSelectedBlocks(): IterableIterator<
|
|
384
|
+
getSelectedBlocks(): IterableIterator<ModelElement>;
|
|
385
385
|
/**
|
|
386
386
|
* Checks whether the selection contains the entire content of the given element. This means that selection must start
|
|
387
|
-
* at a position {@link module:engine/model/position~
|
|
387
|
+
* at a position {@link module:engine/model/position~ModelPosition#isTouching touching} the element's start and ends at position
|
|
388
388
|
* touching the element's end.
|
|
389
389
|
*
|
|
390
390
|
* By default, this method will check whether the entire content of the selection's current root is selected.
|
|
391
391
|
* Useful to check if e.g. the user has just pressed <kbd>Ctrl</kbd> + <kbd>A</kbd>.
|
|
392
392
|
*/
|
|
393
|
-
containsEntireContent(element?:
|
|
393
|
+
containsEntireContent(element?: ModelElement): boolean;
|
|
394
394
|
/**
|
|
395
395
|
* Adds given range to internal {@link #_ranges ranges array}. Throws an error
|
|
396
396
|
* if given range is intersecting with any range that is already stored in this selection.
|
|
397
397
|
*/
|
|
398
|
-
protected _pushRange(range:
|
|
398
|
+
protected _pushRange(range: ModelRange): void;
|
|
399
399
|
/**
|
|
400
400
|
* Checks if given range intersects with ranges that are already in the selection. Throws an error if it does.
|
|
401
401
|
*/
|
|
402
|
-
protected _checkRange(range:
|
|
402
|
+
protected _checkRange(range: ModelRange): void;
|
|
403
403
|
/**
|
|
404
404
|
* Replaces all the ranges by the given ones.
|
|
405
405
|
* Uses {@link #_popRange _popRange} and {@link #_pushRange _pushRange} to ensure proper ranges removal and addition.
|
|
406
406
|
*/
|
|
407
|
-
protected _replaceAllRanges(ranges: Array<
|
|
407
|
+
protected _replaceAllRanges(ranges: Array<ModelRange>): void;
|
|
408
408
|
/**
|
|
409
409
|
* Deletes ranges from internal range array. Uses {@link #_popRange _popRange} to
|
|
410
410
|
* ensure proper ranges removal.
|
|
@@ -418,7 +418,7 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
|
418
418
|
/**
|
|
419
419
|
* Describes one of the events: `change:range` or `change:attribute`.
|
|
420
420
|
*/
|
|
421
|
-
export type
|
|
421
|
+
export type ModelSelectionChangeEvent = {
|
|
422
422
|
name: 'change' | 'change:range' | 'change:attribute';
|
|
423
423
|
args: [
|
|
424
424
|
{
|
|
@@ -430,16 +430,16 @@ export type SelectionChangeEvent = {
|
|
|
430
430
|
/**
|
|
431
431
|
* Fired when selection range(s) changed.
|
|
432
432
|
*
|
|
433
|
-
* @eventName ~
|
|
434
|
-
* @param directChange In case of {@link module:engine/model/selection~
|
|
433
|
+
* @eventName ~ModelSelection#change:range
|
|
434
|
+
* @param directChange In case of {@link module:engine/model/selection~ModelSelection} class it is always set
|
|
435
435
|
* to `true` which indicates that the selection change was caused by a direct use of selection's API.
|
|
436
|
-
* The {@link module:engine/model/documentselection~
|
|
437
|
-
* was directly changed through the {@link module:engine/model/writer~
|
|
436
|
+
* The {@link module:engine/model/documentselection~ModelDocumentSelection}, however, may change because its position
|
|
437
|
+
* was directly changed through the {@link module:engine/model/writer~ModelWriter writer} or because its position was
|
|
438
438
|
* changed because the structure of the model has been changed (which means an indirect change).
|
|
439
439
|
* The indirect change does not occur in case of normal (detached) selections because they are "static" (as "not live")
|
|
440
440
|
* which mean that they are not updated once the document changes.
|
|
441
441
|
*/
|
|
442
|
-
export type
|
|
442
|
+
export type ModelSelectionChangeRangeEvent = {
|
|
443
443
|
name: 'change' | 'change:range';
|
|
444
444
|
args: [
|
|
445
445
|
{
|
|
@@ -450,17 +450,17 @@ export type SelectionChangeRangeEvent = {
|
|
|
450
450
|
/**
|
|
451
451
|
* Fired when selection attribute changed.
|
|
452
452
|
*
|
|
453
|
-
* @eventName ~
|
|
454
|
-
* @param directChange In case of {@link module:engine/model/selection~
|
|
453
|
+
* @eventName ~ModelSelection#change:attribute
|
|
454
|
+
* @param directChange In case of {@link module:engine/model/selection~ModelSelection} class it is always set
|
|
455
455
|
* to `true` which indicates that the selection change was caused by a direct use of selection's API.
|
|
456
|
-
* The {@link module:engine/model/documentselection~
|
|
457
|
-
* were directly changed through the {@link module:engine/model/writer~
|
|
456
|
+
* The {@link module:engine/model/documentselection~ModelDocumentSelection}, however, may change because its attributes
|
|
457
|
+
* were directly changed through the {@link module:engine/model/writer~ModelWriter writer} or because its position was
|
|
458
458
|
* changed in the model and its attributes were refreshed (which means an indirect change).
|
|
459
459
|
* The indirect change does not occur in case of normal (detached) selections because they are "static" (as "not live")
|
|
460
460
|
* which mean that they are not updated once the document changes.
|
|
461
461
|
* @param attributeKeys Array containing keys of attributes that changed.
|
|
462
462
|
*/
|
|
463
|
-
export type
|
|
463
|
+
export type ModelSelectionChangeAttributeEvent = {
|
|
464
464
|
name: 'change' | 'change:attribute';
|
|
465
465
|
args: [
|
|
466
466
|
{
|
|
@@ -472,11 +472,11 @@ export type SelectionChangeAttributeEvent = {
|
|
|
472
472
|
/**
|
|
473
473
|
* An entity that is used to set selection.
|
|
474
474
|
*
|
|
475
|
-
* See also {@link module:engine/model/selection~
|
|
475
|
+
* See also {@link module:engine/model/selection~ModelSelection#setTo}.
|
|
476
476
|
*/
|
|
477
|
-
export type
|
|
477
|
+
export type ModelSelectable = ModelSelection | ModelDocumentSelection | ModelPosition | ModelRange | ModelNode | Iterable<ModelRange> | null;
|
|
478
478
|
/**
|
|
479
479
|
* The place or offset of the selection.
|
|
480
480
|
*/
|
|
481
|
-
export type
|
|
481
|
+
export type ModelPlaceOrOffset = number | 'before' | 'end' | 'after' | 'on' | 'in';
|
|
482
482
|
export {};
|