@ckeditor/ckeditor5-engine 48.2.0 → 48.3.0-alpha.1

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,505 +1,505 @@
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
- * Contains the {@link module:engine/view/view view} to {@link module:engine/model/model model} converters for
7
- * {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher}.
8
- *
9
- * @module engine/conversion/upcasthelpers
10
- */
11
- import { type MatchClassPatterns, type MatcherPattern, type MatchPropertyPatterns } from '../view/matcher.js';
12
- import { ConversionHelpers } from './conversionhelpers.js';
13
- import type { UpcastDispatcher, UpcastConversionApi, UpcastConversionData } from './upcastdispatcher.js';
14
- import { type ModelElement } from '../model/element.js';
15
- import type { ViewDocumentFragment, ViewElement, ViewText } from '../index.js';
16
- import { type Mapper } from './mapper.js';
17
- import { type Model } from '../model/model.js';
18
- import { type ViewSelection } from '../view/selection.js';
19
- import { type ViewDocumentSelection } from '../view/documentselection.js';
20
- import { type EventInfo, type PriorityString } from '@ckeditor/ckeditor5-utils';
6
+ * Contains the {@link module:engine/view/view view} to {@link module:engine/model/model model} converters for
7
+ * {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher}.
8
+ *
9
+ * @module engine/conversion/upcasthelpers
10
+ */
11
+ import { type MatchClassPatterns, type MatcherPattern, type MatchPropertyPatterns } from "../view/matcher.js";
12
+ import { ConversionHelpers } from "./conversionhelpers.js";
13
+ import type { UpcastDispatcher, UpcastConversionApi, UpcastConversionData } from "./upcastdispatcher.js";
14
+ import { type ModelElement } from "../model/element.js";
15
+ import type { ViewDocumentFragment, ViewElement, ViewText } from "../index.js";
16
+ import { type Mapper } from "./mapper.js";
17
+ import { type Model } from "../model/model.js";
18
+ import { type ViewSelection } from "../view/selection.js";
19
+ import { type ViewDocumentSelection } from "../view/documentselection.js";
20
+ import { type EventInfo, type PriorityString } from "@ckeditor/ckeditor5-utils";
21
21
  /**
22
- * Upcast conversion helper functions.
23
- *
24
- * Learn more about {@glink framework/deep-dive/conversion/upcast upcast helpers}.
25
- *
26
- * @extends module:engine/conversion/conversionhelpers~ConversionHelpers
27
- */
22
+ * Upcast conversion helper functions.
23
+ *
24
+ * Learn more about {@glink framework/deep-dive/conversion/upcast upcast helpers}.
25
+ *
26
+ * @extends module:engine/conversion/conversionhelpers~ConversionHelpers
27
+ */
28
28
  export declare class UpcastHelpers extends ConversionHelpers<UpcastDispatcher> {
29
- /**
30
- * View element to model element conversion helper.
31
- *
32
- * This conversion results in creating a model element. For example,
33
- * view `<p>Foo</p>` becomes `<paragraph>Foo</paragraph>` in the model.
34
- *
35
- * Keep in mind that the element will be inserted only if it is allowed
36
- * by {@link module:engine/model/schema~ModelSchema schema} configuration.
37
- *
38
- * ```ts
39
- * editor.conversion.for( 'upcast' ).elementToElement( {
40
- * view: 'p',
41
- * model: 'paragraph'
42
- * } );
43
- *
44
- * editor.conversion.for( 'upcast' ).elementToElement( {
45
- * view: 'p',
46
- * model: 'paragraph',
47
- * converterPriority: 'high'
48
- * } );
49
- *
50
- * editor.conversion.for( 'upcast' ).elementToElement( {
51
- * view: {
52
- * name: 'p',
53
- * classes: 'fancy'
54
- * },
55
- * model: 'fancyParagraph'
56
- * } );
57
- *
58
- * editor.conversion.for( 'upcast' ).elementToElement( {
59
- * view: {
60
- * name: 'p',
61
- * classes: 'heading'
62
- * },
63
- * model: ( viewElement, conversionApi ) => {
64
- * const modelWriter = conversionApi.writer;
65
- *
66
- * return modelWriter.createElement( 'heading', { level: viewElement.getAttribute( 'data-level' ) } );
67
- * }
68
- * } );
69
- * ```
70
- *
71
- * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter
72
- * to the conversion process.
73
- *
74
- * @param config Conversion configuration.
75
- * @param config.view Pattern matching all view elements which should be converted. If not set, the converter
76
- * will fire for every view element.
77
- * @param config.model Name of the model element, a model element instance or a function that takes a view element
78
- * and {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API}
79
- * and returns a model element. The model element will be inserted in the model.
80
- * @param config.converterPriority Converter priority.
81
- */
82
- elementToElement(config: {
83
- view: MatcherPattern;
84
- model: string | UpcastElementCreatorFunction;
85
- converterPriority?: PriorityString;
86
- }): this;
87
- /**
88
- * View element to model attribute conversion helper.
89
- *
90
- * This conversion results in setting an attribute on a model node. For example, view `<strong>Foo</strong>` becomes
91
- * `Foo` {@link module:engine/model/text~ModelText model text node} with `bold` attribute set to `true`.
92
- *
93
- * This helper is meant to set a model attribute on all the elements that are inside the converted element:
94
- *
95
- * ```
96
- * <strong>Foo</strong> --> <strong><p>Foo</p></strong> --> <paragraph><$text bold="true">Foo</$text></paragraph>
97
- * ```
98
- *
99
- * Above is a sample of HTML code, that goes through autoparagraphing (first step) and then is converted (second step).
100
- * Even though `<strong>` is over `<p>` element, `bold="true"` was added to the text. See
101
- * {@link module:engine/conversion/upcasthelpers~UpcastHelpers#attributeToAttribute} for comparison.
102
- *
103
- * Keep in mind that the attribute will be set only if it is allowed by
104
- * {@link module:engine/model/schema~ModelSchema schema} configuration.
105
- *
106
- * ```ts
107
- * editor.conversion.for( 'upcast' ).elementToAttribute( {
108
- * view: 'strong',
109
- * model: 'bold'
110
- * } );
111
- *
112
- * editor.conversion.for( 'upcast' ).elementToAttribute( {
113
- * view: 'strong',
114
- * model: 'bold',
115
- * converterPriority: 'high'
116
- * } );
117
- *
118
- * editor.conversion.for( 'upcast' ).elementToAttribute( {
119
- * view: {
120
- * name: 'span',
121
- * classes: 'bold'
122
- * },
123
- * model: 'bold'
124
- * } );
125
- *
126
- * editor.conversion.for( 'upcast' ).elementToAttribute( {
127
- * view: {
128
- * name: 'span',
129
- * classes: [ 'styled', 'styled-dark' ]
130
- * },
131
- * model: {
132
- * key: 'styled',
133
- * value: 'dark'
134
- * }
135
- * } );
136
- *
137
- * editor.conversion.for( 'upcast' ).elementToAttribute( {
138
- * view: {
139
- * name: 'span',
140
- * styles: {
141
- * 'font-size': /[\s\S]+/
142
- * }
143
- * },
144
- * model: {
145
- * key: 'fontSize',
146
- * value: ( viewElement, conversionApi ) => {
147
- * const fontSize = viewElement.getStyle( 'font-size' );
148
- * const value = fontSize.substr( 0, fontSize.length - 2 );
149
- *
150
- * if ( value <= 10 ) {
151
- * return 'small';
152
- * } else if ( value > 12 ) {
153
- * return 'big';
154
- * }
155
- *
156
- * return null;
157
- * }
158
- * }
159
- * } );
160
- * ```
161
- *
162
- * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter
163
- * to the conversion process.
164
- *
165
- * @param config Conversion configuration.
166
- * @param config.view Pattern matching all view elements which should be converted.
167
- * @param config.model Model attribute key or an object with `key` and `value` properties, describing
168
- * the model attribute. `value` property may be set as a function that takes a view element and
169
- * {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} and returns the value.
170
- * If `String` is given, the model attribute value will be set to `true`.
171
- * @param config.converterPriority Converter priority. Defaults to `low`.
172
- */
173
- elementToAttribute(config: {
174
- view: MatcherPattern;
175
- model: string | {
176
- key: string;
177
- value?: unknown;
178
- };
179
- converterPriority?: PriorityString;
180
- }): this;
181
- /**
182
- * View attribute to model attribute conversion helper.
183
- *
184
- * This conversion results in setting an attribute on a model node. For example, view `<img src="foo.jpg"></img>` becomes
185
- * `<imageBlock source="foo.jpg"></imageBlock>` in the model.
186
- *
187
- * This helper is meant to convert view attributes from view elements which got converted to the model, so the view attribute
188
- * is set only on the corresponding model node:
189
- *
190
- * ```
191
- * <div class="dark"><div>foo</div></div> --> <div dark="true"><div>foo</div></div>
192
- * ```
193
- *
194
- * Above, `class="dark"` attribute is added only to the `<div>` elements that has it. This is in contrast to
195
- * {@link module:engine/conversion/upcasthelpers~UpcastHelpers#elementToAttribute} which sets attributes for
196
- * all the children in the model:
197
- *
198
- * ```
199
- * <strong>Foo</strong> --> <strong><p>Foo</p></strong> --> <paragraph><$text bold="true">Foo</$text></paragraph>
200
- * ```
201
- *
202
- * Above is a sample of HTML code, that goes through autoparagraphing (first step) and then is converted (second step).
203
- * Even though `<strong>` is over `<p>` element, `bold="true"` was added to the text.
204
- *
205
- * Keep in mind that the attribute will be set only if it is allowed by
206
- * {@link module:engine/model/schema~ModelSchema schema} configuration.
207
- *
208
- * ```ts
209
- * editor.conversion.for( 'upcast' ).attributeToAttribute( {
210
- * view: 'src',
211
- * model: 'source'
212
- * } );
213
- *
214
- * editor.conversion.for( 'upcast' ).attributeToAttribute( {
215
- * view: { key: 'src' },
216
- * model: 'source'
217
- * } );
218
- *
219
- * editor.conversion.for( 'upcast' ).attributeToAttribute( {
220
- * view: { key: 'src' },
221
- * model: 'source',
222
- * converterPriority: 'normal'
223
- * } );
224
- *
225
- * editor.conversion.for( 'upcast' ).attributeToAttribute( {
226
- * view: {
227
- * key: 'data-style',
228
- * value: /[\s\S]+/
229
- * },
230
- * model: 'styled'
231
- * } );
232
- *
233
- * editor.conversion.for( 'upcast' ).attributeToAttribute( {
234
- * view: {
235
- * name: 'img',
236
- * key: 'class',
237
- * value: 'styled-dark'
238
- * },
239
- * model: {
240
- * key: 'styled',
241
- * value: 'dark'
242
- * }
243
- * } );
244
- *
245
- * editor.conversion.for( 'upcast' ).attributeToAttribute( {
246
- * view: {
247
- * key: 'class',
248
- * value: /styled-[\S]+/
249
- * },
250
- * model: {
251
- * key: 'styled'
252
- * value: ( viewElement, conversionApi ) => {
253
- * const regexp = /styled-([\S]+)/;
254
- * const match = viewElement.getAttribute( 'class' ).match( regexp );
255
- *
256
- * return match[ 1 ];
257
- * }
258
- * }
259
- * } );
260
- * ```
261
- *
262
- * Converting styles works a bit differently as it requires `view.styles` to be an object and by default
263
- * a model attribute will be set to `true` by such a converter. You can set the model attribute to any value by providing the `value`
264
- * callback that returns the desired value.
265
- *
266
- * ```ts
267
- * // Default conversion of font-weight style will result in setting bold attribute to true.
268
- * editor.conversion.for( 'upcast' ).attributeToAttribute( {
269
- * view: {
270
- * styles: {
271
- * 'font-weight': 'bold'
272
- * }
273
- * },
274
- * model: 'bold'
275
- * } );
276
- *
277
- * // This converter will pass any style value to the `lineHeight` model attribute.
278
- * editor.conversion.for( 'upcast' ).attributeToAttribute( {
279
- * view: {
280
- * styles: {
281
- * 'line-height': /[\s\S]+/
282
- * }
283
- * },
284
- * model: {
285
- * key: 'lineHeight',
286
- * value: ( viewElement, conversionApi ) => viewElement.getStyle( 'line-height' )
287
- * }
288
- * } );
289
- * ```
290
- *
291
- * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter
292
- * to the conversion process.
293
- *
294
- * @param config Conversion configuration.
295
- * @param config.view Specifies which view attribute will be converted. If a `String` is passed,
296
- * attributes with given key will be converted. If an `Object` is passed, it must have a required `key` property,
297
- * specifying view attribute key, and may have an optional `value` property, specifying view attribute value and optional `name`
298
- * property specifying a view element name from/on which the attribute should be converted. `value` can be given as a `String`,
299
- * a `RegExp` or a function callback, that takes view attribute value as the only parameter and returns `Boolean`.
300
- * @param config.model Model attribute key or an object with `key` and `value` properties, describing
301
- * the model attribute. `value` property may be set as a function that takes a view element and
302
- * {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} and returns the value.
303
- * If `String` is given, the model attribute value will be same as view attribute value.
304
- * @param config.converterPriority Converter priority. Defaults to `low`.
305
- */
306
- attributeToAttribute(config: {
307
- view: string | {
308
- key: string;
309
- value?: string | RegExp | Array<string> | Record<string, string> | Record<string, RegExp> | ((value: unknown) => boolean);
310
- name?: string;
311
- } | {
312
- name?: string | RegExp;
313
- styles?: MatchPropertyPatterns;
314
- classes?: MatchClassPatterns;
315
- attributes?: MatchPropertyPatterns;
316
- };
317
- model: string | {
318
- key: string;
319
- value: unknown | ((viewElement: ViewElement, conversionApi: UpcastConversionApi, data: UpcastConversionData<ViewElement>) => unknown);
320
- };
321
- converterPriority?: PriorityString;
322
- }): this;
323
- /**
324
- * View element to model marker conversion helper.
325
- *
326
- * This conversion results in creating a model marker. For example, if the marker was stored in a view as an element:
327
- * `<p>Fo<span data-marker="comment" data-comment-id="7"></span>o</p><p>B<span data-marker="comment" data-comment-id="7"></span>ar</p>`,
328
- * after the conversion is done, the marker will be available in
329
- * {@link module:engine/model/model~Model#markers model document markers}.
330
- *
331
- * **Note**: When this helper is used in the data upcast in combination with
332
- * {@link module:engine/conversion/downcasthelpers~DowncastHelpers#markerToData `#markerToData()`} in the data downcast,
333
- * then invalid HTML code (e.g. a span between table cells) may be produced by the latter converter.
334
- *
335
- * In most of the cases, the {@link #dataToMarker} should be used instead.
336
- *
337
- * ```ts
338
- * editor.conversion.for( 'upcast' ).elementToMarker( {
339
- * view: 'marker-search',
340
- * model: 'search'
341
- * } );
342
- *
343
- * editor.conversion.for( 'upcast' ).elementToMarker( {
344
- * view: 'marker-search',
345
- * model: 'search',
346
- * converterPriority: 'high'
347
- * } );
348
- *
349
- * editor.conversion.for( 'upcast' ).elementToMarker( {
350
- * view: 'marker-search',
351
- * model: ( viewElement, conversionApi ) => 'comment:' + viewElement.getAttribute( 'data-comment-id' )
352
- * } );
353
- *
354
- * editor.conversion.for( 'upcast' ).elementToMarker( {
355
- * view: {
356
- * name: 'span',
357
- * attributes: {
358
- * 'data-marker': 'search'
359
- * }
360
- * },
361
- * model: 'search'
362
- * } );
363
- * ```
364
- *
365
- * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter
366
- * to the conversion process.
367
- *
368
- * @param config Conversion configuration.
369
- * @param config.view Pattern matching all view elements which should be converted.
370
- * @param config.model Name of the model marker, or a function that takes a view element and returns
371
- * a model marker name.
372
- * @param config.converterPriority Converter priority.
373
- */
374
- elementToMarker(config: {
375
- view: MatcherPattern;
376
- model: string | UpcastMarkerFromElementCreatorFunction;
377
- converterPriority?: PriorityString;
378
- }): this;
379
- /**
380
- * View-to-model marker conversion helper.
381
- *
382
- * Converts view data created by {@link module:engine/conversion/downcasthelpers~DowncastHelpers#markerToData `#markerToData()`}
383
- * back to a model marker.
384
- *
385
- * This converter looks for specific view elements and view attributes that mark marker boundaries. See
386
- * {@link module:engine/conversion/downcasthelpers~DowncastHelpers#markerToData `#markerToData()`} to learn what view data
387
- * is expected by this converter.
388
- *
389
- * The `config.view` property is equal to the marker group name to convert.
390
- *
391
- * By default, this converter creates markers with the `group:name` name convention (to match the default `markerToData` conversion).
392
- *
393
- * The conversion configuration can take a function that will generate a marker name.
394
- * If such function is set as the `config.model` parameter, it is passed the `name` part from the view element or attribute and it is
395
- * expected to return a string with the marker name.
396
- *
397
- * Basic usage:
398
- *
399
- * ```ts
400
- * // Using the default conversion.
401
- * // In this case, all markers from the `comment` group will be converted.
402
- * // The conversion will look for `<comment-start>` and `<comment-end>` tags and
403
- * // `data-comment-start-before`, `data-comment-start-after`,
404
- * // `data-comment-end-before` and `data-comment-end-after` attributes.
405
- * editor.conversion.for( 'upcast' ).dataToMarker( {
406
- * view: 'comment'
407
- * } );
408
- * ```
409
- *
410
- * An example of a model that may be generated by this conversion:
411
- *
412
- * ```
413
- * // View:
414
- * <p>Foo<comment-start name="commentId:uid"></comment-start>bar</p>
415
- * <figure data-comment-end-after="commentId:uid" class="image"><img src="abc.jpg" /></figure>
416
- *
417
- * // Model:
418
- * <paragraph>Foo[bar</paragraph>
419
- * <imageBlock src="abc.jpg"></imageBlock>]
420
- * ```
421
- *
422
- * Where `[]` are boundaries of a marker that will receive the `comment:commentId:uid` name.
423
- *
424
- * Other examples of usage:
425
- *
426
- * ```ts
427
- * // Using a custom function which is the same as the default conversion:
428
- * editor.conversion.for( 'upcast' ).dataToMarker( {
429
- * view: 'comment',
430
- * model: ( name, conversionApi ) => 'comment:' + name,
431
- * } );
432
- *
433
- * // Using the converter priority:
434
- * editor.conversion.for( 'upcast' ).dataToMarker( {
435
- * view: 'comment',
436
- * model: ( name, conversionApi ) => 'comment:' + name,
437
- * converterPriority: 'high'
438
- * } );
439
- * ```
440
- *
441
- * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter
442
- * to the conversion process.
443
- *
444
- * @param config Conversion configuration.
445
- * @param config.view The marker group name to convert.
446
- * @param config.model A function that takes the `name` part from the view element or attribute and
447
- * {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} and returns the marker name.
448
- * @param config.converterPriority Converter priority.
449
- */
450
- dataToMarker(config: {
451
- view: string;
452
- model?: UpcastMarkerFromAttributeCreatorFunction;
453
- converterPriority?: PriorityString;
454
- }): this;
29
+ /**
30
+ * View element to model element conversion helper.
31
+ *
32
+ * This conversion results in creating a model element. For example,
33
+ * view `<p>Foo</p>` becomes `<paragraph>Foo</paragraph>` in the model.
34
+ *
35
+ * Keep in mind that the element will be inserted only if it is allowed
36
+ * by {@link module:engine/model/schema~ModelSchema schema} configuration.
37
+ *
38
+ * ```ts
39
+ * editor.conversion.for( 'upcast' ).elementToElement( {
40
+ * view: 'p',
41
+ * model: 'paragraph'
42
+ * } );
43
+ *
44
+ * editor.conversion.for( 'upcast' ).elementToElement( {
45
+ * view: 'p',
46
+ * model: 'paragraph',
47
+ * converterPriority: 'high'
48
+ * } );
49
+ *
50
+ * editor.conversion.for( 'upcast' ).elementToElement( {
51
+ * view: {
52
+ * name: 'p',
53
+ * classes: 'fancy'
54
+ * },
55
+ * model: 'fancyParagraph'
56
+ * } );
57
+ *
58
+ * editor.conversion.for( 'upcast' ).elementToElement( {
59
+ * view: {
60
+ * name: 'p',
61
+ * classes: 'heading'
62
+ * },
63
+ * model: ( viewElement, conversionApi ) => {
64
+ * const modelWriter = conversionApi.writer;
65
+ *
66
+ * return modelWriter.createElement( 'heading', { level: viewElement.getAttribute( 'data-level' ) } );
67
+ * }
68
+ * } );
69
+ * ```
70
+ *
71
+ * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter
72
+ * to the conversion process.
73
+ *
74
+ * @param config Conversion configuration.
75
+ * @param config.view Pattern matching all view elements which should be converted. If not set, the converter
76
+ * will fire for every view element.
77
+ * @param config.model Name of the model element, a model element instance or a function that takes a view element
78
+ * and {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API}
79
+ * and returns a model element. The model element will be inserted in the model.
80
+ * @param config.converterPriority Converter priority.
81
+ */
82
+ elementToElement(config: {
83
+ view: MatcherPattern;
84
+ model: string | UpcastElementCreatorFunction;
85
+ converterPriority?: PriorityString;
86
+ }): this;
87
+ /**
88
+ * View element to model attribute conversion helper.
89
+ *
90
+ * This conversion results in setting an attribute on a model node. For example, view `<strong>Foo</strong>` becomes
91
+ * `Foo` {@link module:engine/model/text~ModelText model text node} with `bold` attribute set to `true`.
92
+ *
93
+ * This helper is meant to set a model attribute on all the elements that are inside the converted element:
94
+ *
95
+ * ```
96
+ * <strong>Foo</strong> --> <strong><p>Foo</p></strong> --> <paragraph><$text bold="true">Foo</$text></paragraph>
97
+ * ```
98
+ *
99
+ * Above is a sample of HTML code, that goes through autoparagraphing (first step) and then is converted (second step).
100
+ * Even though `<strong>` is over `<p>` element, `bold="true"` was added to the text. See
101
+ * {@link module:engine/conversion/upcasthelpers~UpcastHelpers#attributeToAttribute} for comparison.
102
+ *
103
+ * Keep in mind that the attribute will be set only if it is allowed by
104
+ * {@link module:engine/model/schema~ModelSchema schema} configuration.
105
+ *
106
+ * ```ts
107
+ * editor.conversion.for( 'upcast' ).elementToAttribute( {
108
+ * view: 'strong',
109
+ * model: 'bold'
110
+ * } );
111
+ *
112
+ * editor.conversion.for( 'upcast' ).elementToAttribute( {
113
+ * view: 'strong',
114
+ * model: 'bold',
115
+ * converterPriority: 'high'
116
+ * } );
117
+ *
118
+ * editor.conversion.for( 'upcast' ).elementToAttribute( {
119
+ * view: {
120
+ * name: 'span',
121
+ * classes: 'bold'
122
+ * },
123
+ * model: 'bold'
124
+ * } );
125
+ *
126
+ * editor.conversion.for( 'upcast' ).elementToAttribute( {
127
+ * view: {
128
+ * name: 'span',
129
+ * classes: [ 'styled', 'styled-dark' ]
130
+ * },
131
+ * model: {
132
+ * key: 'styled',
133
+ * value: 'dark'
134
+ * }
135
+ * } );
136
+ *
137
+ * editor.conversion.for( 'upcast' ).elementToAttribute( {
138
+ * view: {
139
+ * name: 'span',
140
+ * styles: {
141
+ * 'font-size': /[\s\S]+/
142
+ * }
143
+ * },
144
+ * model: {
145
+ * key: 'fontSize',
146
+ * value: ( viewElement, conversionApi ) => {
147
+ * const fontSize = viewElement.getStyle( 'font-size' );
148
+ * const value = fontSize.substr( 0, fontSize.length - 2 );
149
+ *
150
+ * if ( value <= 10 ) {
151
+ * return 'small';
152
+ * } else if ( value > 12 ) {
153
+ * return 'big';
154
+ * }
155
+ *
156
+ * return null;
157
+ * }
158
+ * }
159
+ * } );
160
+ * ```
161
+ *
162
+ * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter
163
+ * to the conversion process.
164
+ *
165
+ * @param config Conversion configuration.
166
+ * @param config.view Pattern matching all view elements which should be converted.
167
+ * @param config.model Model attribute key or an object with `key` and `value` properties, describing
168
+ * the model attribute. `value` property may be set as a function that takes a view element and
169
+ * {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} and returns the value.
170
+ * If `String` is given, the model attribute value will be set to `true`.
171
+ * @param config.converterPriority Converter priority. Defaults to `low`.
172
+ */
173
+ elementToAttribute(config: {
174
+ view: MatcherPattern;
175
+ model: string | {
176
+ key: string;
177
+ value?: unknown;
178
+ };
179
+ converterPriority?: PriorityString;
180
+ }): this;
181
+ /**
182
+ * View attribute to model attribute conversion helper.
183
+ *
184
+ * This conversion results in setting an attribute on a model node. For example, view `<img src="foo.jpg"></img>` becomes
185
+ * `<imageBlock source="foo.jpg"></imageBlock>` in the model.
186
+ *
187
+ * This helper is meant to convert view attributes from view elements which got converted to the model, so the view attribute
188
+ * is set only on the corresponding model node:
189
+ *
190
+ * ```
191
+ * <div class="dark"><div>foo</div></div> --> <div dark="true"><div>foo</div></div>
192
+ * ```
193
+ *
194
+ * Above, `class="dark"` attribute is added only to the `<div>` elements that has it. This is in contrast to
195
+ * {@link module:engine/conversion/upcasthelpers~UpcastHelpers#elementToAttribute} which sets attributes for
196
+ * all the children in the model:
197
+ *
198
+ * ```
199
+ * <strong>Foo</strong> --> <strong><p>Foo</p></strong> --> <paragraph><$text bold="true">Foo</$text></paragraph>
200
+ * ```
201
+ *
202
+ * Above is a sample of HTML code, that goes through autoparagraphing (first step) and then is converted (second step).
203
+ * Even though `<strong>` is over `<p>` element, `bold="true"` was added to the text.
204
+ *
205
+ * Keep in mind that the attribute will be set only if it is allowed by
206
+ * {@link module:engine/model/schema~ModelSchema schema} configuration.
207
+ *
208
+ * ```ts
209
+ * editor.conversion.for( 'upcast' ).attributeToAttribute( {
210
+ * view: 'src',
211
+ * model: 'source'
212
+ * } );
213
+ *
214
+ * editor.conversion.for( 'upcast' ).attributeToAttribute( {
215
+ * view: { key: 'src' },
216
+ * model: 'source'
217
+ * } );
218
+ *
219
+ * editor.conversion.for( 'upcast' ).attributeToAttribute( {
220
+ * view: { key: 'src' },
221
+ * model: 'source',
222
+ * converterPriority: 'normal'
223
+ * } );
224
+ *
225
+ * editor.conversion.for( 'upcast' ).attributeToAttribute( {
226
+ * view: {
227
+ * key: 'data-style',
228
+ * value: /[\s\S]+/
229
+ * },
230
+ * model: 'styled'
231
+ * } );
232
+ *
233
+ * editor.conversion.for( 'upcast' ).attributeToAttribute( {
234
+ * view: {
235
+ * name: 'img',
236
+ * key: 'class',
237
+ * value: 'styled-dark'
238
+ * },
239
+ * model: {
240
+ * key: 'styled',
241
+ * value: 'dark'
242
+ * }
243
+ * } );
244
+ *
245
+ * editor.conversion.for( 'upcast' ).attributeToAttribute( {
246
+ * view: {
247
+ * key: 'class',
248
+ * value: /styled-[\S]+/
249
+ * },
250
+ * model: {
251
+ * key: 'styled'
252
+ * value: ( viewElement, conversionApi ) => {
253
+ * const regexp = /styled-([\S]+)/;
254
+ * const match = viewElement.getAttribute( 'class' ).match( regexp );
255
+ *
256
+ * return match[ 1 ];
257
+ * }
258
+ * }
259
+ * } );
260
+ * ```
261
+ *
262
+ * Converting styles works a bit differently as it requires `view.styles` to be an object and by default
263
+ * a model attribute will be set to `true` by such a converter. You can set the model attribute to any value by providing the `value`
264
+ * callback that returns the desired value.
265
+ *
266
+ * ```ts
267
+ * // Default conversion of font-weight style will result in setting bold attribute to true.
268
+ * editor.conversion.for( 'upcast' ).attributeToAttribute( {
269
+ * view: {
270
+ * styles: {
271
+ * 'font-weight': 'bold'
272
+ * }
273
+ * },
274
+ * model: 'bold'
275
+ * } );
276
+ *
277
+ * // This converter will pass any style value to the `lineHeight` model attribute.
278
+ * editor.conversion.for( 'upcast' ).attributeToAttribute( {
279
+ * view: {
280
+ * styles: {
281
+ * 'line-height': /[\s\S]+/
282
+ * }
283
+ * },
284
+ * model: {
285
+ * key: 'lineHeight',
286
+ * value: ( viewElement, conversionApi ) => viewElement.getStyle( 'line-height' )
287
+ * }
288
+ * } );
289
+ * ```
290
+ *
291
+ * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter
292
+ * to the conversion process.
293
+ *
294
+ * @param config Conversion configuration.
295
+ * @param config.view Specifies which view attribute will be converted. If a `String` is passed,
296
+ * attributes with given key will be converted. If an `Object` is passed, it must have a required `key` property,
297
+ * specifying view attribute key, and may have an optional `value` property, specifying view attribute value and optional `name`
298
+ * property specifying a view element name from/on which the attribute should be converted. `value` can be given as a `String`,
299
+ * a `RegExp` or a function callback, that takes view attribute value as the only parameter and returns `Boolean`.
300
+ * @param config.model Model attribute key or an object with `key` and `value` properties, describing
301
+ * the model attribute. `value` property may be set as a function that takes a view element and
302
+ * {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} and returns the value.
303
+ * If `String` is given, the model attribute value will be same as view attribute value.
304
+ * @param config.converterPriority Converter priority. Defaults to `low`.
305
+ */
306
+ attributeToAttribute(config: {
307
+ view: string | {
308
+ key: string;
309
+ value?: string | RegExp | Array<string> | Record<string, string> | Record<string, RegExp> | ((value: unknown) => boolean);
310
+ name?: string;
311
+ } | {
312
+ name?: string | RegExp;
313
+ styles?: MatchPropertyPatterns;
314
+ classes?: MatchClassPatterns;
315
+ attributes?: MatchPropertyPatterns;
316
+ };
317
+ model: string | {
318
+ key: string;
319
+ value: unknown | ((viewElement: ViewElement, conversionApi: UpcastConversionApi, data: UpcastConversionData<ViewElement>) => unknown);
320
+ };
321
+ converterPriority?: PriorityString;
322
+ }): this;
323
+ /**
324
+ * View element to model marker conversion helper.
325
+ *
326
+ * This conversion results in creating a model marker. For example, if the marker was stored in a view as an element:
327
+ * `<p>Fo<span data-marker="comment" data-comment-id="7"></span>o</p><p>B<span data-marker="comment" data-comment-id="7"></span>ar</p>`,
328
+ * after the conversion is done, the marker will be available in
329
+ * {@link module:engine/model/model~Model#markers model document markers}.
330
+ *
331
+ * **Note**: When this helper is used in the data upcast in combination with
332
+ * {@link module:engine/conversion/downcasthelpers~DowncastHelpers#markerToData `#markerToData()`} in the data downcast,
333
+ * then invalid HTML code (e.g. a span between table cells) may be produced by the latter converter.
334
+ *
335
+ * In most of the cases, the {@link #dataToMarker} should be used instead.
336
+ *
337
+ * ```ts
338
+ * editor.conversion.for( 'upcast' ).elementToMarker( {
339
+ * view: 'marker-search',
340
+ * model: 'search'
341
+ * } );
342
+ *
343
+ * editor.conversion.for( 'upcast' ).elementToMarker( {
344
+ * view: 'marker-search',
345
+ * model: 'search',
346
+ * converterPriority: 'high'
347
+ * } );
348
+ *
349
+ * editor.conversion.for( 'upcast' ).elementToMarker( {
350
+ * view: 'marker-search',
351
+ * model: ( viewElement, conversionApi ) => 'comment:' + viewElement.getAttribute( 'data-comment-id' )
352
+ * } );
353
+ *
354
+ * editor.conversion.for( 'upcast' ).elementToMarker( {
355
+ * view: {
356
+ * name: 'span',
357
+ * attributes: {
358
+ * 'data-marker': 'search'
359
+ * }
360
+ * },
361
+ * model: 'search'
362
+ * } );
363
+ * ```
364
+ *
365
+ * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter
366
+ * to the conversion process.
367
+ *
368
+ * @param config Conversion configuration.
369
+ * @param config.view Pattern matching all view elements which should be converted.
370
+ * @param config.model Name of the model marker, or a function that takes a view element and returns
371
+ * a model marker name.
372
+ * @param config.converterPriority Converter priority.
373
+ */
374
+ elementToMarker(config: {
375
+ view: MatcherPattern;
376
+ model: string | UpcastMarkerFromElementCreatorFunction;
377
+ converterPriority?: PriorityString;
378
+ }): this;
379
+ /**
380
+ * View-to-model marker conversion helper.
381
+ *
382
+ * Converts view data created by {@link module:engine/conversion/downcasthelpers~DowncastHelpers#markerToData `#markerToData()`}
383
+ * back to a model marker.
384
+ *
385
+ * This converter looks for specific view elements and view attributes that mark marker boundaries. See
386
+ * {@link module:engine/conversion/downcasthelpers~DowncastHelpers#markerToData `#markerToData()`} to learn what view data
387
+ * is expected by this converter.
388
+ *
389
+ * The `config.view` property is equal to the marker group name to convert.
390
+ *
391
+ * By default, this converter creates markers with the `group:name` name convention (to match the default `markerToData` conversion).
392
+ *
393
+ * The conversion configuration can take a function that will generate a marker name.
394
+ * If such function is set as the `config.model` parameter, it is passed the `name` part from the view element or attribute and it is
395
+ * expected to return a string with the marker name.
396
+ *
397
+ * Basic usage:
398
+ *
399
+ * ```ts
400
+ * // Using the default conversion.
401
+ * // In this case, all markers from the `comment` group will be converted.
402
+ * // The conversion will look for `<comment-start>` and `<comment-end>` tags and
403
+ * // `data-comment-start-before`, `data-comment-start-after`,
404
+ * // `data-comment-end-before` and `data-comment-end-after` attributes.
405
+ * editor.conversion.for( 'upcast' ).dataToMarker( {
406
+ * view: 'comment'
407
+ * } );
408
+ * ```
409
+ *
410
+ * An example of a model that may be generated by this conversion:
411
+ *
412
+ * ```
413
+ * // View:
414
+ * <p>Foo<comment-start name="commentId:uid"></comment-start>bar</p>
415
+ * <figure data-comment-end-after="commentId:uid" class="image"><img src="abc.jpg" /></figure>
416
+ *
417
+ * // Model:
418
+ * <paragraph>Foo[bar</paragraph>
419
+ * <imageBlock src="abc.jpg"></imageBlock>]
420
+ * ```
421
+ *
422
+ * Where `[]` are boundaries of a marker that will receive the `comment:commentId:uid` name.
423
+ *
424
+ * Other examples of usage:
425
+ *
426
+ * ```ts
427
+ * // Using a custom function which is the same as the default conversion:
428
+ * editor.conversion.for( 'upcast' ).dataToMarker( {
429
+ * view: 'comment',
430
+ * model: ( name, conversionApi ) => 'comment:' + name,
431
+ * } );
432
+ *
433
+ * // Using the converter priority:
434
+ * editor.conversion.for( 'upcast' ).dataToMarker( {
435
+ * view: 'comment',
436
+ * model: ( name, conversionApi ) => 'comment:' + name,
437
+ * converterPriority: 'high'
438
+ * } );
439
+ * ```
440
+ *
441
+ * See {@link module:engine/conversion/conversion~Conversion#for `conversion.for()`} to learn how to add a converter
442
+ * to the conversion process.
443
+ *
444
+ * @param config Conversion configuration.
445
+ * @param config.view The marker group name to convert.
446
+ * @param config.model A function that takes the `name` part from the view element or attribute and
447
+ * {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} and returns the marker name.
448
+ * @param config.converterPriority Converter priority.
449
+ */
450
+ dataToMarker(config: {
451
+ view: string;
452
+ model?: UpcastMarkerFromAttributeCreatorFunction;
453
+ converterPriority?: PriorityString;
454
+ }): this;
455
455
  }
456
456
  /**
457
- * Function factory, creates a converter that converts
458
- * {@link module:engine/view/documentfragment~ViewDocumentFragment view document fragment}
459
- * or all children of {@link module:engine/view/element~ViewElement} into
460
- * {@link module:engine/model/documentfragment~ModelDocumentFragment model document fragment}.
461
- * This is the "entry-point" converter for upcast (view to model conversion). This converter starts the conversion of all children
462
- * of passed view document fragment. Those children {@link module:engine/view/node~ViewNode view nodes} are then
463
- * handled by other converters.
464
- *
465
- * This also a "default", last resort converter for all view elements that has not been converted by other converters.
466
- * When a view element is being converted to the model but it does not have converter specified, that view element
467
- * will be converted to {@link module:engine/model/documentfragment~ModelDocumentFragment model document fragment} and returned.
468
- *
469
- * @returns Universal converter for view {@link module:engine/view/documentfragment~ViewDocumentFragment fragments} and
470
- * {@link module:engine/view/element~ViewElement elements} that returns
471
- * {@link module:engine/model/documentfragment~ModelDocumentFragment model fragment} with children of converted view item.
472
- *
473
- * @internal
474
- */
457
+ * Function factory, creates a converter that converts
458
+ * {@link module:engine/view/documentfragment~ViewDocumentFragment view document fragment}
459
+ * or all children of {@link module:engine/view/element~ViewElement} into
460
+ * {@link module:engine/model/documentfragment~ModelDocumentFragment model document fragment}.
461
+ * This is the "entry-point" converter for upcast (view to model conversion). This converter starts the conversion of all children
462
+ * of passed view document fragment. Those children {@link module:engine/view/node~ViewNode view nodes} are then
463
+ * handled by other converters.
464
+ *
465
+ * This also a "default", last resort converter for all view elements that has not been converted by other converters.
466
+ * When a view element is being converted to the model but it does not have converter specified, that view element
467
+ * will be converted to {@link module:engine/model/documentfragment~ModelDocumentFragment model document fragment} and returned.
468
+ *
469
+ * @returns Universal converter for view {@link module:engine/view/documentfragment~ViewDocumentFragment fragments} and
470
+ * {@link module:engine/view/element~ViewElement elements} that returns
471
+ * {@link module:engine/model/documentfragment~ModelDocumentFragment model fragment} with children of converted view item.
472
+ *
473
+ * @internal
474
+ */
475
475
  export declare function convertToModelFragment(): (evt: EventInfo, data: UpcastConversionData<ViewElement | ViewDocumentFragment>, conversionApi: UpcastConversionApi) => void;
476
476
  /**
477
- * Function factory, creates a converter that converts
478
- * {@link module:engine/view/text~ViewText} to {@link module:engine/model/text~ModelText}.
479
- *
480
- * @returns {@link module:engine/view/text~ViewText View text} converter.
481
- * @internal
482
- */
477
+ * Function factory, creates a converter that converts
478
+ * {@link module:engine/view/text~ViewText} to {@link module:engine/model/text~ModelText}.
479
+ *
480
+ * @returns {@link module:engine/view/text~ViewText View text} converter.
481
+ * @internal
482
+ */
483
483
  export declare function convertText(): (evt: EventInfo, data: UpcastConversionData<ViewText>, { schema, consumable, writer }: UpcastConversionApi) => void;
484
484
  /**
485
- * Function factory, creates a callback function which converts a {@link module:engine/view/selection~ViewSelection
486
- * view selection} taken from the {@link module:engine/view/document~ViewDocument#event:selectionChange} event
487
- * and sets in on the {@link module:engine/model/document~ModelDocument#selection model}.
488
- *
489
- * **Note**: because there is no view selection change dispatcher nor any other advanced view selection to model
490
- * conversion mechanism, the callback should be set directly on view document.
491
- *
492
- * ```ts
493
- * view.document.on( 'selectionChange', convertSelectionChange( modelDocument, mapper ) );
494
- * ```
495
- *
496
- * @param model Data model.
497
- * @param mapper Conversion mapper.
498
- * @returns {@link module:engine/view/document~ViewDocument#event:selectionChange} callback function.
499
- * @internal
500
- */
485
+ * Function factory, creates a callback function which converts a {@link module:engine/view/selection~ViewSelection
486
+ * view selection} taken from the {@link module:engine/view/document~ViewDocument#event:selectionChange} event
487
+ * and sets in on the {@link module:engine/model/document~ModelDocument#selection model}.
488
+ *
489
+ * **Note**: because there is no view selection change dispatcher nor any other advanced view selection to model
490
+ * conversion mechanism, the callback should be set directly on view document.
491
+ *
492
+ * ```ts
493
+ * view.document.on( 'selectionChange', convertSelectionChange( modelDocument, mapper ) );
494
+ * ```
495
+ *
496
+ * @param model Data model.
497
+ * @param mapper Conversion mapper.
498
+ * @returns {@link module:engine/view/document~ViewDocument#event:selectionChange} callback function.
499
+ * @internal
500
+ */
501
501
  export declare function convertSelectionChange(model: Model, mapper: Mapper): (evt: EventInfo, data: {
502
- newSelection: ViewSelection | ViewDocumentSelection;
502
+ newSelection: ViewSelection | ViewDocumentSelection;
503
503
  }) => void;
504
504
  export type UpcastElementCreatorFunction = (viewElement: ViewElement, conversionApi: UpcastConversionApi) => ModelElement | null;
505
505
  export type UpcastAttributeCreatorFunction = (modelElement: ModelElement, conversionApi: UpcastConversionApi) => unknown;