@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
|
@@ -6,24 +6,24 @@
|
|
|
6
6
|
* @module engine/model/typecheckable
|
|
7
7
|
*/
|
|
8
8
|
import type { Marker } from './markercollection.js';
|
|
9
|
-
import type
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
12
|
-
import type
|
|
13
|
-
import type
|
|
14
|
-
import type
|
|
15
|
-
import type
|
|
16
|
-
import type
|
|
17
|
-
import type
|
|
18
|
-
import type
|
|
19
|
-
import type
|
|
20
|
-
import type
|
|
21
|
-
export
|
|
9
|
+
import { type ModelDocumentFragment } from './documentfragment.js';
|
|
10
|
+
import { type ModelDocumentSelection } from './documentselection.js';
|
|
11
|
+
import { type ModelElement } from './element.js';
|
|
12
|
+
import { type ModelLivePosition } from './liveposition.js';
|
|
13
|
+
import { type ModelLiveRange } from './liverange.js';
|
|
14
|
+
import { type ModelNode } from './node.js';
|
|
15
|
+
import { type ModelPosition } from './position.js';
|
|
16
|
+
import { type ModelRange } from './range.js';
|
|
17
|
+
import { type ModelRootElement } from './rootelement.js';
|
|
18
|
+
import { type ModelSelection } from './selection.js';
|
|
19
|
+
import { type ModelText } from './text.js';
|
|
20
|
+
import { type ModelTextProxy } from './textproxy.js';
|
|
21
|
+
export declare abstract class ModelTypeCheckable {
|
|
22
22
|
/**
|
|
23
|
-
* Checks whether the object is of type {@link module:engine/model/node~
|
|
23
|
+
* Checks whether the object is of type {@link module:engine/model/node~ModelNode} or its subclass.
|
|
24
24
|
*
|
|
25
25
|
* This method is useful when processing model objects that are of unknown type. For example, a function
|
|
26
|
-
* may return a {@link module:engine/model/documentfragment~
|
|
26
|
+
* may return a {@link module:engine/model/documentfragment~ModelDocumentFragment} or a {@link module:engine/model/node~ModelNode}
|
|
27
27
|
* that can be either a text node or an element. This method can be used to check what kind of object is returned.
|
|
28
28
|
*
|
|
29
29
|
* ```ts
|
|
@@ -50,9 +50,9 @@ export default abstract class TypeCheckable {
|
|
|
50
50
|
*
|
|
51
51
|
* @label NODE
|
|
52
52
|
*/
|
|
53
|
-
is(type: 'node' | 'model:node'): this is
|
|
53
|
+
is(type: 'node' | 'model:node'): this is ModelNode | ModelElement | ModelText | ModelRootElement;
|
|
54
54
|
/**
|
|
55
|
-
* Checks whether the object is of type {@link module:engine/model/element~
|
|
55
|
+
* Checks whether the object is of type {@link module:engine/model/element~ModelElement} or its subclass.
|
|
56
56
|
*
|
|
57
57
|
* ```ts
|
|
58
58
|
* element.is( 'element' ); // -> true
|
|
@@ -65,7 +65,7 @@ export default abstract class TypeCheckable {
|
|
|
65
65
|
* ```
|
|
66
66
|
*
|
|
67
67
|
* Assuming that the object being checked is an element, you can also check its
|
|
68
|
-
* {@link module:engine/model/element~
|
|
68
|
+
* {@link module:engine/model/element~ModelElement#name name}:
|
|
69
69
|
*
|
|
70
70
|
* ```ts
|
|
71
71
|
* element.is( 'element', 'imageBlock' ); // -> true if this is an <imageBlock> element
|
|
@@ -74,9 +74,9 @@ export default abstract class TypeCheckable {
|
|
|
74
74
|
*
|
|
75
75
|
* @label ELEMENT
|
|
76
76
|
*/
|
|
77
|
-
is(type: 'element' | 'model:element'): this is
|
|
77
|
+
is(type: 'element' | 'model:element'): this is ModelElement | ModelRootElement;
|
|
78
78
|
/**
|
|
79
|
-
* Checks whether the object is of type {@link module:engine/model/rootelement~
|
|
79
|
+
* Checks whether the object is of type {@link module:engine/model/rootelement~ModelRootElement}.
|
|
80
80
|
*
|
|
81
81
|
* ```ts
|
|
82
82
|
* rootElement.is( 'rootElement' ); // -> true
|
|
@@ -91,7 +91,7 @@ export default abstract class TypeCheckable {
|
|
|
91
91
|
* ```
|
|
92
92
|
*
|
|
93
93
|
* Assuming that the object being checked is an element, you can also check its
|
|
94
|
-
* {@link module:engine/model/element~
|
|
94
|
+
* {@link module:engine/model/element~ModelElement#name name}:
|
|
95
95
|
*
|
|
96
96
|
* ```ts
|
|
97
97
|
* rootElement.is( 'rootElement', '$root' ); // -> same as above
|
|
@@ -99,9 +99,9 @@ export default abstract class TypeCheckable {
|
|
|
99
99
|
*
|
|
100
100
|
* @label ROOT_ELEMENT
|
|
101
101
|
*/
|
|
102
|
-
is(type: 'rootElement' | 'model:rootElement'): this is
|
|
102
|
+
is(type: 'rootElement' | 'model:rootElement'): this is ModelRootElement;
|
|
103
103
|
/**
|
|
104
|
-
* Checks whether the object is of type {@link module:engine/model/text~
|
|
104
|
+
* Checks whether the object is of type {@link module:engine/model/text~ModelText}.
|
|
105
105
|
*
|
|
106
106
|
* ```ts
|
|
107
107
|
* text.is( '$text' ); // -> true
|
|
@@ -118,9 +118,9 @@ export default abstract class TypeCheckable {
|
|
|
118
118
|
*
|
|
119
119
|
* @label TEXT
|
|
120
120
|
*/
|
|
121
|
-
is(type: '$text' | 'model:$text'): this is
|
|
121
|
+
is(type: '$text' | 'model:$text'): this is ModelText;
|
|
122
122
|
/**
|
|
123
|
-
* Checks whether the object is of type {@link module:engine/model/position~
|
|
123
|
+
* Checks whether the object is of type {@link module:engine/model/position~ModelPosition} or its subclass.
|
|
124
124
|
*
|
|
125
125
|
* ```ts
|
|
126
126
|
* position.is( 'position' ); // -> true
|
|
@@ -132,9 +132,9 @@ export default abstract class TypeCheckable {
|
|
|
132
132
|
*
|
|
133
133
|
* @label POSITION
|
|
134
134
|
*/
|
|
135
|
-
is(type: 'position' | 'model:position'): this is
|
|
135
|
+
is(type: 'position' | 'model:position'): this is ModelPosition | ModelLivePosition;
|
|
136
136
|
/**
|
|
137
|
-
* Checks whether the object is of type {@link module:engine/model/liveposition~
|
|
137
|
+
* Checks whether the object is of type {@link module:engine/model/liveposition~ModelLivePosition}.
|
|
138
138
|
*
|
|
139
139
|
* ```ts
|
|
140
140
|
* livePosition.is( 'position' ); // -> true
|
|
@@ -148,9 +148,9 @@ export default abstract class TypeCheckable {
|
|
|
148
148
|
*
|
|
149
149
|
* @label LIVE_POSITION
|
|
150
150
|
*/
|
|
151
|
-
is(type: 'livePosition' | 'model:livePosition'): this is
|
|
151
|
+
is(type: 'livePosition' | 'model:livePosition'): this is ModelLivePosition;
|
|
152
152
|
/**
|
|
153
|
-
* Checks whether the object is of type {@link module:engine/model/range~
|
|
153
|
+
* Checks whether the object is of type {@link module:engine/model/range~ModelRange} or its subclass.
|
|
154
154
|
*
|
|
155
155
|
* ```ts
|
|
156
156
|
* range.is( 'range' ); // -> true
|
|
@@ -162,9 +162,9 @@ export default abstract class TypeCheckable {
|
|
|
162
162
|
*
|
|
163
163
|
* @label RANGE
|
|
164
164
|
*/
|
|
165
|
-
is(type: 'range' | 'model:range'): this is
|
|
165
|
+
is(type: 'range' | 'model:range'): this is ModelRange | ModelLiveRange;
|
|
166
166
|
/**
|
|
167
|
-
* Checks whether the object is of type {@link module:engine/model/liverange~
|
|
167
|
+
* Checks whether the object is of type {@link module:engine/model/liverange~ModelLiveRange}.
|
|
168
168
|
*
|
|
169
169
|
* ```ts
|
|
170
170
|
* liveRange.is( 'range' ); // -> true
|
|
@@ -178,9 +178,9 @@ export default abstract class TypeCheckable {
|
|
|
178
178
|
*
|
|
179
179
|
* @label LIVE_RANGE
|
|
180
180
|
*/
|
|
181
|
-
is(type: 'liveRange' | 'model:liveRange'): this is
|
|
181
|
+
is(type: 'liveRange' | 'model:liveRange'): this is ModelLiveRange;
|
|
182
182
|
/**
|
|
183
|
-
* Checks whether the object is of type {@link module:engine/model/documentfragment~
|
|
183
|
+
* Checks whether the object is of type {@link module:engine/model/documentfragment~ModelDocumentFragment}.
|
|
184
184
|
*
|
|
185
185
|
* ```ts
|
|
186
186
|
* docFrag.is( 'documentFragment' ); // -> true
|
|
@@ -193,10 +193,10 @@ export default abstract class TypeCheckable {
|
|
|
193
193
|
*
|
|
194
194
|
* @label DOCUMENT_FRAGMENT
|
|
195
195
|
*/
|
|
196
|
-
is(type: 'documentFragment' | 'model:documentFragment'): this is
|
|
196
|
+
is(type: 'documentFragment' | 'model:documentFragment'): this is ModelDocumentFragment;
|
|
197
197
|
/**
|
|
198
|
-
* Checks whether the object is of type {@link module:engine/model/selection~
|
|
199
|
-
* or {@link module:engine/model/documentselection~
|
|
198
|
+
* Checks whether the object is of type {@link module:engine/model/selection~ModelSelection}
|
|
199
|
+
* or {@link module:engine/model/documentselection~ModelDocumentSelection}.
|
|
200
200
|
*
|
|
201
201
|
* ```ts
|
|
202
202
|
* selection.is( 'selection' ); // -> true
|
|
@@ -208,9 +208,9 @@ export default abstract class TypeCheckable {
|
|
|
208
208
|
*
|
|
209
209
|
* @label SELECTION
|
|
210
210
|
*/
|
|
211
|
-
is(type: 'selection' | 'model:selection'): this is
|
|
211
|
+
is(type: 'selection' | 'model:selection'): this is ModelSelection | ModelDocumentSelection;
|
|
212
212
|
/**
|
|
213
|
-
* Checks whether the object is of type {@link module:engine/model/documentselection~
|
|
213
|
+
* Checks whether the object is of type {@link module:engine/model/documentselection~ModelDocumentSelection}.
|
|
214
214
|
*
|
|
215
215
|
* ```ts
|
|
216
216
|
* selection.is( 'selection' ); // -> true
|
|
@@ -225,7 +225,7 @@ export default abstract class TypeCheckable {
|
|
|
225
225
|
*
|
|
226
226
|
* @label DOCUMENT_SELECTION
|
|
227
227
|
*/
|
|
228
|
-
is(type: 'documentSelection' | 'model:documentSelection'): this is
|
|
228
|
+
is(type: 'documentSelection' | 'model:documentSelection'): this is ModelDocumentSelection;
|
|
229
229
|
/**
|
|
230
230
|
* Checks whether the object is of type {@link module:engine/model/markercollection~Marker}.
|
|
231
231
|
*
|
|
@@ -241,7 +241,7 @@ export default abstract class TypeCheckable {
|
|
|
241
241
|
*/
|
|
242
242
|
is(type: 'marker' | 'model:marker'): this is Marker;
|
|
243
243
|
/**
|
|
244
|
-
* Checks whether the object is of type {@link module:engine/model/textproxy~
|
|
244
|
+
* Checks whether the object is of type {@link module:engine/model/textproxy~ModelTextProxy}.
|
|
245
245
|
*
|
|
246
246
|
* ```ts
|
|
247
247
|
* textProxy.is( '$textProxy' ); // -> true
|
|
@@ -256,9 +256,9 @@ export default abstract class TypeCheckable {
|
|
|
256
256
|
*
|
|
257
257
|
* @label TEXT_PROXY
|
|
258
258
|
*/
|
|
259
|
-
is(type: '$textProxy' | 'model:$textProxy'): this is
|
|
259
|
+
is(type: '$textProxy' | 'model:$textProxy'): this is ModelTextProxy;
|
|
260
260
|
/**
|
|
261
|
-
* Checks whether the object is of type {@link module:engine/model/element~
|
|
261
|
+
* Checks whether the object is of type {@link module:engine/model/element~ModelElement} or its subclass and has the specified `name`.
|
|
262
262
|
*
|
|
263
263
|
* ```ts
|
|
264
264
|
* element.is( 'element', 'imageBlock' ); // -> true if this is an <imageBlock> element
|
|
@@ -267,11 +267,11 @@ export default abstract class TypeCheckable {
|
|
|
267
267
|
*
|
|
268
268
|
* @label ELEMENT_NAME
|
|
269
269
|
*/
|
|
270
|
-
is<N extends string>(type: 'element' | 'model:element', name: N): this is (
|
|
270
|
+
is<N extends string>(type: 'element' | 'model:element', name: N): this is (ModelElement | ModelRootElement) & {
|
|
271
271
|
name: N;
|
|
272
272
|
};
|
|
273
273
|
/**
|
|
274
|
-
* Checks whether the object is of type {@link module:engine/model/rootelement~
|
|
274
|
+
* Checks whether the object is of type {@link module:engine/model/rootelement~ModelRootElement} and has the specified `name`.
|
|
275
275
|
*
|
|
276
276
|
* ```ts
|
|
277
277
|
* rootElement.is( 'rootElement', '$root' );
|
|
@@ -279,7 +279,7 @@ export default abstract class TypeCheckable {
|
|
|
279
279
|
*
|
|
280
280
|
* @label ROOT_ELEMENT_NAME
|
|
281
281
|
*/
|
|
282
|
-
is<N extends string>(type: 'rootElement' | 'model:rootElement', name: N): this is
|
|
282
|
+
is<N extends string>(type: 'rootElement' | 'model:rootElement', name: N): this is ModelRootElement & {
|
|
283
283
|
name: N;
|
|
284
284
|
};
|
|
285
285
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export class ModelTypeCheckable {
|
|
6
6
|
/* istanbul ignore next -- @preserve */
|
|
7
7
|
is() {
|
|
8
8
|
// There are a lot of overloads above.
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
6
|
-
import type
|
|
7
|
-
import type
|
|
8
|
-
import type
|
|
5
|
+
import { type ModelNode } from '../node.js';
|
|
6
|
+
import { type ModelPosition } from '../position.js';
|
|
7
|
+
import { type ModelSchema } from '../schema.js';
|
|
8
|
+
import { type ModelWriter } from '../writer.js';
|
|
9
9
|
/**
|
|
10
10
|
* @module engine/model/utils/autoparagraphing
|
|
11
11
|
*/
|
|
@@ -16,7 +16,7 @@ import type Writer from '../writer.js';
|
|
|
16
16
|
* @param writer The model writer.
|
|
17
17
|
* @returns `true` if any change has been applied, `false` otherwise.
|
|
18
18
|
*/
|
|
19
|
-
export declare function autoParagraphEmptyRoots(writer:
|
|
19
|
+
export declare function autoParagraphEmptyRoots(writer: ModelWriter): boolean;
|
|
20
20
|
/**
|
|
21
21
|
* Checks if the given node wrapped with a paragraph would be accepted by the schema in the given position.
|
|
22
22
|
*
|
|
@@ -25,7 +25,7 @@ export declare function autoParagraphEmptyRoots(writer: Writer): boolean;
|
|
|
25
25
|
* @param nodeOrType The child node or child type to check.
|
|
26
26
|
* @param schema A schema instance used for element validation.
|
|
27
27
|
*/
|
|
28
|
-
export declare function isParagraphable(position:
|
|
28
|
+
export declare function isParagraphable(position: ModelPosition, nodeOrType: ModelNode | string, schema: ModelSchema): boolean;
|
|
29
29
|
/**
|
|
30
30
|
* Inserts a new paragraph at the given position and returns a position inside that paragraph.
|
|
31
31
|
*
|
|
@@ -34,4 +34,4 @@ export declare function isParagraphable(position: Position, nodeOrType: Node | s
|
|
|
34
34
|
* @param writer The model writer.
|
|
35
35
|
* @returns Position inside the created paragraph.
|
|
36
36
|
*/
|
|
37
|
-
export declare function wrapInParagraph(position:
|
|
37
|
+
export declare function wrapInParagraph(position: ModelPosition, writer: ModelWriter): ModelPosition;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/utils/deletecontent
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import type Model from '../model.js';
|
|
10
|
-
import type
|
|
8
|
+
import { ModelDocumentSelection } from '../documentselection.js';
|
|
9
|
+
import { type Model } from '../model.js';
|
|
10
|
+
import { type ModelSelection } from '../selection.js';
|
|
11
11
|
/**
|
|
12
12
|
* Deletes content of the selection and merge siblings. The resulting selection is always collapsed.
|
|
13
13
|
*
|
|
@@ -25,7 +25,7 @@ import type Selection from '../selection.js';
|
|
|
25
25
|
* * `<heading>x^y</heading>` with the option disabled (`leaveUnmerged == false`)
|
|
26
26
|
* * `<heading>x^</heading><paragraph>y</paragraph>` with enabled (`leaveUnmerged == true`).
|
|
27
27
|
*
|
|
28
|
-
* Note: {@link module:engine/model/schema~
|
|
28
|
+
* Note: {@link module:engine/model/schema~ModelSchema#isObject object} and {@link module:engine/model/schema~ModelSchema#isLimit limit}
|
|
29
29
|
* elements will not be merged.
|
|
30
30
|
*
|
|
31
31
|
* @param options.doNotResetEntireContent Whether to skip replacing the entire content with a
|
|
@@ -62,8 +62,10 @@ import type Selection from '../selection.js';
|
|
|
62
62
|
*
|
|
63
63
|
* However, in some cases, it is expected to remove content exactly as selected in the selection, without any fixing. In these cases,
|
|
64
64
|
* this flag can be set to `true`, which will prevent fixing the selection.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
65
67
|
*/
|
|
66
|
-
export
|
|
68
|
+
export declare function deleteContent(model: Model, selection: ModelSelection | ModelDocumentSelection, options?: {
|
|
67
69
|
leaveUnmerged?: boolean;
|
|
68
70
|
doNotResetEntireContent?: boolean;
|
|
69
71
|
doNotAutoparagraph?: boolean;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/utils/deletecontent
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import { ModelDocumentSelection } from '../documentselection.js';
|
|
9
|
+
import { ModelLivePosition } from '../liveposition.js';
|
|
10
|
+
import { ModelRange } from '../range.js';
|
|
11
11
|
/**
|
|
12
12
|
* Deletes content of the selection and merge siblings. The resulting selection is always collapsed.
|
|
13
13
|
*
|
|
@@ -25,7 +25,7 @@ import Range from '../range.js';
|
|
|
25
25
|
* * `<heading>x^y</heading>` with the option disabled (`leaveUnmerged == false`)
|
|
26
26
|
* * `<heading>x^</heading><paragraph>y</paragraph>` with enabled (`leaveUnmerged == true`).
|
|
27
27
|
*
|
|
28
|
-
* Note: {@link module:engine/model/schema~
|
|
28
|
+
* Note: {@link module:engine/model/schema~ModelSchema#isObject object} and {@link module:engine/model/schema~ModelSchema#isLimit limit}
|
|
29
29
|
* elements will not be merged.
|
|
30
30
|
*
|
|
31
31
|
* @param options.doNotResetEntireContent Whether to skip replacing the entire content with a
|
|
@@ -62,8 +62,10 @@ import Range from '../range.js';
|
|
|
62
62
|
*
|
|
63
63
|
* However, in some cases, it is expected to remove content exactly as selected in the selection, without any fixing. In these cases,
|
|
64
64
|
* this flag can be set to `true`, which will prevent fixing the selection.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
65
67
|
*/
|
|
66
|
-
export
|
|
68
|
+
export function deleteContent(model, selection, options = {}) {
|
|
67
69
|
if (selection.isCollapsed) {
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
@@ -94,8 +96,8 @@ export default function deleteContent(model, selection, options = {}) {
|
|
|
94
96
|
[startPosition, endPosition] = getLivePositionsForSelectedBlocks(selRange);
|
|
95
97
|
}
|
|
96
98
|
else {
|
|
97
|
-
startPosition =
|
|
98
|
-
endPosition =
|
|
99
|
+
startPosition = ModelLivePosition.fromPosition(selRange.start, 'toPrevious');
|
|
100
|
+
endPosition = ModelLivePosition.fromPosition(selRange.end, 'toNext');
|
|
99
101
|
}
|
|
100
102
|
// 2. Remove the content if there is any.
|
|
101
103
|
if (!startPosition.isTouching(endPosition)) {
|
|
@@ -170,8 +172,8 @@ function getLivePositionsForSelectedBlocks(range) {
|
|
|
170
172
|
}
|
|
171
173
|
}
|
|
172
174
|
return [
|
|
173
|
-
|
|
174
|
-
|
|
175
|
+
ModelLivePosition.fromPosition(startPosition, 'toPrevious'),
|
|
176
|
+
ModelLivePosition.fromPosition(endPosition, 'toNext')
|
|
175
177
|
];
|
|
176
178
|
}
|
|
177
179
|
/**
|
|
@@ -457,7 +459,7 @@ function shouldAutoparagraph(schema, position) {
|
|
|
457
459
|
* Usually, widget and caption are marked as objects/limits in the schema, so in this case merging will be blocked.
|
|
458
460
|
*/
|
|
459
461
|
function isCrossingLimitElement(leftPos, rightPos, schema) {
|
|
460
|
-
const rangeToCheck = new
|
|
462
|
+
const rangeToCheck = new ModelRange(leftPos, rightPos);
|
|
461
463
|
for (const value of rangeToCheck.getWalker()) {
|
|
462
464
|
if (schema.isLimit(value.item)) {
|
|
463
465
|
return false;
|
|
@@ -498,7 +500,7 @@ function shouldEntireContentBeReplacedWithParagraph(schema, selection) {
|
|
|
498
500
|
* uses a different method to set it.
|
|
499
501
|
*/
|
|
500
502
|
function collapseSelectionAt(writer, selection, positionOrRange) {
|
|
501
|
-
if (selection instanceof
|
|
503
|
+
if (selection instanceof ModelDocumentSelection) {
|
|
502
504
|
writer.setSelection(positionOrRange);
|
|
503
505
|
}
|
|
504
506
|
else {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
6
|
-
import type
|
|
7
|
-
import type Model from '../model.js';
|
|
8
|
-
import type
|
|
5
|
+
import { type ModelDocumentFragment } from '../documentfragment.js';
|
|
6
|
+
import { type ModelDocumentSelection } from '../documentselection.js';
|
|
7
|
+
import { type Model } from '../model.js';
|
|
8
|
+
import { type ModelSelection } from '../selection.js';
|
|
9
9
|
/**
|
|
10
10
|
* @module engine/model/utils/getselectedcontent
|
|
11
11
|
*/
|
|
@@ -26,5 +26,6 @@ import type Selection from '../selection.js';
|
|
|
26
26
|
*
|
|
27
27
|
* @param model The model in context of which the selection modification should be performed.
|
|
28
28
|
* @param selection The selection of which content will be returned.
|
|
29
|
+
* @internal
|
|
29
30
|
*/
|
|
30
|
-
export
|
|
31
|
+
export declare function getSelectedContent(model: Model, selection: ModelSelection | ModelDocumentSelection): ModelDocumentFragment;
|
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
*
|
|
23
23
|
* @param model The model in context of which the selection modification should be performed.
|
|
24
24
|
* @param selection The selection of which content will be returned.
|
|
25
|
+
* @internal
|
|
25
26
|
*/
|
|
26
|
-
export
|
|
27
|
+
export function getSelectedContent(model, selection) {
|
|
27
28
|
return model.change(writer => {
|
|
28
29
|
const frag = writer.createDocumentFragment();
|
|
29
30
|
const range = selection.getFirstRange();
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/model/utils/insertcontent
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
12
|
-
import type Model from '../model.js';
|
|
13
|
-
import type
|
|
8
|
+
import { ModelDocumentSelection } from '../documentselection.js';
|
|
9
|
+
import { ModelRange } from '../range.js';
|
|
10
|
+
import { type ModelDocumentFragment } from '../documentfragment.js';
|
|
11
|
+
import { type ModelItem } from '../item.js';
|
|
12
|
+
import { type Model } from '../model.js';
|
|
13
|
+
import { type ModelSelection } from '../selection.js';
|
|
14
14
|
/**
|
|
15
15
|
* Inserts content into the editor (specified selection) as one would expect the paste functionality to work.
|
|
16
16
|
*
|
|
@@ -26,7 +26,7 @@ import type Selection from '../selection.js';
|
|
|
26
26
|
* <p>x</p>[<img />]<p>z</p> + <p>y</p> => <p>x</p>^<p>z</p> + <p>y</p> => <p>x</p><p>y[]</p><p>z</p>
|
|
27
27
|
* ```
|
|
28
28
|
*
|
|
29
|
-
* If an instance of {@link module:engine/model/selection~
|
|
29
|
+
* If an instance of {@link module:engine/model/selection~ModelSelection} is passed as `selectable` it will be modified
|
|
30
30
|
* to the insertion selection (equal to a range to be selected after insertion).
|
|
31
31
|
*
|
|
32
32
|
* If `selectable` is not passed, the content will be inserted using the current selection of the model document.
|
|
@@ -41,5 +41,6 @@ import type Selection from '../selection.js';
|
|
|
41
41
|
* @returns Range which contains all the performed changes. This is a range that, if removed,
|
|
42
42
|
* would return the model to the state before the insertion. If no changes were preformed by `insertContent`, returns a range collapsed
|
|
43
43
|
* at the insertion position.
|
|
44
|
+
* @internal
|
|
44
45
|
*/
|
|
45
|
-
export
|
|
46
|
+
export declare function insertContent(model: Model, content: ModelItem | ModelDocumentFragment, selectable?: ModelSelection | ModelDocumentSelection): ModelRange;
|