@ckeditor/ckeditor5-engine 48.2.0 → 48.3.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.
Files changed (129) hide show
  1. package/dist/controller/datacontroller.d.ts +329 -328
  2. package/dist/controller/editingcontroller.d.ts +95 -94
  3. package/dist/conversion/comparemarkers.d.ts +45 -45
  4. package/dist/conversion/conversion.d.ts +474 -474
  5. package/dist/conversion/conversionhelpers.d.ts +21 -21
  6. package/dist/conversion/downcastdispatcher.d.ts +539 -538
  7. package/dist/conversion/downcasthelpers.d.ts +1129 -1129
  8. package/dist/conversion/mapper.d.ts +692 -697
  9. package/dist/conversion/modelconsumable.d.ts +196 -196
  10. package/dist/conversion/upcastdispatcher.d.ts +483 -482
  11. package/dist/conversion/upcasthelpers.d.ts +491 -491
  12. package/dist/conversion/viewconsumable.d.ts +330 -330
  13. package/dist/dataprocessor/basichtmlwriter.d.ts +15 -15
  14. package/dist/dataprocessor/dataprocessor.d.ts +57 -57
  15. package/dist/dataprocessor/htmldataprocessor.d.ts +72 -72
  16. package/dist/dataprocessor/htmlwriter.d.ts +11 -11
  17. package/dist/dataprocessor/xmldataprocessor.d.ts +86 -86
  18. package/dist/dev-utils/model.d.ts +128 -123
  19. package/dist/dev-utils/operationreplayer.d.ts +49 -49
  20. package/dist/dev-utils/utils.d.ts +33 -33
  21. package/dist/dev-utils/view.d.ts +314 -309
  22. package/dist/engineconfig.d.ts +39 -39
  23. package/dist/index.css.map +1 -1
  24. package/dist/index.d.ts +150 -150
  25. package/dist/index.js +34026 -40107
  26. package/dist/index.js.map +1 -1
  27. package/dist/legacyerrors.d.ts +0 -4
  28. package/dist/model/batch.d.ts +86 -86
  29. package/dist/model/differ.d.ts +504 -504
  30. package/dist/model/document.d.ts +265 -268
  31. package/dist/model/documentfragment.d.ts +214 -214
  32. package/dist/model/documentselection.d.ts +406 -410
  33. package/dist/model/element.d.ts +182 -182
  34. package/dist/model/history.d.ts +109 -109
  35. package/dist/model/item.d.ts +9 -9
  36. package/dist/model/liveposition.d.ts +70 -69
  37. package/dist/model/liverange.d.ts +93 -92
  38. package/dist/model/markercollection.d.ts +317 -324
  39. package/dist/model/model.d.ts +889 -909
  40. package/dist/model/node.d.ts +254 -254
  41. package/dist/model/nodelist.d.ts +110 -110
  42. package/dist/model/operation/attributeoperation.d.ts +98 -98
  43. package/dist/model/operation/detachoperation.d.ts +57 -57
  44. package/dist/model/operation/insertoperation.d.ts +85 -85
  45. package/dist/model/operation/markeroperation.d.ts +87 -87
  46. package/dist/model/operation/mergeoperation.d.ts +95 -95
  47. package/dist/model/operation/moveoperation.d.ts +97 -97
  48. package/dist/model/operation/nooperation.d.ts +33 -33
  49. package/dist/model/operation/operation.d.ts +94 -94
  50. package/dist/model/operation/operationfactory.d.ts +14 -14
  51. package/dist/model/operation/renameoperation.d.ts +78 -78
  52. package/dist/model/operation/rootattributeoperation.d.ts +93 -93
  53. package/dist/model/operation/rootoperation.d.ts +71 -71
  54. package/dist/model/operation/splitoperation.d.ts +104 -104
  55. package/dist/model/operation/transform.d.ts +91 -91
  56. package/dist/model/operation/utils.d.ts +58 -58
  57. package/dist/model/position.d.ts +535 -535
  58. package/dist/model/range.d.ts +458 -453
  59. package/dist/model/rootelement.d.ts +55 -55
  60. package/dist/model/schema.d.ts +1325 -1327
  61. package/dist/model/selection.d.ts +452 -471
  62. package/dist/model/text.d.ts +62 -62
  63. package/dist/model/textproxy.d.ts +140 -140
  64. package/dist/model/treewalker.d.ts +190 -190
  65. package/dist/model/typecheckable.d.ts +281 -281
  66. package/dist/model/utils/autoparagraphing.d.ts +29 -29
  67. package/dist/model/utils/deletecontent.d.ts +68 -68
  68. package/dist/model/utils/getselectedcontent.d.ts +27 -27
  69. package/dist/model/utils/insertcontent.d.ts +42 -42
  70. package/dist/model/utils/insertobject.d.ts +41 -41
  71. package/dist/model/utils/modifyselection.d.ts +44 -44
  72. package/dist/model/utils/selection-post-fixer.d.ts +71 -71
  73. package/dist/model/writer.d.ts +854 -854
  74. package/dist/view/attributeelement.d.ts +123 -123
  75. package/dist/view/containerelement.d.ts +49 -49
  76. package/dist/view/datatransfer.d.ts +70 -70
  77. package/dist/view/document.d.ts +175 -177
  78. package/dist/view/documentfragment.d.ts +158 -157
  79. package/dist/view/documentselection.d.ts +308 -307
  80. package/dist/view/domconverter.d.ts +612 -657
  81. package/dist/view/downcastwriter.d.ts +1006 -1006
  82. package/dist/view/editableelement.d.ts +64 -63
  83. package/dist/view/element.d.ts +754 -754
  84. package/dist/view/elementdefinition.d.ts +79 -79
  85. package/dist/view/emptyelement.d.ts +42 -42
  86. package/dist/view/filler.d.ts +75 -75
  87. package/dist/view/item.d.ts +9 -9
  88. package/dist/view/matcher.d.ts +412 -487
  89. package/dist/view/node.d.ts +164 -163
  90. package/dist/view/observer/arrowkeysobserver.d.ts +37 -37
  91. package/dist/view/observer/bubblingemittermixin.d.ts +163 -153
  92. package/dist/view/observer/bubblingeventinfo.d.ts +45 -42
  93. package/dist/view/observer/clickobserver.d.ts +36 -36
  94. package/dist/view/observer/compositionobserver.d.ts +67 -67
  95. package/dist/view/observer/domeventdata.d.ts +46 -46
  96. package/dist/view/observer/domeventobserver.d.ts +77 -74
  97. package/dist/view/observer/fakeselectionobserver.d.ts +42 -42
  98. package/dist/view/observer/focusobserver.d.ts +84 -84
  99. package/dist/view/observer/inputobserver.d.ts +76 -76
  100. package/dist/view/observer/keyobserver.d.ts +53 -53
  101. package/dist/view/observer/mouseobserver.d.ts +73 -73
  102. package/dist/view/observer/mutationobserver.d.ts +101 -101
  103. package/dist/view/observer/observer.d.ts +84 -83
  104. package/dist/view/observer/pointerobserver.d.ts +63 -63
  105. package/dist/view/observer/selectionobserver.d.ts +136 -136
  106. package/dist/view/observer/tabobserver.d.ts +38 -38
  107. package/dist/view/observer/touchobserver.d.ts +60 -60
  108. package/dist/view/placeholder.d.ts +80 -80
  109. package/dist/view/position.d.ts +187 -187
  110. package/dist/view/range.d.ts +282 -282
  111. package/dist/view/rawelement.d.ts +72 -72
  112. package/dist/view/renderer.d.ts +270 -272
  113. package/dist/view/rooteditableelement.d.ts +43 -43
  114. package/dist/view/selection.d.ts +356 -369
  115. package/dist/view/styles/background.d.ts +15 -15
  116. package/dist/view/styles/border.d.ts +27 -27
  117. package/dist/view/styles/margin.d.ts +12 -12
  118. package/dist/view/styles/padding.d.ts +12 -12
  119. package/dist/view/styles/utils.d.ts +72 -72
  120. package/dist/view/stylesmap.d.ts +715 -715
  121. package/dist/view/text.d.ts +75 -75
  122. package/dist/view/textproxy.d.ts +92 -92
  123. package/dist/view/tokenlist.d.ts +104 -104
  124. package/dist/view/treewalker.d.ts +201 -201
  125. package/dist/view/typecheckable.d.ts +445 -445
  126. package/dist/view/uielement.d.ts +93 -93
  127. package/dist/view/upcastwriter.d.ts +412 -412
  128. package/dist/view/view.d.ts +466 -469
  129. package/package.json +2 -2
@@ -1,321 +1,326 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module engine/dev-utils/view
7
- */
6
+ * @module engine/dev-utils/view
7
+ */
8
8
  /**
9
- * Collection of methods for manipulating the {@link module:engine/view/view view} for testing purposes.
10
- */
11
- import { EditingView } from '../view/view.js';
12
- import { ViewDocumentFragment } from '../view/documentfragment.js';
13
- import { ViewElement } from '../view/element.js';
14
- import { ViewDocumentSelection } from '../view/documentselection.js';
15
- import { ViewRange } from '../view/range.js';
16
- import { ViewPosition } from '../view/position.js';
17
- import { type ViewNode } from '../view/node.js';
18
- import { type ViewDomConverter } from '../view/domconverter.js';
9
+ * Collection of methods for manipulating the {@link module:engine/view/view view} for testing purposes.
10
+ */
11
+ import { EditingView } from "../view/view.js";
12
+ import { ViewDocumentFragment } from "../view/documentfragment.js";
13
+ import { ViewElement } from "../view/element.js";
14
+ import { ViewDocumentSelection } from "../view/documentselection.js";
15
+ import { ViewRange } from "../view/range.js";
16
+ import { ViewPosition } from "../view/position.js";
17
+ import { type ViewNode } from "../view/node.js";
18
+ import { type ViewDomConverter } from "../view/domconverter.js";
19
+ type GetViewDataOptions = {
20
+ withoutSelection?: boolean;
21
+ rootName?: string;
22
+ showType?: boolean;
23
+ showPriority?: boolean;
24
+ renderUIElements?: boolean;
25
+ renderRawElements?: boolean;
26
+ domConverter?: ViewDomConverter;
27
+ skipListItemIds?: boolean;
28
+ };
29
+ type GetViewData = {
30
+ (view: EditingView, options?: GetViewDataOptions): string;
31
+ _stringify: typeof _stringifyView;
32
+ };
33
+ type SetViewDataOptions = {
34
+ rootName?: string;
35
+ };
36
+ type SetViewData = {
37
+ (view: EditingView, data: string, options?: SetViewDataOptions): void;
38
+ _parse: typeof _parseView;
39
+ };
19
40
  /**
20
- * Writes the content of the {@link module:engine/view/document~ViewDocument document} to an HTML-like string.
21
- *
22
- * @param view The view to stringify.
23
- * @param options.withoutSelection Whether to write the selection. When set to `true`, the selection will
24
- * not be included in the returned string.
25
- * @param options.rootName The name of the root from which the data should be stringified. If not provided,
26
- * the default `main` name will be used.
27
- * @param options.showType When set to `true`, the type of elements will be printed (`<container:p>`
28
- * instead of `<p>`, `<attribute:b>` instead of `<b>` and `<empty:img>` instead of `<img>`).
29
- * @param options.showPriority When set to `true`, the attribute element's priority will be printed
30
- * (`<span view-priority="12">`, `<b view-priority="10">`).
31
- * @param options.renderUIElements When set to `true`, the inner content of each
32
- * {@link module:engine/view/uielement~ViewUIElement} will be printed.
33
- * @param options.renderRawElements When set to `true`, the inner content of each
34
- * {@link module:engine/view/rawelement~ViewRawElement} will be printed.
35
- * @param options.domConverter When set to an actual {@link module:engine/view/domconverter~ViewDomConverter ViewDomConverter}
36
- * instance, it lets the conversion go through exactly the same flow the editing view is going through,
37
- * i.e. with view data filtering. Otherwise the simple stub is used.
38
- * @returns The stringified data.
39
- */
40
- export declare function _getViewData(view: EditingView, options?: {
41
- withoutSelection?: boolean;
42
- rootName?: string;
43
- showType?: boolean;
44
- showPriority?: boolean;
45
- renderUIElements?: boolean;
46
- renderRawElements?: boolean;
47
- domConverter?: ViewDomConverter;
48
- skipListItemIds?: boolean;
49
- }): string;
50
- export declare namespace _getViewData {
51
- var _stringify: typeof _stringifyView;
52
- }
41
+ * Writes the content of the {@link module:engine/view/document~ViewDocument document} to an HTML-like string.
42
+ *
43
+ * @param view The view to stringify.
44
+ * @param options.withoutSelection Whether to write the selection. When set to `true`, the selection will
45
+ * not be included in the returned string.
46
+ * @param options.rootName The name of the root from which the data should be stringified. If not provided,
47
+ * the default `main` name will be used.
48
+ * @param options.showType When set to `true`, the type of elements will be printed (`<container:p>`
49
+ * instead of `<p>`, `<attribute:b>` instead of `<b>` and `<empty:img>` instead of `<img>`).
50
+ * @param options.showPriority When set to `true`, the attribute element's priority will be printed
51
+ * (`<span view-priority="12">`, `<b view-priority="10">`).
52
+ * @param options.renderUIElements When set to `true`, the inner content of each
53
+ * {@link module:engine/view/uielement~ViewUIElement} will be printed.
54
+ * @param options.renderRawElements When set to `true`, the inner content of each
55
+ * {@link module:engine/view/rawelement~ViewRawElement} will be printed.
56
+ * @param options.domConverter When set to an actual {@link module:engine/view/domconverter~ViewDomConverter ViewDomConverter}
57
+ * instance, it lets the conversion go through exactly the same flow the editing view is going through,
58
+ * i.e. with view data filtering. Otherwise the simple stub is used.
59
+ * @returns The stringified data.
60
+ */
61
+ export declare const _getViewData: GetViewData;
53
62
  /**
54
- * Sets the content of a view {@link module:engine/view/document~ViewDocument document} provided as an HTML-like string.
55
- *
56
- * @param data An HTML-like string to write into the document.
57
- * @param options.rootName The root name where _parseViewd data will be stored. If not provided,
58
- * the default `main` name will be used.
59
- */
60
- export declare function _setViewData(view: EditingView, data: string, options?: {
61
- rootName?: string;
62
- }): void;
63
- export declare namespace _setViewData {
64
- var _parse: typeof _parseView;
65
- }
63
+ * Sets the content of a view {@link module:engine/view/document~ViewDocument document} provided as an HTML-like string.
64
+ *
65
+ * @param data An HTML-like string to write into the document.
66
+ * @param options.rootName The root name where _parseViewd data will be stored. If not provided,
67
+ * the default `main` name will be used.
68
+ */
69
+ export declare const _setViewData: SetViewData;
66
70
  /**
67
- * Converts view elements to HTML-like string representation.
68
- *
69
- * A root element can be provided as {@link module:engine/view/text~ViewText text}:
70
- *
71
- * ```ts
72
- * const text = downcastWriter.createText( 'foobar' );
73
- * stringify( text ); // 'foobar'
74
- * ```
75
- *
76
- * or as an {@link module:engine/view/element~ViewElement element}:
77
- *
78
- * ```ts
79
- * const element = downcastWriter.createElement( 'p', null, downcastWriter.createText( 'foobar' ) );
80
- * stringify( element ); // '<p>foobar</p>'
81
- * ```
82
- *
83
- * or as a {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}:
84
- *
85
- * ```ts
86
- * const text = downcastWriter.createText( 'foobar' );
87
- * const b = downcastWriter.createElement( 'b', { name: 'test' }, text );
88
- * const p = downcastWriter.createElement( 'p', { style: 'color:red;' } );
89
- * const fragment = downcastWriter.createDocumentFragment( [ p, b ] );
90
- *
91
- * stringify( fragment ); // '<p style="color:red;"></p><b name="test">foobar</b>'
92
- * ```
93
- *
94
- * Additionally, a {@link module:engine/view/documentselection~ViewDocumentSelection selection} instance can be provided.
95
- * Ranges from the selection will then be included in the output data.
96
- * If a range position is placed inside the element node, it will be represented with `[` and `]`:
97
- *
98
- * ```ts
99
- * const text = downcastWriter.createText( 'foobar' );
100
- * const b = downcastWriter.createElement( 'b', null, text );
101
- * const p = downcastWriter.createElement( 'p', null, b );
102
- * const selection = downcastWriter.createSelection(
103
- * downcastWriter.createRangeIn( p )
104
- * );
105
- *
106
- * stringify( p, selection ); // '<p>[<b>foobar</b>]</p>'
107
- * ```
108
- *
109
- * If a range is placed inside the text node, it will be represented with `{` and `}`:
110
- *
111
- * ```ts
112
- * const text = downcastWriter.createText( 'foobar' );
113
- * const b = downcastWriter.createElement( 'b', null, text );
114
- * const p = downcastWriter.createElement( 'p', null, b );
115
- * const selection = downcastWriter.createSelection(
116
- * downcastWriter.createRange( downcastWriter.createPositionAt( text, 1 ), downcastWriter.createPositionAt( text, 5 ) )
117
- * );
118
- *
119
- * stringify( p, selection ); // '<p><b>f{ooba}r</b></p>'
120
- * ```
121
- *
122
- * ** Note: **
123
- * It is possible to unify selection markers to `[` and `]` for both (inside and outside text)
124
- * by setting the `sameSelectionCharacters=true` option. It is mainly used when the view stringify option is used by
125
- * model utilities.
126
- *
127
- * Multiple ranges are supported:
128
- *
129
- * ```ts
130
- * const text = downcastWriter.createText( 'foobar' );
131
- * const selection = downcastWriter.createSelection( [
132
- * downcastWriter.createRange( downcastWriter.createPositionAt( text, 0 ), downcastWriter.createPositionAt( text, 1 ) ),
133
- * downcastWriter.createRange( downcastWriter.createPositionAt( text, 3 ), downcastWriter.createPositionAt( text, 5 ) )
134
- * ] );
135
- *
136
- * stringify( text, selection ); // '{f}oo{ba}r'
137
- * ```
138
- *
139
- * A {@link module:engine/view/range~ViewRange range} or {@link module:engine/view/position~ViewPosition position} instance can be provided
140
- * instead of the {@link module:engine/view/documentselection~ViewDocumentSelection selection} instance. If a range instance
141
- * is provided, it will be converted to a selection containing this range. If a position instance is provided, it will
142
- * be converted to a selection containing one range collapsed at this position.
143
- *
144
- * ```ts
145
- * const text = downcastWriter.createText( 'foobar' );
146
- * const range = downcastWriter.createRange( downcastWriter.createPositionAt( text, 0 ), downcastWriter.createPositionAt( text, 1 ) );
147
- * const position = downcastWriter.createPositionAt( text, 3 );
148
- *
149
- * stringify( text, range ); // '{f}oobar'
150
- * stringify( text, position ); // 'foo{}bar'
151
- * ```
152
- *
153
- * An additional `options` object can be provided.
154
- * If `options.showType` is set to `true`, element's types will be
155
- * presented for {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements},
156
- * {@link module:engine/view/containerelement~ViewContainerElement container elements}
157
- * {@link module:engine/view/emptyelement~ViewEmptyElement empty elements}
158
- * and {@link module:engine/view/uielement~ViewUIElement UI elements}:
159
- *
160
- * ```ts
161
- * const attribute = downcastWriter.createAttributeElement( 'b' );
162
- * const container = downcastWriter.createContainerElement( 'p' );
163
- * const empty = downcastWriter.createEmptyElement( 'img' );
164
- * const ui = downcastWriter.createUIElement( 'span' );
165
- * getData( attribute, null, { showType: true } ); // '<attribute:b></attribute:b>'
166
- * getData( container, null, { showType: true } ); // '<container:p></container:p>'
167
- * getData( empty, null, { showType: true } ); // '<empty:img></empty:img>'
168
- * getData( ui, null, { showType: true } ); // '<ui:span></ui:span>'
169
- * ```
170
- *
171
- * If `options.showPriority` is set to `true`, a priority will be displayed for all
172
- * {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements}.
173
- *
174
- * ```ts
175
- * const attribute = downcastWriter.createAttributeElement( 'b' );
176
- * attribute._priority = 20;
177
- * getData( attribute, null, { showPriority: true } ); // <b view-priority="20"></b>
178
- * ```
179
- *
180
- * If `options.showAttributeElementId` is set to `true`, the attribute element's id will be displayed for all
181
- * {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} that have it set.
182
- *
183
- * ```ts
184
- * const attribute = downcastWriter.createAttributeElement( 'span' );
185
- * attribute._id = 'marker:foo';
186
- * getData( attribute, null, { showAttributeElementId: true } ); // <span view-id="marker:foo"></span>
187
- * ```
188
- *
189
- * @param node The node to stringify.
190
- * @param selectionOrPositionOrRange A selection instance whose ranges will be included in the returned string data.
191
- * If a range instance is provided, it will be converted to a selection containing this range. If a position instance
192
- * is provided, it will be converted to a selection containing one range collapsed at this position.
193
- * @param options An object with additional options.
194
- * @param options.showType When set to `true`, the type of elements will be printed (`<container:p>`
195
- * instead of `<p>`, `<attribute:b>` instead of `<b>` and `<empty:img>` instead of `<img>`).
196
- * @param options.showPriority When set to `true`, the attribute element's priority will be printed
197
- * (`<span view-priority="12">`, `<b view-priority="10">`).
198
- * @param options.showAttributeElementId When set to `true`, attribute element's id will be printed
199
- * (`<span id="marker:foo">`).
200
- * @param options.ignoreRoot When set to `true`, the root's element opening and closing will not be printed.
201
- * Mainly used by the `getData` function to ignore the {@link module:engine/view/document~ViewDocument document's} root element.
202
- * @param options.sameSelectionCharacters When set to `true`, the selection inside the text will be marked as
203
- * `{` and `}` and the selection outside the text as `[` and `]`. When set to `false`, both will be marked as `[` and `]` only.
204
- * @param options.renderUIElements When set to `true`, the inner content of each
205
- * {@link module:engine/view/uielement~ViewUIElement} will be printed.
206
- * @param options.renderRawElements When set to `true`, the inner content of each
207
- * {@link module:engine/view/rawelement~ViewRawElement} will be printed.
208
- * @param options.domConverter When set to an actual {@link module:engine/view/domconverter~ViewDomConverter ViewDomConverter}
209
- * instance, it lets the conversion go through exactly the same flow the editing view is going through,
210
- * i.e. with view data filtering. Otherwise the simple stub is used.
211
- * @returns An HTML-like string representing the view.
212
- */
71
+ * Converts view elements to HTML-like string representation.
72
+ *
73
+ * A root element can be provided as {@link module:engine/view/text~ViewText text}:
74
+ *
75
+ * ```ts
76
+ * const text = downcastWriter.createText( 'foobar' );
77
+ * stringify( text ); // 'foobar'
78
+ * ```
79
+ *
80
+ * or as an {@link module:engine/view/element~ViewElement element}:
81
+ *
82
+ * ```ts
83
+ * const element = downcastWriter.createElement( 'p', null, downcastWriter.createText( 'foobar' ) );
84
+ * stringify( element ); // '<p>foobar</p>'
85
+ * ```
86
+ *
87
+ * or as a {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}:
88
+ *
89
+ * ```ts
90
+ * const text = downcastWriter.createText( 'foobar' );
91
+ * const b = downcastWriter.createElement( 'b', { name: 'test' }, text );
92
+ * const p = downcastWriter.createElement( 'p', { style: 'color:red;' } );
93
+ * const fragment = downcastWriter.createDocumentFragment( [ p, b ] );
94
+ *
95
+ * stringify( fragment ); // '<p style="color:red;"></p><b name="test">foobar</b>'
96
+ * ```
97
+ *
98
+ * Additionally, a {@link module:engine/view/documentselection~ViewDocumentSelection selection} instance can be provided.
99
+ * Ranges from the selection will then be included in the output data.
100
+ * If a range position is placed inside the element node, it will be represented with `[` and `]`:
101
+ *
102
+ * ```ts
103
+ * const text = downcastWriter.createText( 'foobar' );
104
+ * const b = downcastWriter.createElement( 'b', null, text );
105
+ * const p = downcastWriter.createElement( 'p', null, b );
106
+ * const selection = downcastWriter.createSelection(
107
+ * downcastWriter.createRangeIn( p )
108
+ * );
109
+ *
110
+ * stringify( p, selection ); // '<p>[<b>foobar</b>]</p>'
111
+ * ```
112
+ *
113
+ * If a range is placed inside the text node, it will be represented with `{` and `}`:
114
+ *
115
+ * ```ts
116
+ * const text = downcastWriter.createText( 'foobar' );
117
+ * const b = downcastWriter.createElement( 'b', null, text );
118
+ * const p = downcastWriter.createElement( 'p', null, b );
119
+ * const selection = downcastWriter.createSelection(
120
+ * downcastWriter.createRange( downcastWriter.createPositionAt( text, 1 ), downcastWriter.createPositionAt( text, 5 ) )
121
+ * );
122
+ *
123
+ * stringify( p, selection ); // '<p><b>f{ooba}r</b></p>'
124
+ * ```
125
+ *
126
+ * ** Note: **
127
+ * It is possible to unify selection markers to `[` and `]` for both (inside and outside text)
128
+ * by setting the `sameSelectionCharacters=true` option. It is mainly used when the view stringify option is used by
129
+ * model utilities.
130
+ *
131
+ * Multiple ranges are supported:
132
+ *
133
+ * ```ts
134
+ * const text = downcastWriter.createText( 'foobar' );
135
+ * const selection = downcastWriter.createSelection( [
136
+ * downcastWriter.createRange( downcastWriter.createPositionAt( text, 0 ), downcastWriter.createPositionAt( text, 1 ) ),
137
+ * downcastWriter.createRange( downcastWriter.createPositionAt( text, 3 ), downcastWriter.createPositionAt( text, 5 ) )
138
+ * ] );
139
+ *
140
+ * stringify( text, selection ); // '{f}oo{ba}r'
141
+ * ```
142
+ *
143
+ * A {@link module:engine/view/range~ViewRange range} or {@link module:engine/view/position~ViewPosition position} instance can be provided
144
+ * instead of the {@link module:engine/view/documentselection~ViewDocumentSelection selection} instance. If a range instance
145
+ * is provided, it will be converted to a selection containing this range. If a position instance is provided, it will
146
+ * be converted to a selection containing one range collapsed at this position.
147
+ *
148
+ * ```ts
149
+ * const text = downcastWriter.createText( 'foobar' );
150
+ * const range = downcastWriter.createRange( downcastWriter.createPositionAt( text, 0 ), downcastWriter.createPositionAt( text, 1 ) );
151
+ * const position = downcastWriter.createPositionAt( text, 3 );
152
+ *
153
+ * stringify( text, range ); // '{f}oobar'
154
+ * stringify( text, position ); // 'foo{}bar'
155
+ * ```
156
+ *
157
+ * An additional `options` object can be provided.
158
+ * If `options.showType` is set to `true`, element's types will be
159
+ * presented for {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements},
160
+ * {@link module:engine/view/containerelement~ViewContainerElement container elements}
161
+ * {@link module:engine/view/emptyelement~ViewEmptyElement empty elements}
162
+ * and {@link module:engine/view/uielement~ViewUIElement UI elements}:
163
+ *
164
+ * ```ts
165
+ * const attribute = downcastWriter.createAttributeElement( 'b' );
166
+ * const container = downcastWriter.createContainerElement( 'p' );
167
+ * const empty = downcastWriter.createEmptyElement( 'img' );
168
+ * const ui = downcastWriter.createUIElement( 'span' );
169
+ * getData( attribute, null, { showType: true } ); // '<attribute:b></attribute:b>'
170
+ * getData( container, null, { showType: true } ); // '<container:p></container:p>'
171
+ * getData( empty, null, { showType: true } ); // '<empty:img></empty:img>'
172
+ * getData( ui, null, { showType: true } ); // '<ui:span></ui:span>'
173
+ * ```
174
+ *
175
+ * If `options.showPriority` is set to `true`, a priority will be displayed for all
176
+ * {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements}.
177
+ *
178
+ * ```ts
179
+ * const attribute = downcastWriter.createAttributeElement( 'b' );
180
+ * attribute._priority = 20;
181
+ * getData( attribute, null, { showPriority: true } ); // <b view-priority="20"></b>
182
+ * ```
183
+ *
184
+ * If `options.showAttributeElementId` is set to `true`, the attribute element's id will be displayed for all
185
+ * {@link module:engine/view/attributeelement~ViewAttributeElement attribute elements} that have it set.
186
+ *
187
+ * ```ts
188
+ * const attribute = downcastWriter.createAttributeElement( 'span' );
189
+ * attribute._id = 'marker:foo';
190
+ * getData( attribute, null, { showAttributeElementId: true } ); // <span view-id="marker:foo"></span>
191
+ * ```
192
+ *
193
+ * @param node The node to stringify.
194
+ * @param selectionOrPositionOrRange A selection instance whose ranges will be included in the returned string data.
195
+ * If a range instance is provided, it will be converted to a selection containing this range. If a position instance
196
+ * is provided, it will be converted to a selection containing one range collapsed at this position.
197
+ * @param options An object with additional options.
198
+ * @param options.showType When set to `true`, the type of elements will be printed (`<container:p>`
199
+ * instead of `<p>`, `<attribute:b>` instead of `<b>` and `<empty:img>` instead of `<img>`).
200
+ * @param options.showPriority When set to `true`, the attribute element's priority will be printed
201
+ * (`<span view-priority="12">`, `<b view-priority="10">`).
202
+ * @param options.showAttributeElementId When set to `true`, attribute element's id will be printed
203
+ * (`<span id="marker:foo">`).
204
+ * @param options.ignoreRoot When set to `true`, the root's element opening and closing will not be printed.
205
+ * Mainly used by the `getData` function to ignore the {@link module:engine/view/document~ViewDocument document's} root element.
206
+ * @param options.sameSelectionCharacters When set to `true`, the selection inside the text will be marked as
207
+ * `{` and `}` and the selection outside the text as `[` and `]`. When set to `false`, both will be marked as `[` and `]` only.
208
+ * @param options.renderUIElements When set to `true`, the inner content of each
209
+ * {@link module:engine/view/uielement~ViewUIElement} will be printed.
210
+ * @param options.renderRawElements When set to `true`, the inner content of each
211
+ * {@link module:engine/view/rawelement~ViewRawElement} will be printed.
212
+ * @param options.domConverter When set to an actual {@link module:engine/view/domconverter~ViewDomConverter ViewDomConverter}
213
+ * instance, it lets the conversion go through exactly the same flow the editing view is going through,
214
+ * i.e. with view data filtering. Otherwise the simple stub is used.
215
+ * @returns An HTML-like string representing the view.
216
+ */
213
217
  export declare function _stringifyView(node: ViewNode | ViewDocumentFragment, selectionOrPositionOrRange?: ViewDocumentSelection | ViewPosition | ViewRange | null, options?: {
214
- showType?: boolean;
215
- showPriority?: boolean;
216
- showAttributeElementId?: boolean;
217
- ignoreRoot?: boolean;
218
- sameSelectionCharacters?: boolean;
219
- renderUIElements?: boolean;
220
- renderRawElements?: boolean;
221
- domConverter?: ViewDomConverter;
222
- skipListItemIds?: boolean;
218
+ showType?: boolean;
219
+ showPriority?: boolean;
220
+ showAttributeElementId?: boolean;
221
+ ignoreRoot?: boolean;
222
+ sameSelectionCharacters?: boolean;
223
+ renderUIElements?: boolean;
224
+ renderRawElements?: boolean;
225
+ domConverter?: ViewDomConverter;
226
+ skipListItemIds?: boolean;
223
227
  }): string;
224
228
  /**
225
- * Parses an HTML-like string and returns a view tree.
226
- * A simple string will be converted to a {@link module:engine/view/text~ViewText text} node:
227
- *
228
- * ```ts
229
- * _parseView( 'foobar' ); // Returns an instance of text.
230
- * ```
231
- *
232
- * {@link module:engine/view/element~ViewElement Elements} will be _parseViewd with attributes as children:
233
- *
234
- * ```ts
235
- * _parseView( '<b name="baz">foobar</b>' ); // Returns an instance of element with the `baz` attribute and a text child node.
236
- * ```
237
- *
238
- * Multiple nodes provided on root level will be converted to a
239
- * {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}:
240
- *
241
- * ```ts
242
- * _parseView( '<b>foo</b><i>bar</i>' ); // Returns a document fragment with two child elements.
243
- * ```
244
- *
245
- * The method can _parseView multiple {@link module:engine/view/range~ViewRange ranges} provided in string data and return a
246
- * {@link module:engine/view/documentselection~ViewDocumentSelection selection} instance containing these ranges. Ranges placed inside
247
- * {@link module:engine/view/text~ViewText text} nodes should be marked using `{` and `}` brackets:
248
- *
249
- * ```ts
250
- * const { text, selection } = _parseView( 'f{ooba}r' );
251
- * ```
252
- *
253
- * Ranges placed outside text nodes should be marked using `[` and `]` brackets:
254
- *
255
- * ```ts
256
- * const { root, selection } = _parseView( '<p>[<b>foobar</b>]</p>' );
257
- * ```
258
- *
259
- * ** Note: **
260
- * It is possible to unify selection markers to `[` and `]` for both (inside and outside text)
261
- * by setting `sameSelectionCharacters=true` option. It is mainly used when the view _parseView option is used by model utilities.
262
- *
263
- * Sometimes there is a need for defining the order of ranges inside the created selection. This can be achieved by providing
264
- * the range order array as an additional parameter:
265
- *
266
- * ```ts
267
- * const { root, selection } = _parseView( '{fo}ob{ar}{ba}z', { order: [ 2, 3, 1 ] } );
268
- * ```
269
- *
270
- * In the example above, the first range (`{fo}`) will be added to the selection as the second one, the second range (`{ar}`) will be
271
- * added as the third and the third range (`{ba}`) will be added as the first one.
272
- *
273
- * If the selection's last range should be added as a backward one
274
- * (so the {@link module:engine/view/documentselection~ViewDocumentSelection#anchor selection anchor} is represented
275
- * by the `end` position and {@link module:engine/view/documentselection~ViewDocumentSelection#focus selection focus} is
276
- * represented by the `start` position), use the `lastRangeBackward` flag:
277
- *
278
- * ```ts
279
- * const { root, selection } = _parseView( `{foo}bar{baz}`, { lastRangeBackward: true } );
280
- * ```
281
- *
282
- * Some more examples and edge cases:
283
- *
284
- * ```ts
285
- * // Returns an empty document fragment.
286
- * _parseView( '' );
287
- *
288
- * // Returns an empty document fragment and a collapsed selection.
289
- * const { root, selection } = _parseView( '[]' );
290
- *
291
- * // Returns an element and a selection that is placed inside the document fragment containing that element.
292
- * const { root, selection } = _parseView( '[<a></a>]' );
293
- * ```
294
- *
295
- * @param data An HTML-like string to be parsed.
296
- * @param options.order An array with the order of parsed ranges added to the returned
297
- * {@link module:engine/view/documentselection~ViewDocumentSelection Selection} instance. Each element should represent the
298
- * desired position of each range in the selection instance. For example: `[2, 3, 1]` means that the first range will be
299
- * placed as the second, the second as the third and the third as the first.
300
- * @param options.lastRangeBackward If set to `true`, the last range will be added as backward to the returned
301
- * {@link module:engine/view/documentselection~ViewDocumentSelection selection} instance.
302
- * @param options.rootElement The default root to use when parsing elements.
303
- * When set to `null`, the root element will be created automatically. If set to
304
- * {@link module:engine/view/element~ViewElement Element} or
305
- * {@link module:engine/view/documentfragment~ViewDocumentFragment DocumentFragment},
306
- * this node will be used as the root for all parsed nodes.
307
- * @param options.sameSelectionCharacters When set to `false`, the selection inside the text should be marked using
308
- * `{` and `}` and the selection outside the ext using `[` and `]`. When set to `true`, both should be marked with `[` and `]` only.
309
- * @returns Returns the parsed view node or an object with two fields: `view` and `selection` when selection ranges were included in the
310
- * data to parse.
311
- */
229
+ * Parses an HTML-like string and returns a view tree.
230
+ * A simple string will be converted to a {@link module:engine/view/text~ViewText text} node:
231
+ *
232
+ * ```ts
233
+ * _parseView( 'foobar' ); // Returns an instance of text.
234
+ * ```
235
+ *
236
+ * {@link module:engine/view/element~ViewElement Elements} will be _parseViewd with attributes as children:
237
+ *
238
+ * ```ts
239
+ * _parseView( '<b name="baz">foobar</b>' ); // Returns an instance of element with the `baz` attribute and a text child node.
240
+ * ```
241
+ *
242
+ * Multiple nodes provided on root level will be converted to a
243
+ * {@link module:engine/view/documentfragment~ViewDocumentFragment document fragment}:
244
+ *
245
+ * ```ts
246
+ * _parseView( '<b>foo</b><i>bar</i>' ); // Returns a document fragment with two child elements.
247
+ * ```
248
+ *
249
+ * The method can _parseView multiple {@link module:engine/view/range~ViewRange ranges} provided in string data and return a
250
+ * {@link module:engine/view/documentselection~ViewDocumentSelection selection} instance containing these ranges. Ranges placed inside
251
+ * {@link module:engine/view/text~ViewText text} nodes should be marked using `{` and `}` brackets:
252
+ *
253
+ * ```ts
254
+ * const { text, selection } = _parseView( 'f{ooba}r' );
255
+ * ```
256
+ *
257
+ * Ranges placed outside text nodes should be marked using `[` and `]` brackets:
258
+ *
259
+ * ```ts
260
+ * const { root, selection } = _parseView( '<p>[<b>foobar</b>]</p>' );
261
+ * ```
262
+ *
263
+ * ** Note: **
264
+ * It is possible to unify selection markers to `[` and `]` for both (inside and outside text)
265
+ * by setting `sameSelectionCharacters=true` option. It is mainly used when the view _parseView option is used by model utilities.
266
+ *
267
+ * Sometimes there is a need for defining the order of ranges inside the created selection. This can be achieved by providing
268
+ * the range order array as an additional parameter:
269
+ *
270
+ * ```ts
271
+ * const { root, selection } = _parseView( '{fo}ob{ar}{ba}z', { order: [ 2, 3, 1 ] } );
272
+ * ```
273
+ *
274
+ * In the example above, the first range (`{fo}`) will be added to the selection as the second one, the second range (`{ar}`) will be
275
+ * added as the third and the third range (`{ba}`) will be added as the first one.
276
+ *
277
+ * If the selection's last range should be added as a backward one
278
+ * (so the {@link module:engine/view/documentselection~ViewDocumentSelection#anchor selection anchor} is represented
279
+ * by the `end` position and {@link module:engine/view/documentselection~ViewDocumentSelection#focus selection focus} is
280
+ * represented by the `start` position), use the `lastRangeBackward` flag:
281
+ *
282
+ * ```ts
283
+ * const { root, selection } = _parseView( `{foo}bar{baz}`, { lastRangeBackward: true } );
284
+ * ```
285
+ *
286
+ * Some more examples and edge cases:
287
+ *
288
+ * ```ts
289
+ * // Returns an empty document fragment.
290
+ * _parseView( '' );
291
+ *
292
+ * // Returns an empty document fragment and a collapsed selection.
293
+ * const { root, selection } = _parseView( '[]' );
294
+ *
295
+ * // Returns an element and a selection that is placed inside the document fragment containing that element.
296
+ * const { root, selection } = _parseView( '[<a></a>]' );
297
+ * ```
298
+ *
299
+ * @param data An HTML-like string to be parsed.
300
+ * @param options.order An array with the order of parsed ranges added to the returned
301
+ * {@link module:engine/view/documentselection~ViewDocumentSelection Selection} instance. Each element should represent the
302
+ * desired position of each range in the selection instance. For example: `[2, 3, 1]` means that the first range will be
303
+ * placed as the second, the second as the third and the third as the first.
304
+ * @param options.lastRangeBackward If set to `true`, the last range will be added as backward to the returned
305
+ * {@link module:engine/view/documentselection~ViewDocumentSelection selection} instance.
306
+ * @param options.rootElement The default root to use when parsing elements.
307
+ * When set to `null`, the root element will be created automatically. If set to
308
+ * {@link module:engine/view/element~ViewElement Element} or
309
+ * {@link module:engine/view/documentfragment~ViewDocumentFragment DocumentFragment},
310
+ * this node will be used as the root for all parsed nodes.
311
+ * @param options.sameSelectionCharacters When set to `false`, the selection inside the text should be marked using
312
+ * `{` and `}` and the selection outside the ext using `[` and `]`. When set to `true`, both should be marked with `[` and `]` only.
313
+ * @returns Returns the parsed view node or an object with two fields: `view` and `selection` when selection ranges were included in the
314
+ * data to parse.
315
+ */
312
316
  export declare function _parseView(data: string, options?: {
313
- order?: Array<number>;
314
- lastRangeBackward?: boolean;
315
- rootElement?: ViewElement | ViewDocumentFragment;
316
- sameSelectionCharacters?: boolean;
317
- inlineObjectElements?: Array<string>;
317
+ order?: Array<number>;
318
+ lastRangeBackward?: boolean;
319
+ rootElement?: ViewElement | ViewDocumentFragment;
320
+ sameSelectionCharacters?: boolean;
321
+ inlineObjectElements?: Array<string>;
318
322
  }): ViewNode | ViewDocumentFragment | {
319
- view: ViewNode | ViewDocumentFragment;
320
- selection: ViewDocumentSelection;
323
+ view: ViewNode | ViewDocumentFragment;
324
+ selection: ViewDocumentSelection;
321
325
  };
326
+ export {};