@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
|
@@ -5,51 +5,51 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/documentselection
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import type {
|
|
8
|
+
import { ModelTypeCheckable } from './typecheckable.js';
|
|
9
|
+
import { ModelSelection, type ModelSelectionChangeAttributeEvent, type ModelSelectionChangeRangeEvent } from './selection.js';
|
|
10
|
+
import type { ModelDocument } from './document.js';
|
|
11
11
|
import type { Marker } from './markercollection.js';
|
|
12
|
-
import type
|
|
13
|
-
import type
|
|
14
|
-
import type {
|
|
15
|
-
import type
|
|
12
|
+
import { type ModelElement } from './element.js';
|
|
13
|
+
import { type ModelItem } from './item.js';
|
|
14
|
+
import type { ModelPosition, ModelPositionOffset } from './position.js';
|
|
15
|
+
import { type ModelRange } from './range.js';
|
|
16
16
|
import { Collection } from '@ckeditor/ckeditor5-utils';
|
|
17
|
-
declare const
|
|
17
|
+
declare const ModelDocumentSelection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof ModelTypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
|
|
18
18
|
/**
|
|
19
|
-
* `
|
|
20
|
-
* {@link module:engine/model/document~
|
|
21
|
-
* There can be only one instance of `
|
|
19
|
+
* `ModelDocumentSelection` is a special selection which is used as the
|
|
20
|
+
* {@link module:engine/model/document~ModelDocument#selection document's selection}.
|
|
21
|
+
* There can be only one instance of `ModelDocumentSelection` per document.
|
|
22
22
|
*
|
|
23
|
-
* Document selection can only be changed by using the {@link module:engine/model/writer~
|
|
23
|
+
* Document selection can only be changed by using the {@link module:engine/model/writer~ModelWriter} instance
|
|
24
24
|
* inside the {@link module:engine/model/model~Model#change `change()`} block, as it provides a secure way to modify model.
|
|
25
25
|
*
|
|
26
|
-
* `
|
|
26
|
+
* `ModelDocumentSelection` is automatically updated upon changes in the {@link module:engine/model/document~ModelDocument document}
|
|
27
27
|
* to always contain valid ranges. Its attributes are inherited from the text unless set explicitly.
|
|
28
28
|
*
|
|
29
|
-
* Differences between {@link module:engine/model/selection~
|
|
30
|
-
* * there is always a range in `
|
|
29
|
+
* Differences between {@link module:engine/model/selection~ModelSelection} and `ModelDocumentSelection` are:
|
|
30
|
+
* * there is always a range in `ModelDocumentSelection` - even if no ranges were added there is a "default range"
|
|
31
31
|
* present in the selection,
|
|
32
32
|
* * ranges added to this selection updates automatically when the document changes,
|
|
33
|
-
* * attributes of `
|
|
33
|
+
* * attributes of `ModelDocumentSelection` are updated automatically according to selection ranges.
|
|
34
34
|
*
|
|
35
|
-
* Since `
|
|
36
|
-
* and is updated when {@link module:engine/model/document~
|
|
37
|
-
* changes, it cannot be set on {@link module:engine/model/node~
|
|
38
|
-
* that are inside {@link module:engine/model/documentfragment~
|
|
35
|
+
* Since `ModelDocumentSelection` uses {@link module:engine/model/liverange~ModelLiveRange live ranges}
|
|
36
|
+
* and is updated when {@link module:engine/model/document~ModelDocument document}
|
|
37
|
+
* changes, it cannot be set on {@link module:engine/model/node~ModelNode nodes}
|
|
38
|
+
* that are inside {@link module:engine/model/documentfragment~ModelDocumentFragment document fragment}.
|
|
39
39
|
* If you need to represent a selection in document fragment,
|
|
40
|
-
* use {@link module:engine/model/selection~
|
|
40
|
+
* use {@link module:engine/model/selection~ModelSelection Selection class} instead.
|
|
41
41
|
*/
|
|
42
|
-
export
|
|
42
|
+
export declare class ModelDocumentSelection extends /* #__PURE__ */ ModelDocumentSelection_base {
|
|
43
43
|
/**
|
|
44
|
-
* Selection used internally by that class (`
|
|
44
|
+
* Selection used internally by that class (`ModelDocumentSelection` is a proxy to that selection).
|
|
45
45
|
*/
|
|
46
46
|
private _selection;
|
|
47
47
|
/**
|
|
48
|
-
* Creates an empty live selection for given {@link module:engine/model/document~
|
|
48
|
+
* Creates an empty live selection for given {@link module:engine/model/document~ModelDocument}.
|
|
49
49
|
*
|
|
50
50
|
* @param doc Document which owns this selection.
|
|
51
51
|
*/
|
|
52
|
-
constructor(doc:
|
|
52
|
+
constructor(doc: ModelDocument);
|
|
53
53
|
/**
|
|
54
54
|
* Describes whether the selection is collapsed. Selection is collapsed when there is exactly one range which is
|
|
55
55
|
* collapsed.
|
|
@@ -58,14 +58,14 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
|
|
|
58
58
|
/**
|
|
59
59
|
* Selection anchor. Anchor may be described as a position where the most recent part of the selection starts.
|
|
60
60
|
* Together with {@link #focus} they define the direction of selection, which is important
|
|
61
|
-
* when expanding/shrinking selection. Anchor is always {@link module:engine/model/range~
|
|
62
|
-
* {@link module:engine/model/range~
|
|
61
|
+
* when expanding/shrinking selection. Anchor is always {@link module:engine/model/range~ModelRange#start start} or
|
|
62
|
+
* {@link module:engine/model/range~ModelRange#end end} position of the most recently added range.
|
|
63
63
|
*
|
|
64
64
|
* Is set to `null` if there are no ranges in selection.
|
|
65
65
|
*
|
|
66
66
|
* @see #focus
|
|
67
67
|
*/
|
|
68
|
-
get anchor():
|
|
68
|
+
get anchor(): ModelPosition | null;
|
|
69
69
|
/**
|
|
70
70
|
* Selection focus. Focus is a position where the selection ends.
|
|
71
71
|
*
|
|
@@ -73,14 +73,14 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
|
|
|
73
73
|
*
|
|
74
74
|
* @see #anchor
|
|
75
75
|
*/
|
|
76
|
-
get focus():
|
|
76
|
+
get focus(): ModelPosition | null;
|
|
77
77
|
/**
|
|
78
78
|
* Number of ranges in selection.
|
|
79
79
|
*/
|
|
80
80
|
get rangeCount(): number;
|
|
81
81
|
/**
|
|
82
82
|
* Describes whether `Documentselection` has own range(s) set, or if it is defaulted to
|
|
83
|
-
* {@link module:engine/model/document~
|
|
83
|
+
* {@link module:engine/model/document~ModelDocument#_getDefaultRange document's default range}.
|
|
84
84
|
*/
|
|
85
85
|
get hasOwnRange(): boolean;
|
|
86
86
|
/**
|
|
@@ -92,7 +92,7 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
|
|
|
92
92
|
*/
|
|
93
93
|
get isBackward(): boolean;
|
|
94
94
|
/**
|
|
95
|
-
* Describes whether the gravity is overridden (using {@link module:engine/model/writer~
|
|
95
|
+
* Describes whether the gravity is overridden (using {@link module:engine/model/writer~ModelWriter#overrideSelectionGravity}) or not.
|
|
96
96
|
*
|
|
97
97
|
* Note that the gravity remains overridden as long as will not be restored the same number of times as it was overridden.
|
|
98
98
|
*/
|
|
@@ -101,55 +101,55 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
|
|
|
101
101
|
* A collection of selection {@link module:engine/model/markercollection~Marker markers}.
|
|
102
102
|
* Marker is a selection marker when selection range is inside the marker range.
|
|
103
103
|
*
|
|
104
|
-
* **Note**: Only markers from {@link ~
|
|
104
|
+
* **Note**: Only markers from {@link ~ModelDocumentSelection#observeMarkers observed markers groups} are collected.
|
|
105
105
|
*/
|
|
106
106
|
get markers(): Collection<Marker>;
|
|
107
107
|
/**
|
|
108
|
-
* Used for the compatibility with the {@link module:engine/model/selection~
|
|
108
|
+
* Used for the compatibility with the {@link module:engine/model/selection~ModelSelection#isEqual} method.
|
|
109
109
|
*
|
|
110
110
|
* @internal
|
|
111
111
|
*/
|
|
112
|
-
get _ranges(): Array<
|
|
112
|
+
get _ranges(): Array<ModelRange>;
|
|
113
113
|
/**
|
|
114
114
|
* Returns an iterable that iterates over copies of selection ranges.
|
|
115
115
|
*/
|
|
116
|
-
getRanges(): IterableIterator<
|
|
116
|
+
getRanges(): IterableIterator<ModelRange>;
|
|
117
117
|
/**
|
|
118
118
|
* Returns the first position in the selection.
|
|
119
|
-
* First position is the position that {@link module:engine/model/position~
|
|
119
|
+
* First position is the position that {@link module:engine/model/position~ModelPosition#isBefore is before}
|
|
120
120
|
* any other position in the selection.
|
|
121
121
|
*
|
|
122
122
|
* Returns `null` if there are no ranges in selection.
|
|
123
123
|
*/
|
|
124
|
-
getFirstPosition():
|
|
124
|
+
getFirstPosition(): ModelPosition | null;
|
|
125
125
|
/**
|
|
126
126
|
* Returns the last position in the selection.
|
|
127
|
-
* Last position is the position that {@link module:engine/model/position~
|
|
127
|
+
* Last position is the position that {@link module:engine/model/position~ModelPosition#isAfter is after}
|
|
128
128
|
* any other position in the selection.
|
|
129
129
|
*
|
|
130
130
|
* Returns `null` if there are no ranges in selection.
|
|
131
131
|
*/
|
|
132
|
-
getLastPosition():
|
|
132
|
+
getLastPosition(): ModelPosition | null;
|
|
133
133
|
/**
|
|
134
134
|
* Returns a copy of the first range in the selection.
|
|
135
|
-
* First range is the one which {@link module:engine/model/range~
|
|
136
|
-
* {@link module:engine/model/position~
|
|
135
|
+
* First range is the one which {@link module:engine/model/range~ModelRange#start start} position
|
|
136
|
+
* {@link module:engine/model/position~ModelPosition#isBefore is before} start position of all other ranges
|
|
137
137
|
* (not to confuse with the first range added to the selection).
|
|
138
138
|
*
|
|
139
139
|
* Returns `null` if there are no ranges in selection.
|
|
140
140
|
*/
|
|
141
|
-
getFirstRange():
|
|
141
|
+
getFirstRange(): ModelRange | null;
|
|
142
142
|
/**
|
|
143
143
|
* Returns a copy of the last range in the selection.
|
|
144
|
-
* Last range is the one which {@link module:engine/model/range~
|
|
145
|
-
* {@link module:engine/model/position~
|
|
146
|
-
* recently added to the selection).
|
|
144
|
+
* Last range is the one which {@link module:engine/model/range~ModelRange#end end} position
|
|
145
|
+
* {@link module:engine/model/position~ModelPosition#isAfter is after} end position of all
|
|
146
|
+
* other ranges (not to confuse with the range most recently added to the selection).
|
|
147
147
|
*
|
|
148
148
|
* Returns `null` if there are no ranges in selection.
|
|
149
149
|
*/
|
|
150
|
-
getLastRange():
|
|
150
|
+
getLastRange(): ModelRange | null;
|
|
151
151
|
/**
|
|
152
|
-
* Gets elements of type {@link module:engine/model/schema~
|
|
152
|
+
* Gets elements of type {@link module:engine/model/schema~ModelSchema#isBlock "block"} touched by the selection.
|
|
153
153
|
*
|
|
154
154
|
* This method's result can be used for example to apply block styling to all blocks covered by this selection.
|
|
155
155
|
*
|
|
@@ -201,22 +201,22 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
|
|
|
201
201
|
* <paragraph>]c</paragraph> // this block will not be returned
|
|
202
202
|
* ```
|
|
203
203
|
*/
|
|
204
|
-
getSelectedBlocks(): IterableIterator<
|
|
204
|
+
getSelectedBlocks(): IterableIterator<ModelElement>;
|
|
205
205
|
/**
|
|
206
|
-
* Returns the selected element. {@link module:engine/model/element~
|
|
206
|
+
* Returns the selected element. {@link module:engine/model/element~ModelElement Element} is considered as selected if there is only
|
|
207
207
|
* one range in the selection, and that range contains exactly one element.
|
|
208
208
|
* Returns `null` if there is no selected element.
|
|
209
209
|
*/
|
|
210
|
-
getSelectedElement():
|
|
210
|
+
getSelectedElement(): ModelElement | null;
|
|
211
211
|
/**
|
|
212
212
|
* Checks whether the selection contains the entire content of the given element. This means that selection must start
|
|
213
|
-
* at a position {@link module:engine/model/position~
|
|
213
|
+
* at a position {@link module:engine/model/position~ModelPosition#isTouching touching} the element's start and ends at position
|
|
214
214
|
* touching the element's end.
|
|
215
215
|
*
|
|
216
216
|
* By default, this method will check whether the entire content of the selection's current root is selected.
|
|
217
217
|
* Useful to check if e.g. the user has just pressed <kbd>Ctrl</kbd> + <kbd>A</kbd>.
|
|
218
218
|
*/
|
|
219
|
-
containsEntireContent(element:
|
|
219
|
+
containsEntireContent(element: ModelElement): boolean;
|
|
220
220
|
/**
|
|
221
221
|
* Unbinds all events previously bound by document selection.
|
|
222
222
|
*/
|
|
@@ -252,7 +252,7 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
|
|
|
252
252
|
refresh(): void;
|
|
253
253
|
/**
|
|
254
254
|
* Registers a marker group prefix or a marker name to be collected in the
|
|
255
|
-
* {@link ~
|
|
255
|
+
* {@link ~ModelDocumentSelection#markers selection markers collection}.
|
|
256
256
|
*
|
|
257
257
|
* See also {@link module:engine/model/markercollection~MarkerCollection#getMarkersGroup `MarkerCollection#getMarkersGroup()`}.
|
|
258
258
|
*
|
|
@@ -260,32 +260,32 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
|
|
|
260
260
|
*/
|
|
261
261
|
observeMarkers(prefixOrName: string): void;
|
|
262
262
|
/**
|
|
263
|
-
* Moves {@link module:engine/model/documentselection~
|
|
264
|
-
* Should be used only within the {@link module:engine/model/writer~
|
|
263
|
+
* Moves {@link module:engine/model/documentselection~ModelDocumentSelection#focus} to the specified location.
|
|
264
|
+
* Should be used only within the {@link module:engine/model/writer~ModelWriter#setSelectionFocus} method.
|
|
265
265
|
*
|
|
266
266
|
* The location can be specified in the same form as
|
|
267
|
-
* {@link module:engine/model/writer~
|
|
267
|
+
* {@link module:engine/model/writer~ModelWriter#createPositionAt writer.createPositionAt()} parameters.
|
|
268
268
|
*
|
|
269
|
-
* @see module:engine/model/writer~
|
|
269
|
+
* @see module:engine/model/writer~ModelWriter#setSelectionFocus
|
|
270
270
|
* @internal
|
|
271
271
|
* @param offset Offset or one of the flags. Used only when
|
|
272
|
-
* first parameter is a {@link module:engine/model/item~
|
|
272
|
+
* first parameter is a {@link module:engine/model/item~ModelItem model item}.
|
|
273
273
|
*/
|
|
274
|
-
_setFocus(itemOrPosition:
|
|
274
|
+
_setFocus(itemOrPosition: ModelItem | ModelPosition, offset?: ModelPositionOffset): void;
|
|
275
275
|
/**
|
|
276
276
|
* Sets this selection's ranges and direction to the specified location based on the given
|
|
277
|
-
* {@link module:engine/model/selection~
|
|
278
|
-
* Should be used only within the {@link module:engine/model/writer~
|
|
277
|
+
* {@link module:engine/model/selection~ModelSelectable selectable}.
|
|
278
|
+
* Should be used only within the {@link module:engine/model/writer~ModelWriter#setSelection} method.
|
|
279
279
|
*
|
|
280
|
-
* @see module:engine/model/writer~
|
|
280
|
+
* @see module:engine/model/writer~ModelWriter#setSelection
|
|
281
281
|
* @internal
|
|
282
282
|
*/
|
|
283
|
-
_setTo(...args: Parameters<
|
|
283
|
+
_setTo(...args: Parameters<ModelSelection['setTo']>): void;
|
|
284
284
|
/**
|
|
285
285
|
* Sets attribute on the selection. If attribute with the same key already is set, it's value is overwritten.
|
|
286
|
-
* Should be used only within the {@link module:engine/model/writer~
|
|
286
|
+
* Should be used only within the {@link module:engine/model/writer~ModelWriter#setSelectionAttribute} method.
|
|
287
287
|
*
|
|
288
|
-
* @see module:engine/model/writer~
|
|
288
|
+
* @see module:engine/model/writer~ModelWriter#setSelectionAttribute
|
|
289
289
|
* @internal
|
|
290
290
|
* @param key Key of the attribute to set.
|
|
291
291
|
* @param value Attribute value.
|
|
@@ -293,11 +293,11 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
|
|
|
293
293
|
_setAttribute(key: string, value: unknown): void;
|
|
294
294
|
/**
|
|
295
295
|
* Removes an attribute with given key from the selection.
|
|
296
|
-
* If the given attribute was set on the selection, fires the {@link module:engine/model/selection~
|
|
296
|
+
* If the given attribute was set on the selection, fires the {@link module:engine/model/selection~ModelSelection#event:change:range}
|
|
297
297
|
* event with removed attribute key.
|
|
298
|
-
* Should be used only within the {@link module:engine/model/writer~
|
|
298
|
+
* Should be used only within the {@link module:engine/model/writer~ModelWriter#removeSelectionAttribute} method.
|
|
299
299
|
*
|
|
300
|
-
* @see module:engine/model/writer~
|
|
300
|
+
* @see module:engine/model/writer~ModelWriter#removeSelectionAttribute
|
|
301
301
|
* @internal
|
|
302
302
|
* @param key Key of the attribute to remove.
|
|
303
303
|
*/
|
|
@@ -318,19 +318,19 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
|
|
|
318
318
|
* It returns an unique identifier which is required to restore the gravity. It guarantees the symmetry
|
|
319
319
|
* of the process.
|
|
320
320
|
*
|
|
321
|
-
* @see module:engine/model/writer~
|
|
321
|
+
* @see module:engine/model/writer~ModelWriter#overrideSelectionGravity
|
|
322
322
|
* @internal
|
|
323
323
|
* @returns The unique id which allows restoring the gravity.
|
|
324
324
|
*/
|
|
325
325
|
_overrideGravity(): string;
|
|
326
326
|
/**
|
|
327
|
-
* Restores the {@link ~
|
|
327
|
+
* Restores the {@link ~ModelDocumentSelection#_overrideGravity overridden gravity}.
|
|
328
328
|
*
|
|
329
329
|
* Restoring the gravity is only possible using the unique identifier returned by
|
|
330
|
-
* {@link ~
|
|
330
|
+
* {@link ~ModelDocumentSelection#_overrideGravity}. Note that the gravity remains overridden as long as won't be restored
|
|
331
331
|
* the same number of times it was overridden.
|
|
332
332
|
*
|
|
333
|
-
* @see module:engine/model/writer~
|
|
333
|
+
* @see module:engine/model/writer~ModelWriter#restoreSelectionGravity
|
|
334
334
|
* @internal
|
|
335
335
|
* @param uid The unique id returned by {@link #_overrideGravity}.
|
|
336
336
|
*/
|
|
@@ -353,41 +353,41 @@ export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection
|
|
|
353
353
|
/**
|
|
354
354
|
* Fired when selection range(s) changed.
|
|
355
355
|
*
|
|
356
|
-
* @eventName ~
|
|
357
|
-
* @param directChange In case of {@link module:engine/model/selection~
|
|
356
|
+
* @eventName ~ModelDocumentSelection#change:range
|
|
357
|
+
* @param directChange In case of {@link module:engine/model/selection~ModelSelection} class it is always set
|
|
358
358
|
* to `true` which indicates that the selection change was caused by a direct use of selection's API.
|
|
359
|
-
* The {@link module:engine/model/documentselection~
|
|
360
|
-
* was directly changed through the {@link module:engine/model/writer~
|
|
359
|
+
* The {@link module:engine/model/documentselection~ModelDocumentSelection}, however, may change because its position
|
|
360
|
+
* was directly changed through the {@link module:engine/model/writer~ModelWriter writer} or because its position was
|
|
361
361
|
* changed because the structure of the model has been changed (which means an indirect change).
|
|
362
362
|
* The indirect change does not occur in case of normal (detached) selections because they are "static" (as "not live")
|
|
363
363
|
* which mean that they are not updated once the document changes.
|
|
364
364
|
*/
|
|
365
|
-
export type
|
|
365
|
+
export type ModelDocumentSelectionChangeRangeEvent = ModelSelectionChangeRangeEvent;
|
|
366
366
|
/**
|
|
367
367
|
* Fired when selection attribute changed.
|
|
368
368
|
*
|
|
369
|
-
* @eventName ~
|
|
370
|
-
* @param directChange In case of {@link module:engine/model/selection~
|
|
369
|
+
* @eventName ~ModelDocumentSelection#change:attribute
|
|
370
|
+
* @param directChange In case of {@link module:engine/model/selection~ModelSelection} class it is always set
|
|
371
371
|
* to `true` which indicates that the selection change was caused by a direct use of selection's API.
|
|
372
|
-
* The {@link module:engine/model/documentselection~
|
|
373
|
-
* were directly changed through the {@link module:engine/model/writer~
|
|
372
|
+
* The {@link module:engine/model/documentselection~ModelDocumentSelection}, however, may change because its attributes
|
|
373
|
+
* were directly changed through the {@link module:engine/model/writer~ModelWriter writer} or because its position was
|
|
374
374
|
* changed in the model and its attributes were refreshed (which means an indirect change).
|
|
375
375
|
* The indirect change does not occur in case of normal (detached) selections because they are "static" (as "not live")
|
|
376
376
|
* which mean that they are not updated once the document changes.
|
|
377
377
|
* @param attributeKeys Array containing keys of attributes that changed.
|
|
378
378
|
*/
|
|
379
|
-
export type
|
|
379
|
+
export type ModelDocumentSelectionChangeAttributeEvent = ModelSelectionChangeAttributeEvent;
|
|
380
380
|
/**
|
|
381
381
|
* Fired when selection marker(s) changed.
|
|
382
382
|
*
|
|
383
|
-
* @eventName ~
|
|
383
|
+
* @eventName ~ModelDocumentSelection#change:marker
|
|
384
384
|
* @param directChange This is always set to `false` in case of `change:marker` event as there is no possibility
|
|
385
|
-
* to change markers directly through {@link module:engine/model/documentselection~
|
|
386
|
-
* See also {@link module:engine/model/documentselection~
|
|
387
|
-
* {@link module:engine/model/documentselection~
|
|
385
|
+
* to change markers directly through {@link module:engine/model/documentselection~ModelDocumentSelection} API.
|
|
386
|
+
* See also {@link module:engine/model/documentselection~ModelDocumentSelection#event:change:range} and
|
|
387
|
+
* {@link module:engine/model/documentselection~ModelDocumentSelection#event:change:attribute}.
|
|
388
388
|
* @param oldMarkers Markers in which the selection was before the change.
|
|
389
389
|
*/
|
|
390
|
-
export type
|
|
390
|
+
export type ModelDocumentSelectionChangeMarkerEvent = {
|
|
391
391
|
name: 'change:marker';
|
|
392
392
|
args: [
|
|
393
393
|
{
|
|
@@ -399,15 +399,15 @@ export type DocumentSelectionChangeMarkerEvent = {
|
|
|
399
399
|
/**
|
|
400
400
|
* Fired when selection range(s), attribute(s) or marker(s) changed.
|
|
401
401
|
*
|
|
402
|
-
* @eventName ~
|
|
402
|
+
* @eventName ~ModelDocumentSelection#change
|
|
403
403
|
* @param directChange This is always set to `false` in case of `change:marker` event as there is no possibility
|
|
404
|
-
* to change markers directly through {@link module:engine/model/documentselection~
|
|
405
|
-
* See also {@link module:engine/model/documentselection~
|
|
406
|
-
* {@link module:engine/model/documentselection~
|
|
404
|
+
* to change markers directly through {@link module:engine/model/documentselection~ModelDocumentSelection} API.
|
|
405
|
+
* See also {@link module:engine/model/documentselection~ModelDocumentSelection#event:change:range} and
|
|
406
|
+
* {@link module:engine/model/documentselection~ModelDocumentSelection#event:change:attribute}.
|
|
407
407
|
* @param attributeKeys Array containing keys of attributes that changed.
|
|
408
408
|
* @param oldMarkers Markers in which the selection was before the change.
|
|
409
409
|
*/
|
|
410
|
-
export type
|
|
410
|
+
export type ModelDocumentSelectionChangeEvent = {
|
|
411
411
|
name: 'change' | 'change:attribute' | 'change:marker' | 'change:range';
|
|
412
412
|
args: [
|
|
413
413
|
{
|