@ckeditor/ckeditor5-engine 45.2.1-alpha.9 → 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
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
9
9
|
/**
|
|
10
|
-
* Class used for handling consumption of view {@link module:engine/view/element~
|
|
11
|
-
* {@link module:engine/view/text~
|
|
10
|
+
* Class used for handling consumption of view {@link module:engine/view/element~ViewElement elements},
|
|
11
|
+
* {@link module:engine/view/text~ViewText text nodes} and
|
|
12
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment document fragments}.
|
|
12
13
|
* Element's name and its parts (attributes, classes and styles) can be consumed separately. Consuming an element's name
|
|
13
14
|
* does not consume its attributes, classes and styles.
|
|
14
15
|
* To add items for consumption use {@link module:engine/conversion/viewconsumable~ViewConsumable#add add method}.
|
|
@@ -31,17 +32,17 @@ import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
|
31
32
|
* viewConsumable.revert( docFragment ); // Revert already consumed document fragment.
|
|
32
33
|
* ```
|
|
33
34
|
*/
|
|
34
|
-
export
|
|
35
|
+
export class ViewConsumable {
|
|
35
36
|
/**
|
|
36
|
-
* Map of consumable elements. If {@link module:engine/view/element~
|
|
37
|
+
* Map of consumable elements. If {@link module:engine/view/element~ViewElement element} is used as a key,
|
|
37
38
|
* {@link module:engine/conversion/viewconsumable~ViewElementConsumables ViewElementConsumables} instance is stored as value.
|
|
38
|
-
* For {@link module:engine/view/text~
|
|
39
|
-
* {@link module:engine/view/documentfragment~
|
|
39
|
+
* For {@link module:engine/view/text~ViewText text nodes} and
|
|
40
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment document fragments} boolean value is stored as value.
|
|
40
41
|
*/
|
|
41
42
|
_consumables = new Map();
|
|
42
43
|
/**
|
|
43
|
-
* Adds view {@link module:engine/view/element~
|
|
44
|
-
* {@link module:engine/view/documentfragment~
|
|
44
|
+
* Adds view {@link module:engine/view/element~ViewElement element}, {@link module:engine/view/text~ViewText text node} or
|
|
45
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment} as ready to be consumed.
|
|
45
46
|
*
|
|
46
47
|
* ```ts
|
|
47
48
|
* viewConsumable.add( p, { name: true } ); // Adds element's name to consume.
|
|
@@ -62,7 +63,7 @@ export default class ViewConsumable {
|
|
|
62
63
|
* viewConsumable.add( p, { styles: 'color' } ); // This is properly handled style.
|
|
63
64
|
* ```
|
|
64
65
|
*
|
|
65
|
-
* @param consumables Used only if first parameter is {@link module:engine/view/element~
|
|
66
|
+
* @param consumables Used only if first parameter is {@link module:engine/view/element~ViewElement view element} instance.
|
|
66
67
|
* @param consumables.name If set to true element's name will be included.
|
|
67
68
|
* @param consumables.attributes Attribute name or array of attribute names.
|
|
68
69
|
* @param consumables.classes Class name or array of class names.
|
|
@@ -86,8 +87,8 @@ export default class ViewConsumable {
|
|
|
86
87
|
elementConsumables.add(consumables ? normalizeConsumables(consumables) : element._getConsumables());
|
|
87
88
|
}
|
|
88
89
|
/**
|
|
89
|
-
* Tests if {@link module:engine/view/element~
|
|
90
|
-
* {@link module:engine/view/documentfragment~
|
|
90
|
+
* Tests if {@link module:engine/view/element~ViewElement view element}, {@link module:engine/view/text~ViewText text node} or
|
|
91
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment} can be consumed.
|
|
91
92
|
* It returns `true` when all items included in method's call can be consumed. Returns `false` when
|
|
92
93
|
* first already consumed item is found and `null` when first non-consumable item is found.
|
|
93
94
|
*
|
|
@@ -109,7 +110,7 @@ export default class ViewConsumable {
|
|
|
109
110
|
* viewConsumable.test( p, { attributes: 'style' } ); // Tests if all added styles can be consumed.
|
|
110
111
|
* ```
|
|
111
112
|
*
|
|
112
|
-
* @param consumables Used only if first parameter is {@link module:engine/view/element~
|
|
113
|
+
* @param consumables Used only if first parameter is {@link module:engine/view/element~ViewElement view element} instance.
|
|
113
114
|
* @param consumables.name If set to true element's name will be included.
|
|
114
115
|
* @param consumables.attributes Attribute name or array of attribute names.
|
|
115
116
|
* @param consumables.classes Class name or array of class names.
|
|
@@ -130,8 +131,8 @@ export default class ViewConsumable {
|
|
|
130
131
|
return elementConsumables.test(normalizeConsumables(consumables));
|
|
131
132
|
}
|
|
132
133
|
/**
|
|
133
|
-
* Consumes {@link module:engine/view/element~
|
|
134
|
-
* {@link module:engine/view/documentfragment~
|
|
134
|
+
* Consumes {@link module:engine/view/element~ViewElement view element}, {@link module:engine/view/text~ViewText text node} or
|
|
135
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}.
|
|
135
136
|
* It returns `true` when all items included in method's call can be consumed, otherwise returns `false`.
|
|
136
137
|
*
|
|
137
138
|
* ```ts
|
|
@@ -152,7 +153,7 @@ export default class ViewConsumable {
|
|
|
152
153
|
* viewConsumable.consume( p, { attributes: 'style' } ); // Consume only if all added styles can be consumed.
|
|
153
154
|
* ```
|
|
154
155
|
*
|
|
155
|
-
* @param consumables Used only if first parameter is {@link module:engine/view/element~
|
|
156
|
+
* @param consumables Used only if first parameter is {@link module:engine/view/element~ViewElement view element} instance.
|
|
156
157
|
* @param consumables.name If set to true element's name will be included.
|
|
157
158
|
* @param consumables.attributes Attribute name or array of attribute names.
|
|
158
159
|
* @param consumables.classes Class name or array of class names.
|
|
@@ -177,8 +178,8 @@ export default class ViewConsumable {
|
|
|
177
178
|
return elementConsumables.consume(normalizeConsumables(consumables));
|
|
178
179
|
}
|
|
179
180
|
/**
|
|
180
|
-
* Reverts {@link module:engine/view/element~
|
|
181
|
-
* {@link module:engine/view/documentfragment~
|
|
181
|
+
* Reverts {@link module:engine/view/element~ViewElement view element}, {@link module:engine/view/text~ViewText text node} or
|
|
182
|
+
* {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment} so they can be consumed once again.
|
|
182
183
|
* Method does not revert items that were never previously added for consumption, even if they are included in
|
|
183
184
|
* method's call.
|
|
184
185
|
*
|
|
@@ -201,7 +202,7 @@ export default class ViewConsumable {
|
|
|
201
202
|
* viewConsumable.revert( p, { attributes: 'style' } ); // Reverts all styles added for consumption.
|
|
202
203
|
* ```
|
|
203
204
|
*
|
|
204
|
-
* @param consumables Used only if first parameter is {@link module:engine/view/element~
|
|
205
|
+
* @param consumables Used only if first parameter is {@link module:engine/view/element~ViewElement view element} instance.
|
|
205
206
|
* @param consumables.name If set to true element's name will be included.
|
|
206
207
|
* @param consumables.attributes Attribute name or array of attribute names.
|
|
207
208
|
* @param consumables.classes Class name or array of class names.
|
|
@@ -222,7 +223,7 @@ export default class ViewConsumable {
|
|
|
222
223
|
}
|
|
223
224
|
/**
|
|
224
225
|
* Creates {@link module:engine/conversion/viewconsumable~ViewConsumable ViewConsumable} instance from
|
|
225
|
-
* {@link module:engine/view/node~
|
|
226
|
+
* {@link module:engine/view/node~ViewNode node} or {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}.
|
|
226
227
|
* Instance will contain all elements, child nodes, attributes, styles and classes added for consumption.
|
|
227
228
|
*
|
|
228
229
|
* @param from View node or document fragment from which `ViewConsumable` will be created.
|
|
@@ -247,7 +248,9 @@ export default class ViewConsumable {
|
|
|
247
248
|
}
|
|
248
249
|
/**
|
|
249
250
|
* This is a private helper-class for {@link module:engine/conversion/viewconsumable~ViewConsumable}.
|
|
250
|
-
* It represents and manipulates consumable parts of a single {@link module:engine/view/element~
|
|
251
|
+
* It represents and manipulates consumable parts of a single {@link module:engine/view/element~ViewElement}.
|
|
252
|
+
*
|
|
253
|
+
* @internal
|
|
251
254
|
*/
|
|
252
255
|
export class ViewElementConsumables {
|
|
253
256
|
element;
|
|
@@ -271,7 +274,7 @@ export class ViewElementConsumables {
|
|
|
271
274
|
this.element = from;
|
|
272
275
|
}
|
|
273
276
|
/**
|
|
274
|
-
* Adds consumable parts of the {@link module:engine/view/element~
|
|
277
|
+
* Adds consumable parts of the {@link module:engine/view/element~ViewElement view element}.
|
|
275
278
|
* Element's name itself can be marked to be consumed (when element's name is consumed its attributes, classes and
|
|
276
279
|
* styles still could be consumed):
|
|
277
280
|
*
|
|
@@ -286,9 +289,9 @@ export class ViewElementConsumables {
|
|
|
286
289
|
* consumables.add( { attributes: [ [ 'title' ], [ 'name' ], [ 'class', 'foo' ], [ 'class', 'bar' ] ] } );
|
|
287
290
|
* ```
|
|
288
291
|
*
|
|
289
|
-
* Note: This method accepts only {@link module:engine/view/element~
|
|
292
|
+
* Note: This method accepts only {@link module:engine/view/element~ViewNormalizedConsumables}.
|
|
290
293
|
* You can use {@link module:engine/conversion/viewconsumable~normalizeConsumables} helper to convert from
|
|
291
|
-
* {@link module:engine/conversion/viewconsumable~Consumables} to `
|
|
294
|
+
* {@link module:engine/conversion/viewconsumable~Consumables} to `ViewNormalizedConsumables`.
|
|
292
295
|
*
|
|
293
296
|
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `viewconsumable-invalid-attribute` when `class` or `style`
|
|
294
297
|
* attribute is provided - it should be handled separately by providing `style` and `class` in consumables object.
|
|
@@ -335,7 +338,7 @@ export class ViewElementConsumables {
|
|
|
335
338
|
}
|
|
336
339
|
}
|
|
337
340
|
/**
|
|
338
|
-
* Tests if parts of the {@link module:engine/view/element~
|
|
341
|
+
* Tests if parts of the {@link module:engine/view/element~ViewElement view element} can be consumed.
|
|
339
342
|
*
|
|
340
343
|
* Element's name can be tested:
|
|
341
344
|
*
|
|
@@ -398,7 +401,7 @@ export class ViewElementConsumables {
|
|
|
398
401
|
return true;
|
|
399
402
|
}
|
|
400
403
|
/**
|
|
401
|
-
* Tests if parts of the {@link module:engine/view/element~
|
|
404
|
+
* Tests if parts of the {@link module:engine/view/element~ViewElement view element} can be consumed and consumes them if available.
|
|
402
405
|
* It returns `true` when all items included in method's call can be consumed, otherwise returns `false`.
|
|
403
406
|
*
|
|
404
407
|
* Element's name can be consumed:
|
|
@@ -450,7 +453,7 @@ export class ViewElementConsumables {
|
|
|
450
453
|
return true;
|
|
451
454
|
}
|
|
452
455
|
/**
|
|
453
|
-
* Revert already consumed parts of {@link module:engine/view/element~
|
|
456
|
+
* Revert already consumed parts of {@link module:engine/view/element~ViewElement view Element}, so they can be consumed once again.
|
|
454
457
|
* Element's name can be reverted:
|
|
455
458
|
*
|
|
456
459
|
* ```ts
|
|
@@ -499,7 +502,9 @@ export class ViewElementConsumables {
|
|
|
499
502
|
}
|
|
500
503
|
/**
|
|
501
504
|
* Normalizes a {@link module:engine/conversion/viewconsumable~Consumables} or {@link module:engine/view/matcher~Match}
|
|
502
|
-
* to a {@link module:engine/view/element~
|
|
505
|
+
* to a {@link module:engine/view/element~ViewNormalizedConsumables}.
|
|
506
|
+
*
|
|
507
|
+
* @internal
|
|
503
508
|
*/
|
|
504
509
|
export function normalizeConsumables(consumables) {
|
|
505
510
|
const attributes = [];
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/dataprocessor/basichtmlwriter
|
|
7
7
|
*/
|
|
8
|
-
import type
|
|
8
|
+
import { type DataProcessorHtmlWriter } from './htmlwriter.js';
|
|
9
9
|
/**
|
|
10
10
|
* Basic HTML writer. It uses the native `innerHTML` property for basic conversion
|
|
11
11
|
* from a document fragment to an HTML string.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
12
14
|
*/
|
|
13
|
-
export
|
|
15
|
+
export declare class BasicHtmlWriter implements DataProcessorHtmlWriter {
|
|
14
16
|
/**
|
|
15
17
|
* Returns an HTML string created from the document fragment.
|
|
16
18
|
*/
|
|
@@ -6,8 +6,10 @@ import { global } from '@ckeditor/ckeditor5-utils';
|
|
|
6
6
|
/**
|
|
7
7
|
* Basic HTML writer. It uses the native `innerHTML` property for basic conversion
|
|
8
8
|
* from a document fragment to an HTML string.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
9
11
|
*/
|
|
10
|
-
export
|
|
12
|
+
export class BasicHtmlWriter {
|
|
11
13
|
/**
|
|
12
14
|
* Returns an HTML string created from the document fragment.
|
|
13
15
|
*/
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/dataprocessor/dataprocessor
|
|
7
7
|
*/
|
|
8
|
-
import type ViewDocumentFragment from '../view/documentfragment.js';
|
|
8
|
+
import { type ViewDocumentFragment } from '../view/documentfragment.js';
|
|
9
9
|
import type { MatcherPattern } from '../view/matcher.js';
|
|
10
10
|
/**
|
|
11
11
|
* The data processor interface. It should be implemented by actual data processors.
|
|
12
12
|
*
|
|
13
13
|
* Each data processor implements a certain format of the data. For example, {@glink features/markdown Markdown data processor}
|
|
14
|
-
* will convert the data (a Markdown string) to a {@link module:engine/view/documentfragment~
|
|
14
|
+
* will convert the data (a Markdown string) to a {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}
|
|
15
|
+
* and back.
|
|
15
16
|
*
|
|
16
17
|
* **Note:** While the CKEditor 5 architecture supports changing the data format, in most scenarios we do recommend sticking to
|
|
17
18
|
* the default format which is HTML (supported by the {@link module:engine/dataprocessor/htmldataprocessor~HtmlDataProcessor}).
|
|
@@ -20,15 +21,15 @@ import type { MatcherPattern } from '../view/matcher.js';
|
|
|
20
21
|
* And please do remember – using Markdown [does not automatically make your
|
|
21
22
|
* application/website secure](https://github.com/ckeditor/ckeditor5-markdown-gfm/issues/16#issuecomment-375752994).
|
|
22
23
|
*/
|
|
23
|
-
export
|
|
24
|
+
export interface DataProcessor {
|
|
24
25
|
/**
|
|
25
|
-
* Converts a {@link module:engine/view/documentfragment~
|
|
26
|
+
* Converts a {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment} to data.
|
|
26
27
|
*
|
|
27
28
|
* @param viewFragment The document fragment to be processed.
|
|
28
29
|
*/
|
|
29
30
|
toData(viewFragment: ViewDocumentFragment): string;
|
|
30
31
|
/**
|
|
31
|
-
* Converts the data to a {@link module:engine/view/documentfragment~
|
|
32
|
+
* Converts the data to a {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}.
|
|
32
33
|
*
|
|
33
34
|
* @param data The data to be processed.
|
|
34
35
|
*/
|
|
@@ -36,7 +37,7 @@ export default interface DataProcessor {
|
|
|
36
37
|
/**
|
|
37
38
|
* Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data
|
|
38
39
|
* and its content should be converted to a
|
|
39
|
-
* {@link module:engine/view/element~
|
|
40
|
+
* {@link module:engine/view/element~ViewElement#getCustomProperty custom property of a view element} called `"$rawContent"` while
|
|
40
41
|
* converting {@link #toView to view}.
|
|
41
42
|
*
|
|
42
43
|
* @param pattern Pattern matching all view elements whose content should be treated as plain text.
|
|
@@ -2,17 +2,17 @@
|
|
|
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
|
|
6
|
-
import type DataProcessor from './dataprocessor.js';
|
|
7
|
-
import type
|
|
8
|
-
import type ViewDocument from '../view/document.js';
|
|
9
|
-
import type ViewDocumentFragment from '../view/documentfragment.js';
|
|
5
|
+
import { ViewDomConverter } from '../view/domconverter.js';
|
|
6
|
+
import { type DataProcessor } from './dataprocessor.js';
|
|
7
|
+
import { type DataProcessorHtmlWriter } from './htmlwriter.js';
|
|
8
|
+
import { type ViewDocument } from '../view/document.js';
|
|
9
|
+
import { type ViewDocumentFragment } from '../view/documentfragment.js';
|
|
10
10
|
import type { MatcherPattern } from '../view/matcher.js';
|
|
11
11
|
/**
|
|
12
12
|
* The HTML data processor class.
|
|
13
13
|
* This data processor implementation uses HTML as input and output data.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export declare class HtmlDataProcessor implements DataProcessor {
|
|
16
16
|
/**
|
|
17
17
|
* A DOM parser instance used to parse an HTML string to an HTML document.
|
|
18
18
|
*/
|
|
@@ -20,11 +20,11 @@ export default class HtmlDataProcessor implements DataProcessor {
|
|
|
20
20
|
/**
|
|
21
21
|
* A DOM converter used to convert DOM elements to view elements.
|
|
22
22
|
*/
|
|
23
|
-
domConverter:
|
|
23
|
+
domConverter: ViewDomConverter;
|
|
24
24
|
/**
|
|
25
25
|
* A basic HTML writer instance used to convert DOM elements to an HTML string.
|
|
26
26
|
*/
|
|
27
|
-
htmlWriter:
|
|
27
|
+
htmlWriter: DataProcessorHtmlWriter;
|
|
28
28
|
skipComments: boolean;
|
|
29
29
|
/**
|
|
30
30
|
* Creates a new instance of the HTML data processor class.
|
|
@@ -33,7 +33,7 @@ export default class HtmlDataProcessor implements DataProcessor {
|
|
|
33
33
|
*/
|
|
34
34
|
constructor(document: ViewDocument);
|
|
35
35
|
/**
|
|
36
|
-
* Converts a provided {@link module:engine/view/documentfragment~
|
|
36
|
+
* Converts a provided {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}
|
|
37
37
|
* to data format – in this case to an HTML string.
|
|
38
38
|
*
|
|
39
39
|
* @returns HTML string.
|
|
@@ -51,7 +51,7 @@ export default class HtmlDataProcessor implements DataProcessor {
|
|
|
51
51
|
* and not processed during the conversion from the DOM to the view elements.
|
|
52
52
|
*
|
|
53
53
|
* The raw data can be later accessed by a
|
|
54
|
-
* {@link module:engine/view/element~
|
|
54
|
+
* {@link module:engine/view/element~ViewElement#getCustomProperty custom property of a view element} called `"$rawContent"`.
|
|
55
55
|
*
|
|
56
56
|
* @param pattern Pattern matching all view elements whose content should be treated as raw data.
|
|
57
57
|
*/
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/dataprocessor/htmldataprocessor
|
|
7
7
|
*/
|
|
8
|
-
import BasicHtmlWriter from './basichtmlwriter.js';
|
|
9
|
-
import
|
|
8
|
+
import { BasicHtmlWriter } from './basichtmlwriter.js';
|
|
9
|
+
import { ViewDomConverter } from '../view/domconverter.js';
|
|
10
10
|
/**
|
|
11
11
|
* The HTML data processor class.
|
|
12
12
|
* This data processor implementation uses HTML as input and output data.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export class HtmlDataProcessor {
|
|
15
15
|
/**
|
|
16
16
|
* A DOM parser instance used to parse an HTML string to an HTML document.
|
|
17
17
|
*/
|
|
@@ -32,11 +32,11 @@ export default class HtmlDataProcessor {
|
|
|
32
32
|
*/
|
|
33
33
|
constructor(document) {
|
|
34
34
|
this.domParser = new DOMParser();
|
|
35
|
-
this.domConverter = new
|
|
35
|
+
this.domConverter = new ViewDomConverter(document, { renderingMode: 'data' });
|
|
36
36
|
this.htmlWriter = new BasicHtmlWriter();
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* Converts a provided {@link module:engine/view/documentfragment~
|
|
39
|
+
* Converts a provided {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}
|
|
40
40
|
* to data format – in this case to an HTML string.
|
|
41
41
|
*
|
|
42
42
|
* @returns HTML string.
|
|
@@ -64,7 +64,7 @@ export default class HtmlDataProcessor {
|
|
|
64
64
|
* and not processed during the conversion from the DOM to the view elements.
|
|
65
65
|
*
|
|
66
66
|
* The raw data can be later accessed by a
|
|
67
|
-
* {@link module:engine/view/element~
|
|
67
|
+
* {@link module:engine/view/element~ViewElement#getCustomProperty custom property of a view element} called `"$rawContent"`.
|
|
68
68
|
*
|
|
69
69
|
* @param pattern Pattern matching all view elements whose content should be treated as raw data.
|
|
70
70
|
*/
|
|
@@ -2,11 +2,11 @@
|
|
|
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
|
|
6
|
-
import type DataProcessor from './dataprocessor.js';
|
|
7
|
-
import type
|
|
8
|
-
import type ViewDocument from '../view/document.js';
|
|
9
|
-
import type ViewDocumentFragment from '../view/documentfragment.js';
|
|
5
|
+
import { ViewDomConverter } from '../view/domconverter.js';
|
|
6
|
+
import { type DataProcessor } from './dataprocessor.js';
|
|
7
|
+
import { type DataProcessorHtmlWriter } from './htmlwriter.js';
|
|
8
|
+
import { type ViewDocument } from '../view/document.js';
|
|
9
|
+
import { type ViewDocumentFragment } from '../view/documentfragment.js';
|
|
10
10
|
import type { MatcherPattern } from '../view/matcher.js';
|
|
11
11
|
/**
|
|
12
12
|
* The XML data processor class.
|
|
@@ -14,7 +14,7 @@ import type { MatcherPattern } from '../view/matcher.js';
|
|
|
14
14
|
* This class is needed because unlike HTML, XML allows to use any tag with any value.
|
|
15
15
|
* For example, `<link>Text</link>` is a valid XML but invalid HTML.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export declare class XmlDataProcessor implements DataProcessor {
|
|
18
18
|
/**
|
|
19
19
|
* A list of namespaces allowed to use in the XML input.
|
|
20
20
|
*
|
|
@@ -29,12 +29,12 @@ export default class XmlDataProcessor implements DataProcessor {
|
|
|
29
29
|
/**
|
|
30
30
|
* DOM converter used to convert DOM elements to view elements.
|
|
31
31
|
*/
|
|
32
|
-
domConverter:
|
|
32
|
+
domConverter: ViewDomConverter;
|
|
33
33
|
/**
|
|
34
34
|
* A basic HTML writer instance used to convert DOM elements to an XML string.
|
|
35
35
|
* There is no need to use a dedicated XML writer because the basic HTML writer works well in this case.
|
|
36
36
|
*/
|
|
37
|
-
htmlWriter:
|
|
37
|
+
htmlWriter: DataProcessorHtmlWriter;
|
|
38
38
|
skipComments: boolean;
|
|
39
39
|
/**
|
|
40
40
|
* Creates a new instance of the XML data processor class.
|
|
@@ -47,7 +47,7 @@ export default class XmlDataProcessor implements DataProcessor {
|
|
|
47
47
|
namespaces?: Array<string>;
|
|
48
48
|
});
|
|
49
49
|
/**
|
|
50
|
-
* Converts the provided {@link module:engine/view/documentfragment~
|
|
50
|
+
* Converts the provided {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}
|
|
51
51
|
* to data format – in this case an XML string.
|
|
52
52
|
*
|
|
53
53
|
* @returns An XML string.
|
|
@@ -65,7 +65,7 @@ export default class XmlDataProcessor implements DataProcessor {
|
|
|
65
65
|
* and not processed during the conversion from XML to view elements.
|
|
66
66
|
*
|
|
67
67
|
* The raw data can be later accessed by a
|
|
68
|
-
* {@link module:engine/view/element~
|
|
68
|
+
* {@link module:engine/view/element~ViewElement#getCustomProperty custom property of a view element} called `"$rawContent"`.
|
|
69
69
|
*
|
|
70
70
|
* @param pattern Pattern matching all view elements whose content should be treated as raw data.
|
|
71
71
|
*/
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/dataprocessor/xmldataprocessor
|
|
7
7
|
*/
|
|
8
|
-
import BasicHtmlWriter from './basichtmlwriter.js';
|
|
9
|
-
import
|
|
8
|
+
import { BasicHtmlWriter } from './basichtmlwriter.js';
|
|
9
|
+
import { ViewDomConverter } from '../view/domconverter.js';
|
|
10
10
|
/**
|
|
11
11
|
* The XML data processor class.
|
|
12
12
|
* This data processor implementation uses XML as input and output data.
|
|
13
13
|
* This class is needed because unlike HTML, XML allows to use any tag with any value.
|
|
14
14
|
* For example, `<link>Text</link>` is a valid XML but invalid HTML.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export class XmlDataProcessor {
|
|
17
17
|
/**
|
|
18
18
|
* A list of namespaces allowed to use in the XML input.
|
|
19
19
|
*
|
|
@@ -45,11 +45,11 @@ export default class XmlDataProcessor {
|
|
|
45
45
|
constructor(document, options = {}) {
|
|
46
46
|
this.namespaces = options.namespaces || [];
|
|
47
47
|
this.domParser = new DOMParser();
|
|
48
|
-
this.domConverter = new
|
|
48
|
+
this.domConverter = new ViewDomConverter(document, { renderingMode: 'data' });
|
|
49
49
|
this.htmlWriter = new BasicHtmlWriter();
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* Converts the provided {@link module:engine/view/documentfragment~
|
|
52
|
+
* Converts the provided {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}
|
|
53
53
|
* to data format – in this case an XML string.
|
|
54
54
|
*
|
|
55
55
|
* @returns An XML string.
|
|
@@ -81,7 +81,7 @@ export default class XmlDataProcessor {
|
|
|
81
81
|
* and not processed during the conversion from XML to view elements.
|
|
82
82
|
*
|
|
83
83
|
* The raw data can be later accessed by a
|
|
84
|
-
* {@link module:engine/view/element~
|
|
84
|
+
* {@link module:engine/view/element~ViewElement#getCustomProperty custom property of a view element} called `"$rawContent"`.
|
|
85
85
|
*
|
|
86
86
|
* @param pattern Pattern matching all view elements whose content should be treated as raw data.
|
|
87
87
|
*/
|
package/src/dev-utils/model.d.ts
CHANGED
|
@@ -2,24 +2,24 @@
|
|
|
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 Model from '../model/model.js';
|
|
6
|
-
import ModelRange from '../model/range.js';
|
|
7
|
-
import ModelPosition from '../model/position.js';
|
|
8
|
-
import ModelSelection from '../model/selection.js';
|
|
9
|
-
import ModelDocumentFragment from '../model/documentfragment.js';
|
|
10
|
-
import
|
|
5
|
+
import { Model } from '../model/model.js';
|
|
6
|
+
import { ModelRange } from '../model/range.js';
|
|
7
|
+
import { ModelPosition } from '../model/position.js';
|
|
8
|
+
import { ModelSelection } from '../model/selection.js';
|
|
9
|
+
import { ModelDocumentFragment } from '../model/documentfragment.js';
|
|
10
|
+
import { ModelDocumentSelection } from '../model/documentselection.js';
|
|
11
11
|
import type { BatchType } from '../model/batch.js';
|
|
12
|
-
import type MarkerCollection from '../model/markercollection.js';
|
|
13
|
-
import type {
|
|
14
|
-
import type ModelNode from '../model/node.js';
|
|
12
|
+
import { type MarkerCollection } from '../model/markercollection.js';
|
|
13
|
+
import type { ModelSchema, ModelSchemaContextDefinition } from '../model/schema.js';
|
|
14
|
+
import { type ModelNode } from '../model/node.js';
|
|
15
15
|
/**
|
|
16
|
-
* Writes the content of a model {@link module:engine/model/document~
|
|
16
|
+
* Writes the content of a model {@link module:engine/model/document~ModelDocument document} to an HTML-like string.
|
|
17
17
|
*
|
|
18
18
|
* ```ts
|
|
19
19
|
* getData( editor.model ); // -> '<paragraph>Foo![]</paragraph>'
|
|
20
20
|
* ```
|
|
21
21
|
*
|
|
22
|
-
* **Note:** A {@link module:engine/model/text~
|
|
22
|
+
* **Note:** A {@link module:engine/model/text~ModelText text} node that contains attributes will be represented as:
|
|
23
23
|
*
|
|
24
24
|
* ```xml
|
|
25
25
|
* <$text attribute="value">Text data</$text>
|
|
@@ -35,16 +35,16 @@ import type ModelNode from '../model/node.js';
|
|
|
35
35
|
* @param options.convertMarkers Whether to include markers in the returned string.
|
|
36
36
|
* @returns The stringified data.
|
|
37
37
|
*/
|
|
38
|
-
export declare function
|
|
38
|
+
export declare function _getModelData(model: Model, options?: {
|
|
39
39
|
withoutSelection?: boolean;
|
|
40
40
|
rootName?: string;
|
|
41
41
|
convertMarkers?: boolean;
|
|
42
42
|
}): string;
|
|
43
|
-
export declare namespace
|
|
44
|
-
var _stringify: typeof
|
|
43
|
+
export declare namespace _getModelData {
|
|
44
|
+
var _stringify: typeof _stringifyModel;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* Sets the content of a model {@link module:engine/model/document~
|
|
47
|
+
* Sets the content of a model {@link module:engine/model/document~ModelDocument document} provided as an HTML-like string.
|
|
48
48
|
*
|
|
49
49
|
* ```ts
|
|
50
50
|
* setData( editor.model, '<paragraph>Foo![]</paragraph>' );
|
|
@@ -53,7 +53,7 @@ export declare namespace getData {
|
|
|
53
53
|
* **Note:** Remember to register elements in the {@link module:engine/model/model~Model#schema model's schema} before
|
|
54
54
|
* trying to use them.
|
|
55
55
|
*
|
|
56
|
-
* **Note:** To create a {@link module:engine/model/text~
|
|
56
|
+
* **Note:** To create a {@link module:engine/model/text~ModelText text} node that contains attributes use:
|
|
57
57
|
*
|
|
58
58
|
* ```xml
|
|
59
59
|
* <$text attribute="value">Text data</$text>
|
|
@@ -68,22 +68,21 @@ export declare namespace getData {
|
|
|
68
68
|
* @param options.selectionAttributes A list of attributes which will be passed to the selection.
|
|
69
69
|
* @param options.lastRangeBackward If set to `true`, the last range will be added as backward.
|
|
70
70
|
* @param options.batchType Batch type used for inserting elements. See {@link module:engine/model/batch~Batch#constructor}.
|
|
71
|
-
* See {@link module:engine/model/batch~Batch#type}.
|
|
72
71
|
*/
|
|
73
|
-
export declare function
|
|
72
|
+
export declare function _setModelData(model: Model, data: string, options?: {
|
|
74
73
|
rootName?: string;
|
|
75
74
|
selectionAttributes?: Record<string, unknown>;
|
|
76
75
|
lastRangeBackward?: boolean;
|
|
77
76
|
batchType?: BatchType;
|
|
78
77
|
inlineObjectElements?: Array<string>;
|
|
79
78
|
}): void;
|
|
80
|
-
export declare namespace
|
|
81
|
-
var _parse: typeof
|
|
79
|
+
export declare namespace _setModelData {
|
|
80
|
+
var _parse: typeof _parseModel;
|
|
82
81
|
}
|
|
83
82
|
/**
|
|
84
83
|
* Converts model nodes to HTML-like string representation.
|
|
85
84
|
*
|
|
86
|
-
* **Note:** A {@link module:engine/model/text~
|
|
85
|
+
* **Note:** A {@link module:engine/model/text~ModelText text} node that contains attributes will be represented as:
|
|
87
86
|
*
|
|
88
87
|
* ```xml
|
|
89
88
|
* <$text attribute="value">Text data</$text>
|
|
@@ -96,11 +95,11 @@ export declare namespace setData {
|
|
|
96
95
|
* @param markers Markers to include.
|
|
97
96
|
* @returns An HTML-like string representing the model.
|
|
98
97
|
*/
|
|
99
|
-
export declare function
|
|
98
|
+
export declare function _stringifyModel(node: ModelNode | ModelDocumentFragment, selectionOrPositionOrRange?: ModelSelection | ModelDocumentSelection | ModelPosition | ModelRange | null, markers?: MarkerCollection | null): string;
|
|
100
99
|
/**
|
|
101
|
-
* Parses an HTML-like string and returns the model {@link module:engine/model/rootelement~
|
|
100
|
+
* Parses an HTML-like string and returns the model {@link module:engine/model/rootelement~ModelRootElement rootElement}.
|
|
102
101
|
*
|
|
103
|
-
* **Note:** To create a {@link module:engine/model/text~
|
|
102
|
+
* **Note:** To create a {@link module:engine/model/text~ModelText text} node that contains attributes use:
|
|
104
103
|
*
|
|
105
104
|
* ```xml
|
|
106
105
|
* <$text attribute="value">Text data</$text>
|
|
@@ -115,10 +114,10 @@ export declare function stringify(node: ModelNode | ModelDocumentFragment, selec
|
|
|
115
114
|
* @returns Returns the parsed model node or an object with two fields: `model` and `selection`,
|
|
116
115
|
* when selection ranges were included in the data to parse.
|
|
117
116
|
*/
|
|
118
|
-
export declare function
|
|
117
|
+
export declare function _parseModel(data: string, schema: ModelSchema, options?: {
|
|
119
118
|
selectionAttributes?: Record<string, unknown> | Iterable<[string, unknown]>;
|
|
120
119
|
lastRangeBackward?: boolean;
|
|
121
|
-
context?:
|
|
120
|
+
context?: ModelSchemaContextDefinition;
|
|
122
121
|
inlineObjectElements?: Array<string>;
|
|
123
122
|
}): ModelNode | ModelDocumentFragment | {
|
|
124
123
|
model: ModelNode | ModelDocumentFragment;
|