@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,373 +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 Element from '../view/element.js';
10
- import type Node from '../view/node.js';
11
- import type Text from '../view/text.js';
12
- import type DocumentFragment from '../view/documentfragment.js';
13
- import type { Match } from '../view/matcher.js';
14
- /**
15
- * Class used for handling consumption of view {@link module:engine/view/element~Element elements},
16
- * {@link module:engine/view/text~Text text nodes} and {@link module:engine/view/documentfragment~DocumentFragment document fragments}.
17
- * Element's name and its parts (attributes, classes and styles) can be consumed separately. Consuming an element's name
18
- * does not consume its attributes, classes and styles.
19
- * To add items for consumption use {@link module:engine/conversion/viewconsumable~ViewConsumable#add add method}.
20
- * To test items use {@link module:engine/conversion/viewconsumable~ViewConsumable#test test method}.
21
- * To consume items use {@link module:engine/conversion/viewconsumable~ViewConsumable#consume consume method}.
22
- * To revert already consumed items use {@link module:engine/conversion/viewconsumable~ViewConsumable#revert revert method}.
23
- *
24
- * ```ts
25
- * viewConsumable.add( element, { name: true } ); // Adds element's name as ready to be consumed.
26
- * viewConsumable.add( textNode ); // Adds text node for consumption.
27
- * viewConsumable.add( docFragment ); // Adds document fragment for consumption.
28
- * viewConsumable.test( element, { name: true } ); // Tests if element's name can be consumed.
29
- * viewConsumable.test( textNode ); // Tests if text node can be consumed.
30
- * viewConsumable.test( docFragment ); // Tests if document fragment can be consumed.
31
- * viewConsumable.consume( element, { name: true } ); // Consume element's name.
32
- * viewConsumable.consume( textNode ); // Consume text node.
33
- * viewConsumable.consume( docFragment ); // Consume document fragment.
34
- * viewConsumable.revert( element, { name: true } ); // Revert already consumed element's name.
35
- * viewConsumable.revert( textNode ); // Revert already consumed text node.
36
- * viewConsumable.revert( docFragment ); // Revert already consumed document fragment.
37
- * ```
38
- */
39
- export default class ViewConsumable {
40
- /**
41
- * Map of consumable elements. If {@link module:engine/view/element~Element element} is used as a key,
42
- * {@link module:engine/conversion/viewconsumable~ViewElementConsumables ViewElementConsumables} instance is stored as value.
43
- * For {@link module:engine/view/text~Text text nodes} and
44
- * {@link module:engine/view/documentfragment~DocumentFragment document fragments} boolean value is stored as value.
45
- */
46
- private _consumables;
47
- /**
48
- * Adds {@link module:engine/view/text~Text text node} or
49
- * {@link module:engine/view/documentfragment~DocumentFragment document fragment} as ready to be consumed.
50
- *
51
- * ```ts
52
- * viewConsumable.add( textNode ); // Adds text node to consume.
53
- * viewConsumable.add( docFragment ); // Adds document fragment to consume.
54
- * ```
55
- *
56
- * See also: {@link #add:ELEMENT `add( element, consumables )`}.
57
- *
58
- * @label TEXT_OR_FRAGMENT
59
- */
60
- add(textOrDocumentFragment: Text | DocumentFragment): void;
61
- /**
62
- * Adds {@link module:engine/view/element~Element view element} as ready to be consumed.
63
- *
64
- * ```ts
65
- * viewConsumable.add( p, { name: true } ); // Adds element's name to consume.
66
- * viewConsumable.add( p, { attributes: 'name' } ); // Adds element's attribute.
67
- * viewConsumable.add( p, { classes: 'foobar' } ); // Adds element's class.
68
- * viewConsumable.add( p, { styles: 'color' } ); // Adds element's style
69
- * viewConsumable.add( p, { attributes: 'name', styles: 'color' } ); // Adds attribute and style.
70
- * viewConsumable.add( p, { classes: [ 'baz', 'bar' ] } ); // Multiple consumables can be provided.
71
- * ```
72
- *
73
- * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `viewconsumable-invalid-attribute` when `class` or `style`
74
- * attribute is provided - it should be handled separately by providing actual style/class.
75
- *
76
- * ```ts
77
- * viewConsumable.add( p, { attributes: 'style' } ); // This call will throw an exception.
78
- * viewConsumable.add( p, { styles: 'color' } ); // This is properly handled style.
79
- * ```
80
- *
81
- * See also: {@link #add:TEXT_OR_FRAGMENT `add( textOrDocumentFragment )`}.
82
- *
83
- * @label ELEMENT
84
- * @param consumables Used only if first parameter is {@link module:engine/view/element~Element view element} instance.
85
- * @param consumables.name If set to true element's name will be included.
86
- * @param consumables.attributes Attribute name or array of attribute names.
87
- * @param consumables.classes Class name or array of class names.
88
- * @param consumables.styles Style name or array of style names.
89
- */
90
- add(element: Element, consumables: Consumables): void;
91
- /**
92
- * Tests if {@link module:engine/view/element~Element view element}, {@link module:engine/view/text~Text text node} or
93
- * {@link module:engine/view/documentfragment~DocumentFragment document fragment} can be consumed.
94
- * It returns `true` when all items included in method's call can be consumed. Returns `false` when
95
- * first already consumed item is found and `null` when first non-consumable item is found.
96
- *
97
- * ```ts
98
- * viewConsumable.test( p, { name: true } ); // Tests element's name.
99
- * viewConsumable.test( p, { attributes: 'name' } ); // Tests attribute.
100
- * viewConsumable.test( p, { classes: 'foobar' } ); // Tests class.
101
- * viewConsumable.test( p, { styles: 'color' } ); // Tests style.
102
- * viewConsumable.test( p, { attributes: 'name', styles: 'color' } ); // Tests attribute and style.
103
- * viewConsumable.test( p, { classes: [ 'baz', 'bar' ] } ); // Multiple consumables can be tested.
104
- * viewConsumable.test( textNode ); // Tests text node.
105
- * viewConsumable.test( docFragment ); // Tests document fragment.
106
- * ```
107
- *
108
- * Testing classes and styles as attribute will test if all added classes/styles can be consumed.
109
- *
110
- * ```ts
111
- * viewConsumable.test( p, { attributes: 'class' } ); // Tests if all added classes can be consumed.
112
- * viewConsumable.test( p, { attributes: 'style' } ); // Tests if all added styles can be consumed.
113
- * ```
114
- *
115
- * @param consumables Used only if first parameter is {@link module:engine/view/element~Element view element} instance.
116
- * @param consumables.name If set to true element's name will be included.
117
- * @param consumables.attributes Attribute name or array of attribute names.
118
- * @param consumables.classes Class name or array of class names.
119
- * @param consumables.styles Style name or array of style names.
120
- * @returns Returns `true` when all items included in method's call can be consumed. Returns `false`
121
- * when first already consumed item is found and `null` when first non-consumable item is found.
122
- */
123
- test(element: Node | DocumentFragment, consumables?: Consumables | Match): boolean | null;
124
- /**
125
- * Consumes {@link module:engine/view/element~Element view element}, {@link module:engine/view/text~Text text node} or
126
- * {@link module:engine/view/documentfragment~DocumentFragment document fragment}.
127
- * It returns `true` when all items included in method's call can be consumed, otherwise returns `false`.
128
- *
129
- * ```ts
130
- * viewConsumable.consume( p, { name: true } ); // Consumes element's name.
131
- * viewConsumable.consume( p, { attributes: 'name' } ); // Consumes element's attribute.
132
- * viewConsumable.consume( p, { classes: 'foobar' } ); // Consumes element's class.
133
- * viewConsumable.consume( p, { styles: 'color' } ); // Consumes element's style.
134
- * viewConsumable.consume( p, { attributes: 'name', styles: 'color' } ); // Consumes attribute and style.
135
- * viewConsumable.consume( p, { classes: [ 'baz', 'bar' ] } ); // Multiple consumables can be consumed.
136
- * viewConsumable.consume( textNode ); // Consumes text node.
137
- * viewConsumable.consume( docFragment ); // Consumes document fragment.
138
- * ```
139
- *
140
- * Consuming classes and styles as attribute will test if all added classes/styles can be consumed.
141
- *
142
- * ```ts
143
- * viewConsumable.consume( p, { attributes: 'class' } ); // Consume only if all added classes can be consumed.
144
- * viewConsumable.consume( p, { attributes: 'style' } ); // Consume only if all added styles can be consumed.
145
- * ```
146
- *
147
- * @param consumables Used only if first parameter is {@link module:engine/view/element~Element view element} instance.
148
- * @param consumables.name If set to true element's name will be included.
149
- * @param consumables.attributes Attribute name or array of attribute names.
150
- * @param consumables.classes Class name or array of class names.
151
- * @param consumables.styles Style name or array of style names.
152
- * @returns Returns `true` when all items included in method's call can be consumed,
153
- * otherwise returns `false`.
154
- */
155
- consume(element: Node | DocumentFragment, consumables?: Consumables | Match): boolean;
156
- /**
157
- * Reverts {@link module:engine/view/element~Element view element}, {@link module:engine/view/text~Text text node} or
158
- * {@link module:engine/view/documentfragment~DocumentFragment document fragment} so they can be consumed once again.
159
- * Method does not revert items that were never previously added for consumption, even if they are included in
160
- * method's call.
161
- *
162
- * ```ts
163
- * viewConsumable.revert( p, { name: true } ); // Reverts element's name.
164
- * viewConsumable.revert( p, { attributes: 'name' } ); // Reverts element's attribute.
165
- * viewConsumable.revert( p, { classes: 'foobar' } ); // Reverts element's class.
166
- * viewConsumable.revert( p, { styles: 'color' } ); // Reverts element's style.
167
- * viewConsumable.revert( p, { attributes: 'name', styles: 'color' } ); // Reverts attribute and style.
168
- * viewConsumable.revert( p, { classes: [ 'baz', 'bar' ] } ); // Multiple names can be reverted.
169
- * viewConsumable.revert( textNode ); // Reverts text node.
170
- * viewConsumable.revert( docFragment ); // Reverts document fragment.
171
- * ```
172
- *
173
- * Reverting classes and styles as attribute will revert all classes/styles that were previously added for
174
- * consumption.
175
- *
176
- * ```ts
177
- * viewConsumable.revert( p, { attributes: 'class' } ); // Reverts all classes added for consumption.
178
- * viewConsumable.revert( p, { attributes: 'style' } ); // Reverts all styles added for consumption.
179
- * ```
180
- *
181
- * @param consumables Used only if first parameter is {@link module:engine/view/element~Element view element} instance.
182
- * @param consumables.name If set to true element's name will be included.
183
- * @param consumables.attributes Attribute name or array of attribute names.
184
- * @param consumables.classes Class name or array of class names.
185
- * @param consumables.styles Style name or array of style names.
186
- */
187
- revert(element: Node, consumables: Consumables): void;
188
- /**
189
- * Creates consumable object from {@link module:engine/view/element~Element view element}. Consumable object will include
190
- * element's name and all its attributes, classes and styles.
191
- */
192
- static consumablesFromElement(element: Element): Consumables & {
193
- element: Element;
194
- };
195
- /**
196
- * Creates {@link module:engine/conversion/viewconsumable~ViewConsumable ViewConsumable} instance from
197
- * {@link module:engine/view/node~Node node} or {@link module:engine/view/documentfragment~DocumentFragment document fragment}.
198
- * Instance will contain all elements, child nodes, attributes, styles and classes added for consumption.
199
- *
200
- * @param from View node or document fragment from which `ViewConsumable` will be created.
201
- * @param instance If provided, given `ViewConsumable` instance will be used
202
- * to add all consumables. It will be returned instead of a new instance.
203
- */
204
- static createFrom(from: Node | DocumentFragment, instance?: ViewConsumable): ViewConsumable;
205
- }
206
- export interface Consumables {
207
- /**
208
- * If set to true element's name will be included.
209
- */
210
- name?: boolean;
211
- /**
212
- * Attribute name or array of attribute names.
213
- */
214
- attributes?: string | Array<string>;
215
- /**
216
- * Class name or array of class names.
217
- */
218
- classes?: string | Array<string>;
219
- /**
220
- * Style name or array of style names.
221
- */
222
- styles?: string | Array<string>;
223
- }
224
- /**
225
- * This is a private helper-class for {@link module:engine/conversion/viewconsumable~ViewConsumable}.
226
- * It represents and manipulates consumable parts of a single {@link module:engine/view/element~Element}.
227
- */
228
- export declare class ViewElementConsumables {
229
- readonly element: Node | DocumentFragment;
230
- /**
231
- * Flag indicating if name of the element can be consumed.
232
- */
233
- private _canConsumeName;
234
- /**
235
- * Contains maps of element's consumables: attributes, classes and styles.
236
- */
237
- private readonly _consumables;
238
- /**
239
- * Creates ViewElementConsumables instance.
240
- *
241
- * @param from View node or document fragment from which `ViewElementConsumables` is being created.
242
- */
243
- constructor(from: Node | DocumentFragment);
244
- /**
245
- * Adds consumable parts of the {@link module:engine/view/element~Element view element}.
246
- * Element's name itself can be marked to be consumed (when element's name is consumed its attributes, classes and
247
- * styles still could be consumed):
248
- *
249
- * ```ts
250
- * consumables.add( { name: true } );
251
- * ```
252
- *
253
- * Attributes classes and styles:
254
- *
255
- * ```ts
256
- * consumables.add( { attributes: 'title', classes: 'foo', styles: 'color' } );
257
- * consumables.add( { attributes: [ 'title', 'name' ], classes: [ 'foo', 'bar' ] );
258
- * ```
259
- *
260
- * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `viewconsumable-invalid-attribute` when `class` or `style`
261
- * attribute is provided - it should be handled separately by providing `style` and `class` in consumables object.
262
- *
263
- * @param consumables Object describing which parts of the element can be consumed.
264
- * @param consumables.name If set to `true` element's name will be added as consumable.
265
- * @param consumables.attributes Attribute name or array of attribute names to add as consumable.
266
- * @param consumables.classes Class name or array of class names to add as consumable.
267
- * @param consumables.styles Style name or array of style names to add as consumable.
268
- */
269
- add(consumables: Consumables): void;
270
- /**
271
- * Tests if parts of the {@link module:engine/view/node~Node view node} can be consumed.
272
- *
273
- * Element's name can be tested:
274
- *
275
- * ```ts
276
- * consumables.test( { name: true } );
277
- * ```
278
- *
279
- * Attributes classes and styles:
280
- *
281
- * ```ts
282
- * consumables.test( { attributes: 'title', classes: 'foo', styles: 'color' } );
283
- * consumables.test( { attributes: [ 'title', 'name' ], classes: [ 'foo', 'bar' ] );
284
- * ```
285
- *
286
- * @param consumables Object describing which parts of the element should be tested.
287
- * @param consumables.name If set to `true` element's name will be tested.
288
- * @param consumables.attributes Attribute name or array of attribute names to test.
289
- * @param consumables.classes Class name or array of class names to test.
290
- * @param consumables.styles Style name or array of style names to test.
291
- * @returns `true` when all tested items can be consumed, `null` when even one of the items
292
- * was never marked for consumption and `false` when even one of the items was already consumed.
293
- */
294
- test(consumables: Consumables | Match): boolean | null;
295
- /**
296
- * Consumes parts of {@link module:engine/view/element~Element view element}. This function does not check if consumable item
297
- * is already consumed - it consumes all consumable items provided.
298
- * Element's name can be consumed:
299
- *
300
- * ```ts
301
- * consumables.consume( { name: true } );
302
- * ```
303
- *
304
- * Attributes classes and styles:
305
- *
306
- * ```ts
307
- * consumables.consume( { attributes: 'title', classes: 'foo', styles: 'color' } );
308
- * consumables.consume( { attributes: [ 'title', 'name' ], classes: [ 'foo', 'bar' ] );
309
- * ```
310
- *
311
- * @param consumables Object describing which parts of the element should be consumed.
312
- * @param consumables.name If set to `true` element's name will be consumed.
313
- * @param consumables.attributes Attribute name or array of attribute names to consume.
314
- * @param consumables.classes Class name or array of class names to consume.
315
- * @param consumables.styles Style name or array of style names to consume.
316
- */
317
- consume(consumables: Consumables | Match): void;
318
- /**
319
- * Revert already consumed parts of {@link module:engine/view/element~Element view Element}, so they can be consumed once again.
320
- * Element's name can be reverted:
321
- *
322
- * ```ts
323
- * consumables.revert( { name: true } );
324
- * ```
325
- *
326
- * Attributes classes and styles:
327
- *
328
- * ```ts
329
- * consumables.revert( { attributes: 'title', classes: 'foo', styles: 'color' } );
330
- * consumables.revert( { attributes: [ 'title', 'name' ], classes: [ 'foo', 'bar' ] );
331
- * ```
332
- *
333
- * @param consumables Object describing which parts of the element should be reverted.
334
- * @param consumables.name If set to `true` element's name will be reverted.
335
- * @param consumables.attributes Attribute name or array of attribute names to revert.
336
- * @param consumables.classes Class name or array of class names to revert.
337
- * @param consumables.styles Style name or array of style names to revert.
338
- */
339
- revert(consumables: Consumables): void;
340
- /**
341
- * Helper method that adds consumables of a given type: attribute, class or style.
342
- *
343
- * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `viewconsumable-invalid-attribute` when `class` or `style`
344
- * type is provided - it should be handled separately by providing actual style/class type.
345
- *
346
- * @param type Type of the consumable item: `attributes`, `classes` or `styles`.
347
- * @param item Consumable item or array of items.
348
- */
349
- private _add;
350
- /**
351
- * Helper method that tests consumables of a given type: attribute, class or style.
352
- *
353
- * @param type Type of the consumable item: `attributes`, `classes` or `styles`.
354
- * @param item Consumable item or array of items.
355
- * @returns Returns `true` if all items can be consumed, `null` when one of the items cannot be
356
- * consumed and `false` when one of the items is already consumed.
357
- */
358
- private _test;
359
- /**
360
- * Helper method that consumes items of a given type: attribute, class or style.
361
- *
362
- * @param type Type of the consumable item: `attributes`, `classes` or `styles`.
363
- * @param item Consumable item or array of items.
364
- */
365
- private _consume;
366
- /**
367
- * Helper method that reverts items of a given type: attribute, class or style.
368
- *
369
- * @param type Type of the consumable item: `attributes`, `classes` or , `styles`.
370
- * @param item Consumable item or array of items.
371
- */
372
- private _revert;
373
- }
@@ -1,22 +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
- /**
10
- * @module engine/dataprocessor/basichtmlwriter
11
- */
12
- import type HtmlWriter from './htmlwriter.js';
13
- /**
14
- * Basic HTML writer. It uses the native `innerHTML` property for basic conversion
15
- * from a document fragment to an HTML string.
16
- */
17
- export default class BasicHtmlWriter implements HtmlWriter {
18
- /**
19
- * Returns an HTML string created from the document fragment.
20
- */
21
- getHtml(fragment: DocumentFragment): string;
22
- }
@@ -1,65 +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
- /**
10
- * @module engine/dataprocessor/dataprocessor
11
- */
12
- import type ViewDocumentFragment from '../view/documentfragment.js';
13
- import type { MatcherPattern } from '../view/matcher.js';
14
- /**
15
- * The data processor interface. It should be implemented by actual data processors.
16
- *
17
- * Each data processor implements a certain format of the data. For example, {@glink features/markdown Markdown data processor}
18
- * will convert the data (a Markdown string) to a {@link module:engine/view/documentfragment~DocumentFragment document fragment} and back.
19
- *
20
- * **Note:** While the CKEditor 5 architecture supports changing the data format, in most scenarios we do recommend sticking to
21
- * the default format which is HTML (supported by the {@link module:engine/dataprocessor/htmldataprocessor~HtmlDataProcessor}).
22
- * HTML remains [the best standard for rich-text data](https://medium.com/content-uneditable/a-standard-for-rich-text-data-4b3a507af552).
23
- *
24
- * And please do remember – using Markdown [does not automatically make your
25
- * application/website secure](https://github.com/ckeditor/ckeditor5-markdown-gfm/issues/16#issuecomment-375752994).
26
- */
27
- export default interface DataProcessor {
28
- /**
29
- * Converts a {@link module:engine/view/documentfragment~DocumentFragment document fragment} to data.
30
- *
31
- * @param viewFragment The document fragment to be processed.
32
- */
33
- toData(viewFragment: ViewDocumentFragment): string;
34
- /**
35
- * Converts the data to a {@link module:engine/view/documentfragment~DocumentFragment document fragment}.
36
- *
37
- * @param data The data to be processed.
38
- */
39
- toView(data: string): ViewDocumentFragment;
40
- /**
41
- * Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data
42
- * and its content should be converted to a
43
- * {@link module:engine/view/element~Element#getCustomProperty custom property of a view element} called `"$rawContent"` while
44
- * converting {@link #toView to view}.
45
- *
46
- * @param pattern Pattern matching all view elements whose content should be treated as plain text.
47
- */
48
- registerRawContentMatcher(pattern: MatcherPattern): void;
49
- /**
50
- * If the processor is set to use marked fillers, it will insert `&nbsp;` fillers wrapped in `<span>` elements
51
- * (`<span data-cke-filler="true">&nbsp;</span>`) instead of regular `&nbsp;` characters.
52
- *
53
- * This mode allows for more precise handling of block fillers (so they do not leak into the editor content) but bloats the
54
- * editor data with additional markup.
55
- *
56
- * This mode may be required by some features and will be turned on by them automatically.
57
- *
58
- * @param type Whether to use the default or marked `&nbsp;` block fillers.
59
- */
60
- useFillerType(type: 'default' | 'marked'): void;
61
- /**
62
- * If `false`, comment nodes will be converted to `$comment`. Otherwise comment nodes are ignored.
63
- */
64
- skipComments?: boolean;
65
- }
@@ -1,80 +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 DomConverter from '../view/domconverter.js';
10
- import type DataProcessor from './dataprocessor.js';
11
- import type HtmlWriter from './htmlwriter.js';
12
- import type ViewDocument from '../view/document.js';
13
- import type ViewDocumentFragment from '../view/documentfragment.js';
14
- import type { MatcherPattern } from '../view/matcher.js';
15
- /**
16
- * The HTML data processor class.
17
- * This data processor implementation uses HTML as input and output data.
18
- */
19
- export default class HtmlDataProcessor implements DataProcessor {
20
- /**
21
- * A DOM parser instance used to parse an HTML string to an HTML document.
22
- */
23
- domParser: DOMParser;
24
- /**
25
- * A DOM converter used to convert DOM elements to view elements.
26
- */
27
- domConverter: DomConverter;
28
- /**
29
- * A basic HTML writer instance used to convert DOM elements to an HTML string.
30
- */
31
- htmlWriter: HtmlWriter;
32
- skipComments: boolean;
33
- /**
34
- * Creates a new instance of the HTML data processor class.
35
- *
36
- * @param document The view document instance.
37
- */
38
- constructor(document: ViewDocument);
39
- /**
40
- * Converts a provided {@link module:engine/view/documentfragment~DocumentFragment document fragment}
41
- * to data format &ndash; in this case to an HTML string.
42
- *
43
- * @returns HTML string.
44
- */
45
- toData(viewFragment: ViewDocumentFragment): string;
46
- /**
47
- * Converts the provided HTML string to a view tree.
48
- *
49
- * @param data An HTML string.
50
- * @returns A converted view element.
51
- */
52
- toView(data: string): ViewDocumentFragment;
53
- /**
54
- * Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data
55
- * and not processed during the conversion from the DOM to the view elements.
56
- *
57
- * The raw data can be later accessed by a
58
- * {@link module:engine/view/element~Element#getCustomProperty custom property of a view element} called `"$rawContent"`.
59
- *
60
- * @param pattern Pattern matching all view elements whose content should be treated as raw data.
61
- */
62
- registerRawContentMatcher(pattern: MatcherPattern): void;
63
- /**
64
- * If the processor is set to use marked fillers, it will insert `&nbsp;` fillers wrapped in `<span>` elements
65
- * (`<span data-cke-filler="true">&nbsp;</span>`) instead of regular `&nbsp;` characters.
66
- *
67
- * This mode allows for a more precise handling of the block fillers (so they do not leak into the editor content) but
68
- * bloats the editor data with additional markup.
69
- *
70
- * This mode may be required by some features and will be turned on by them automatically.
71
- *
72
- * @param type Whether to use the default or the marked `&nbsp;` block fillers.
73
- */
74
- useFillerType(type: 'default' | 'marked'): void;
75
- /**
76
- * Converts an HTML string to its DOM representation. Returns a document fragment containing nodes parsed from
77
- * the provided data.
78
- */
79
- protected _toDom(data: string): DocumentFragment;
80
- }
@@ -1,20 +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
- /**
10
- * @module engine/dataprocessor/htmlwriter
11
- */
12
- /**
13
- * The HTML writer interface.
14
- */
15
- export default interface HtmlWriter {
16
- /**
17
- * Returns an HTML string created from a document fragment.
18
- */
19
- getHtml(fragment: DocumentFragment): string;
20
- }
@@ -1,94 +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 DomConverter from '../view/domconverter.js';
10
- import type DataProcessor from './dataprocessor.js';
11
- import type HtmlWriter from './htmlwriter.js';
12
- import type ViewDocument from '../view/document.js';
13
- import type ViewDocumentFragment from '../view/documentfragment.js';
14
- import type { MatcherPattern } from '../view/matcher.js';
15
- /**
16
- * The XML data processor class.
17
- * This data processor implementation uses XML as input and output data.
18
- * This class is needed because unlike HTML, XML allows to use any tag with any value.
19
- * For example, `<link>Text</link>` is a valid XML but invalid HTML.
20
- */
21
- export default class XmlDataProcessor implements DataProcessor {
22
- /**
23
- * A list of namespaces allowed to use in the XML input.
24
- *
25
- * For example, registering namespaces [ 'attribute', 'container' ] allows to use `<attirbute:tagName></attribute:tagName>`
26
- * and `<container:tagName></container:tagName>` input. It is mainly for debugging.
27
- */
28
- namespaces: Array<string>;
29
- /**
30
- * DOM parser instance used to parse an XML string to an XML document.
31
- */
32
- domParser: DOMParser;
33
- /**
34
- * DOM converter used to convert DOM elements to view elements.
35
- */
36
- domConverter: DomConverter;
37
- /**
38
- * A basic HTML writer instance used to convert DOM elements to an XML string.
39
- * There is no need to use a dedicated XML writer because the basic HTML writer works well in this case.
40
- */
41
- htmlWriter: HtmlWriter;
42
- skipComments: boolean;
43
- /**
44
- * Creates a new instance of the XML data processor class.
45
- *
46
- * @param document The view document instance.
47
- * @param options Configuration options.
48
- * @param options.namespaces A list of namespaces allowed to use in the XML input.
49
- */
50
- constructor(document: ViewDocument, options?: {
51
- namespaces?: Array<string>;
52
- });
53
- /**
54
- * Converts the provided {@link module:engine/view/documentfragment~DocumentFragment document fragment}
55
- * to data format &ndash; in this case an XML string.
56
- *
57
- * @returns An XML string.
58
- */
59
- toData(viewFragment: ViewDocumentFragment): string;
60
- /**
61
- * Converts the provided XML string to a view tree.
62
- *
63
- * @param data An XML string.
64
- * @returns A converted view element.
65
- */
66
- toView(data: string): ViewDocumentFragment;
67
- /**
68
- * Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data
69
- * and not processed during the conversion from XML to view elements.
70
- *
71
- * The raw data can be later accessed by a
72
- * {@link module:engine/view/element~Element#getCustomProperty custom property of a view element} called `"$rawContent"`.
73
- *
74
- * @param pattern Pattern matching all view elements whose content should be treated as raw data.
75
- */
76
- registerRawContentMatcher(pattern: MatcherPattern): void;
77
- /**
78
- * If the processor is set to use marked fillers, it will insert `&nbsp;` fillers wrapped in `<span>` elements
79
- * (`<span data-cke-filler="true">&nbsp;</span>`) instead of regular `&nbsp;` characters.
80
- *
81
- * This mode allows for a more precise handling of block fillers (so they do not leak into editor content) but
82
- * bloats the editor data with additional markup.
83
- *
84
- * This mode may be required by some features and will be turned on by them automatically.
85
- *
86
- * @param type Whether to use the default or the marked `&nbsp;` block fillers.
87
- */
88
- useFillerType(type: 'default' | 'marked'): void;
89
- /**
90
- * Converts an XML string to its DOM representation. Returns a document fragment containing nodes parsed from
91
- * the provided data.
92
- */
93
- private _toDom;
94
- }