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