@ckeditor/ckeditor5-engine 44.1.0-alpha.5 → 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,462 +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/model/range
11
- */
12
- import TypeCheckable from './typecheckable.js';
13
- import Position from './position.js';
14
- import TreeWalker, { type TreeWalkerOptions, type TreeWalkerValue } from './treewalker.js';
15
- import type Document from './document.js';
16
- import type DocumentFragment from './documentfragment.js';
17
- import type Element from './element.js';
18
- import type InsertOperation from './operation/insertoperation.js';
19
- import type Item from './item.js';
20
- import type MergeOperation from './operation/mergeoperation.js';
21
- import type MoveOperation from './operation/moveoperation.js';
22
- import type Operation from './operation/operation.js';
23
- import type SplitOperation from './operation/splitoperation.js';
24
- /**
25
- * Represents a range in the model tree.
26
- *
27
- * A range is defined by its {@link module:engine/model/range~Range#start} and {@link module:engine/model/range~Range#end}
28
- * positions.
29
- *
30
- * You can create range instances via its constructor or the `createRange*()` factory methods of
31
- * {@link module:engine/model/model~Model} and {@link module:engine/model/writer~Writer}.
32
- */
33
- export default class Range extends TypeCheckable implements Iterable<TreeWalkerValue> {
34
- /**
35
- * Start position.
36
- */
37
- readonly start: Position;
38
- /**
39
- * End position.
40
- */
41
- readonly end: Position;
42
- /**
43
- * Creates a range spanning from `start` position to `end` position.
44
- *
45
- * @param start The start position.
46
- * @param end The end position. If not set, the range will be collapsed at the `start` position.
47
- */
48
- constructor(start: Position, end?: Position | null);
49
- /**
50
- * Iterable interface.
51
- *
52
- * Iterates over all {@link module:engine/model/item~Item items} that are in this range and returns
53
- * them together with additional information like length or {@link module:engine/model/position~Position positions},
54
- * grouped as {@link module:engine/model/treewalker~TreeWalkerValue}.
55
- * It iterates over all {@link module:engine/model/textproxy~TextProxy text contents} that are inside the range
56
- * and all the {@link module:engine/model/element~Element}s that are entered into when iterating over this range.
57
- *
58
- * This iterator uses {@link module:engine/model/treewalker~TreeWalker} with `boundaries` set to this range
59
- * and `ignoreElementEnd` option set to `true`.
60
- */
61
- [Symbol.iterator](): IterableIterator<TreeWalkerValue>;
62
- /**
63
- * Describes whether the range is collapsed, that is if {@link #start} and
64
- * {@link #end} positions are equal.
65
- */
66
- get isCollapsed(): boolean;
67
- /**
68
- * Describes whether this range is flat, that is if {@link #start} position and
69
- * {@link #end} position are in the same {@link module:engine/model/position~Position#parent}.
70
- */
71
- get isFlat(): boolean;
72
- /**
73
- * Range root element.
74
- */
75
- get root(): Element | DocumentFragment;
76
- /**
77
- * Checks whether this range contains given {@link module:engine/model/position~Position position}.
78
- *
79
- * @param position Position to check.
80
- * @returns `true` if given {@link module:engine/model/position~Position position} is contained
81
- * in this range,`false` otherwise.
82
- */
83
- containsPosition(position: Position): boolean;
84
- /**
85
- * Checks whether this range contains given {@link ~Range range}.
86
- *
87
- * @param otherRange Range to check.
88
- * @param loose Whether the check is loose or strict. If the check is strict (`false`), compared range cannot
89
- * start or end at the same position as this range boundaries. If the check is loose (`true`), compared range can start, end or
90
- * even be equal to this range. Note that collapsed ranges are always compared in strict mode.
91
- * @returns {Boolean} `true` if given {@link ~Range range} boundaries are contained by this range, `false` otherwise.
92
- */
93
- containsRange(otherRange: Range, loose?: boolean): boolean;
94
- /**
95
- * Checks whether given {@link module:engine/model/item~Item} is inside this range.
96
- */
97
- containsItem(item: Item): boolean;
98
- /**
99
- * Two ranges are equal if their {@link #start} and {@link #end} positions are equal.
100
- *
101
- * @param otherRange Range to compare with.
102
- * @returns `true` if ranges are equal, `false` otherwise.
103
- */
104
- isEqual(otherRange: Range): boolean;
105
- /**
106
- * Checks and returns whether this range intersects with given range.
107
- *
108
- * @param otherRange Range to compare with.
109
- * @returns `true` if ranges intersect, `false` otherwise.
110
- */
111
- isIntersecting(otherRange: Range): boolean;
112
- /**
113
- * Computes which part(s) of this {@link ~Range range} is not a part of given {@link ~Range range}.
114
- * Returned array contains zero, one or two {@link ~Range ranges}.
115
- *
116
- * Examples:
117
- *
118
- * ```ts
119
- * let range = model.createRange(
120
- * model.createPositionFromPath( root, [ 2, 7 ] ),
121
- * model.createPositionFromPath( root, [ 4, 0, 1 ] )
122
- * );
123
- * let otherRange = model.createRange( model.createPositionFromPath( root, [ 1 ] ), model.createPositionFromPath( root, [ 5 ] ) );
124
- * let transformed = range.getDifference( otherRange );
125
- * // transformed array has no ranges because `otherRange` contains `range`
126
- *
127
- * otherRange = model.createRange( model.createPositionFromPath( root, [ 1 ] ), model.createPositionFromPath( root, [ 3 ] ) );
128
- * transformed = range.getDifference( otherRange );
129
- * // transformed array has one range: from [ 3 ] to [ 4, 0, 1 ]
130
- *
131
- * otherRange = model.createRange( model.createPositionFromPath( root, [ 3 ] ), model.createPositionFromPath( root, [ 4 ] ) );
132
- * transformed = range.getDifference( otherRange );
133
- * // transformed array has two ranges: from [ 2, 7 ] to [ 3 ] and from [ 4 ] to [ 4, 0, 1 ]
134
- * ```
135
- *
136
- * @param otherRange Range to differentiate against.
137
- * @returns The difference between ranges.
138
- */
139
- getDifference(otherRange: Range): Array<Range>;
140
- /**
141
- * Returns an intersection of this {@link ~Range range} and given {@link ~Range range}.
142
- * Intersection is a common part of both of those ranges. If ranges has no common part, returns `null`.
143
- *
144
- * Examples:
145
- *
146
- * ```ts
147
- * let range = model.createRange(
148
- * model.createPositionFromPath( root, [ 2, 7 ] ),
149
- * model.createPositionFromPath( root, [ 4, 0, 1 ] )
150
- * );
151
- * let otherRange = model.createRange( model.createPositionFromPath( root, [ 1 ] ), model.createPositionFromPath( root, [ 2 ] ) );
152
- * let transformed = range.getIntersection( otherRange ); // null - ranges have no common part
153
- *
154
- * otherRange = model.createRange( model.createPositionFromPath( root, [ 3 ] ), model.createPositionFromPath( root, [ 5 ] ) );
155
- * transformed = range.getIntersection( otherRange ); // range from [ 3 ] to [ 4, 0, 1 ]
156
- * ```
157
- *
158
- * @param otherRange Range to check for intersection.
159
- * @returns A common part of given ranges or `null` if ranges have no common part.
160
- */
161
- getIntersection(otherRange: Range): Range | null;
162
- /**
163
- * Returns a range created by joining this {@link ~Range range} with the given {@link ~Range range}.
164
- * If ranges have no common part, returns `null`.
165
- *
166
- * Examples:
167
- *
168
- * ```ts
169
- * let range = model.createRange(
170
- * model.createPositionFromPath( root, [ 2, 7 ] ),
171
- * model.createPositionFromPath( root, [ 4, 0, 1 ] )
172
- * );
173
- * let otherRange = model.createRange(
174
- * model.createPositionFromPath( root, [ 1 ] ),
175
- * model.createPositionFromPath( root, [ 2 ] )
176
- * );
177
- * let transformed = range.getJoined( otherRange ); // null - ranges have no common part
178
- *
179
- * otherRange = model.createRange(
180
- * model.createPositionFromPath( root, [ 3 ] ),
181
- * model.createPositionFromPath( root, [ 5 ] )
182
- * );
183
- * transformed = range.getJoined( otherRange ); // range from [ 2, 7 ] to [ 5 ]
184
- * ```
185
- *
186
- * @param otherRange Range to be joined.
187
- * @param loose Whether the intersection check is loose or strict. If the check is strict (`false`),
188
- * ranges are tested for intersection or whether start/end positions are equal. If the check is loose (`true`),
189
- * compared range is also checked if it's {@link module:engine/model/position~Position#isTouching touching} current range.
190
- * @returns A sum of given ranges or `null` if ranges have no common part.
191
- */
192
- getJoined(otherRange: Range, loose?: boolean): Range | null;
193
- /**
194
- * Computes and returns the smallest set of {@link #isFlat flat} ranges, that covers this range in whole.
195
- *
196
- * See an example of a model structure (`[` and `]` are range boundaries):
197
- *
198
- * ```
199
- * root root
200
- * |- element DIV DIV P2 P3 DIV
201
- * | |- element H H P1 f o o b a r H P4
202
- * | | |- "fir[st" fir[st lorem se]cond ipsum
203
- * | |- element P1
204
- * | | |- "lorem" ||
205
- * |- element P2 ||
206
- * | |- "foo" VV
207
- * |- element P3
208
- * | |- "bar" root
209
- * |- element DIV DIV [P2 P3] DIV
210
- * | |- element H H [P1] f o o b a r H P4
211
- * | | |- "se]cond" fir[st] lorem [se]cond ipsum
212
- * | |- element P4
213
- * | | |- "ipsum"
214
- * ```
215
- *
216
- * As it can be seen, letters contained in the range are: `stloremfoobarse`, spread across different parents.
217
- * We are looking for minimal set of flat ranges that contains the same nodes.
218
- *
219
- * Minimal flat ranges for above range `( [ 0, 0, 3 ], [ 3, 0, 2 ] )` will be:
220
- *
221
- * ```
222
- * ( [ 0, 0, 3 ], [ 0, 0, 5 ] ) = "st"
223
- * ( [ 0, 1 ], [ 0, 2 ] ) = element P1 ("lorem")
224
- * ( [ 1 ], [ 3 ] ) = element P2, element P3 ("foobar")
225
- * ( [ 3, 0, 0 ], [ 3, 0, 2 ] ) = "se"
226
- * ```
227
- *
228
- * **Note:** if an {@link module:engine/model/element~Element element} is not wholly contained in this range, it won't be returned
229
- * in any of the returned flat ranges. See in the example how `H` elements at the beginning and at the end of the range
230
- * were omitted. Only their parts that were wholly in the range were returned.
231
- *
232
- * **Note:** this method is not returning flat ranges that contain no nodes.
233
- *
234
- * @returns Array of flat ranges covering this range.
235
- */
236
- getMinimalFlatRanges(): Array<Range>;
237
- /**
238
- * Creates a {@link module:engine/model/treewalker~TreeWalker TreeWalker} instance with this range as a boundary.
239
- *
240
- * For example, to iterate over all items in the entire document root:
241
- *
242
- * ```ts
243
- * // Create a range spanning over the entire root content:
244
- * const range = editor.model.createRangeIn( editor.model.document.getRoot() );
245
- *
246
- * // Iterate over all items in this range:
247
- * for ( const value of range.getWalker() ) {
248
- * console.log( value.item );
249
- * }
250
- * ```
251
- *
252
- * @param options Object with configuration options. See {@link module:engine/model/treewalker~TreeWalker}.
253
- */
254
- getWalker(options?: TreeWalkerOptions): TreeWalker;
255
- /**
256
- * Returns an iterator that iterates over all {@link module:engine/model/item~Item items} that are in this range and returns
257
- * them.
258
- *
259
- * This method uses {@link module:engine/model/treewalker~TreeWalker} with `boundaries` set to this range and `ignoreElementEnd` option
260
- * set to `true`. However it returns only {@link module:engine/model/item~Item model items},
261
- * not {@link module:engine/model/treewalker~TreeWalkerValue}.
262
- *
263
- * You may specify additional options for the tree walker. See {@link module:engine/model/treewalker~TreeWalker} for
264
- * a full list of available options.
265
- *
266
- * @param options Object with configuration options. See {@link module:engine/model/treewalker~TreeWalker}.
267
- */
268
- getItems(options?: TreeWalkerOptions): IterableIterator<Item>;
269
- /**
270
- * Returns an iterator that iterates over all {@link module:engine/model/position~Position positions} that are boundaries or
271
- * contained in this range.
272
- *
273
- * This method uses {@link module:engine/model/treewalker~TreeWalker} with `boundaries` set to this range. However it returns only
274
- * {@link module:engine/model/position~Position positions}, not {@link module:engine/model/treewalker~TreeWalkerValue}.
275
- *
276
- * You may specify additional options for the tree walker. See {@link module:engine/model/treewalker~TreeWalker} for
277
- * a full list of available options.
278
- *
279
- * @param options Object with configuration options. See {@link module:engine/model/treewalker~TreeWalker}.
280
- */
281
- getPositions(options?: TreeWalkerOptions): IterableIterator<Position>;
282
- /**
283
- * Returns a range that is a result of transforming this range by given `operation`.
284
- *
285
- * **Note:** transformation may break one range into multiple ranges (for example, when a part of the range is
286
- * moved to a different part of document tree). For this reason, an array is returned by this method and it
287
- * may contain one or more `Range` instances.
288
- *
289
- * @param operation Operation to transform range by.
290
- * @returns Range which is the result of transformation.
291
- */
292
- getTransformedByOperation(operation: Operation): Array<Range>;
293
- /**
294
- * Returns a range that is a result of transforming this range by multiple `operations`.
295
- *
296
- * @see ~Range#getTransformedByOperation
297
- * @param operations Operations to transform the range by.
298
- * @returns Range which is the result of transformation.
299
- */
300
- getTransformedByOperations(operations: Iterable<Operation>): Array<Range>;
301
- /**
302
- * Returns an {@link module:engine/model/element~Element} or {@link module:engine/model/documentfragment~DocumentFragment}
303
- * which is a common ancestor of the range's both ends (in which the entire range is contained).
304
- */
305
- getCommonAncestor(): Element | DocumentFragment | null;
306
- /**
307
- * Returns an {@link module:engine/model/element~Element Element} contained by the range.
308
- * The element will be returned when it is the **only** node within the range and **fully–contained**
309
- * at the same time.
310
- */
311
- getContainedElement(): Element | null;
312
- /**
313
- * Converts `Range` to plain object and returns it.
314
- *
315
- * @returns `Node` converted to plain object.
316
- */
317
- toJSON(): unknown;
318
- /**
319
- * Returns a new range that is equal to current range.
320
- */
321
- clone(): this;
322
- /**
323
- * Returns a result of transforming a copy of this range by insert operation.
324
- *
325
- * One or more ranges may be returned as a result of this transformation.
326
- *
327
- * @internal
328
- */
329
- _getTransformedByInsertOperation(operation: InsertOperation, spread?: boolean): Array<Range>;
330
- /**
331
- * Returns a result of transforming a copy of this range by move operation.
332
- *
333
- * One or more ranges may be returned as a result of this transformation.
334
- *
335
- * @internal
336
- */
337
- _getTransformedByMoveOperation(operation: MoveOperation, spread?: boolean): Array<Range>;
338
- /**
339
- * Returns a result of transforming a copy of this range by split operation.
340
- *
341
- * Always one range is returned. The transformation is done in a way to not break the range.
342
- *
343
- * @internal
344
- */
345
- _getTransformedBySplitOperation(operation: SplitOperation): Range;
346
- /**
347
- * Returns a result of transforming a copy of this range by merge operation.
348
- *
349
- * Always one range is returned. The transformation is done in a way to not break the range.
350
- *
351
- * @internal
352
- */
353
- _getTransformedByMergeOperation(operation: MergeOperation): Range;
354
- /**
355
- * Returns an array containing one or two {@link ~Range ranges} that are a result of transforming this
356
- * {@link ~Range range} by inserting `howMany` nodes at `insertPosition`. Two {@link ~Range ranges} are
357
- * returned if the insertion was inside this {@link ~Range range} and `spread` is set to `true`.
358
- *
359
- * Examples:
360
- *
361
- * ```ts
362
- * let range = model.createRange(
363
- * model.createPositionFromPath( root, [ 2, 7 ] ),
364
- * model.createPositionFromPath( root, [ 4, 0, 1 ] )
365
- * );
366
- * let transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 1 ] ), 2 );
367
- * // transformed array has one range from [ 4, 7 ] to [ 6, 0, 1 ]
368
- *
369
- * transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 4, 0, 0 ] ), 4 );
370
- * // transformed array has one range from [ 2, 7 ] to [ 4, 0, 5 ]
371
- *
372
- * transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 3, 2 ] ), 4 );
373
- * // transformed array has one range, which is equal to original range
374
- *
375
- * transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 3, 2 ] ), 4, true );
376
- * // transformed array has two ranges: from [ 2, 7 ] to [ 3, 2 ] and from [ 3, 6 ] to [ 4, 0, 1 ]
377
- * ```
378
- *
379
- * @internal
380
- * @param insertPosition Position where nodes are inserted.
381
- * @param howMany How many nodes are inserted.
382
- * @param spread Flag indicating whether this range should be spread if insertion
383
- * was inside the range. Defaults to `false`.
384
- * @returns Result of the transformation.
385
- */
386
- _getTransformedByInsertion(insertPosition: Position, howMany: number, spread?: boolean): Array<Range>;
387
- /**
388
- * Returns an array containing {@link ~Range ranges} that are a result of transforming this
389
- * {@link ~Range range} by moving `howMany` nodes from `sourcePosition` to `targetPosition`.
390
- *
391
- * @internal
392
- * @param sourcePosition Position from which nodes are moved.
393
- * @param targetPosition Position to where nodes are moved.
394
- * @param howMany How many nodes are moved.
395
- * @param spread Whether the range should be spread if the move points inside the range.
396
- * @returns Result of the transformation.
397
- */
398
- _getTransformedByMove(sourcePosition: Position, targetPosition: Position, howMany: number, spread?: boolean): Array<Range>;
399
- /**
400
- * Returns a copy of this range that is transformed by deletion of `howMany` nodes from `deletePosition`.
401
- *
402
- * If the deleted range is intersecting with the transformed range, the transformed range will be shrank.
403
- *
404
- * If the deleted range contains transformed range, `null` will be returned.
405
- *
406
- * @internal
407
- * @param deletionPosition Position from which nodes are removed.
408
- * @param howMany How many nodes are removed.
409
- * @returns Result of the transformation.
410
- */
411
- _getTransformedByDeletion(deletePosition: Position, howMany: number): Range | null;
412
- /**
413
- * Creates a new range, spreading from specified {@link module:engine/model/position~Position position} to a position moved by
414
- * given `shift`. If `shift` is a negative value, shifted position is treated as the beginning of the range.
415
- *
416
- * @internal
417
- * @param position Beginning of the range.
418
- * @param shift How long the range should be.
419
- */
420
- static _createFromPositionAndShift(position: Position, shift: number): Range;
421
- /**
422
- * Creates a range inside an {@link module:engine/model/element~Element element} which starts before the first child of
423
- * that element and ends after the last child of that element.
424
- *
425
- * @internal
426
- * @param element Element which is a parent for the range.
427
- */
428
- static _createIn(element: Element | DocumentFragment): Range;
429
- /**
430
- * Creates a range that starts before given {@link module:engine/model/item~Item model item} and ends after it.
431
- *
432
- * @internal
433
- */
434
- static _createOn(item: Item): Range;
435
- /**
436
- * Combines all ranges from the passed array into a one range. At least one range has to be passed.
437
- * Passed ranges must not have common parts.
438
- *
439
- * The first range from the array is a reference range. If other ranges start or end on the exactly same position where
440
- * the reference range, they get combined into one range.
441
- *
442
- * ```
443
- * [ ][] [ ][ ][ ][ ][] [ ] // Passed ranges, shown sorted
444
- * [ ] // The result of the function if the first range was a reference range.
445
- * [ ] // The result of the function if the third-to-seventh range was a reference range.
446
- * [ ] // The result of the function if the last range was a reference range.
447
- * ```
448
- *
449
- * @internal
450
- * @param ranges Ranges to combine.
451
- * @returns Combined range.
452
- */
453
- static _createFromRanges(ranges: Array<Range>): Range;
454
- /**
455
- * Creates a `Range` instance from given plain object (i.e. parsed JSON string).
456
- *
457
- * @param json Plain object to be converted to `Range`.
458
- * @param doc Document object that will be range owner.
459
- * @returns `Range` instance created using given plain object.
460
- */
461
- static fromJSON(json: any, doc: Document): Range;
462
- }
@@ -1,64 +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/model/rootelement
11
- */
12
- import Element from './element.js';
13
- import type Document from './document.js';
14
- /**
15
- * Type of {@link module:engine/model/element~Element} that is a root of a model tree.
16
- */
17
- export default class RootElement extends Element {
18
- /**
19
- * Unique root name used to identify this root element by {@link module:engine/model/document~Document}.
20
- */
21
- readonly rootName: string;
22
- /**
23
- * Document that is an owner of this root.
24
- */
25
- private readonly _document;
26
- /**
27
- * @internal
28
- */
29
- _isAttached: boolean;
30
- /**
31
- * Informs if the root element is loaded (default).
32
- *
33
- * @internal
34
- */
35
- _isLoaded: boolean;
36
- /**
37
- * Creates root element.
38
- *
39
- * @param document Document that is an owner of this root.
40
- * @param name Node name.
41
- * @param rootName Unique root name used to identify this root element by {@link module:engine/model/document~Document}.
42
- */
43
- constructor(document: Document, name: string, rootName?: string);
44
- /**
45
- * {@link module:engine/model/document~Document Document} that owns this root element.
46
- */
47
- get document(): Document;
48
- /**
49
- * Informs if the root element is currently attached to the document, or not.
50
- *
51
- * A detached root is equivalent to being removed and cannot contain any children or markers.
52
- *
53
- * By default, a newly added root is attached. It can be detached using
54
- * {@link module:engine/model/writer~Writer#detachRoot `Writer#detachRoot`}. A detached root can be re-attached again using
55
- * {@link module:engine/model/writer~Writer#addRoot `Writer#addRoot`}.
56
- */
57
- isAttached(): boolean;
58
- /**
59
- * Converts `RootElement` instance to `string` containing its name.
60
- *
61
- * @returns `RootElement` instance converted to `string`.
62
- */
63
- toJSON(): unknown;
64
- }