@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,262 +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/node
11
- */
12
- import TypeCheckable from './typecheckable.js';
13
- import type Document from './document.js';
14
- import type DocumentFragment from './documentfragment.js';
15
- import type Element from './element.js';
16
- /**
17
- * Model node. Most basic structure of model tree.
18
- *
19
- * This is an abstract class that is a base for other classes representing different nodes in model.
20
- *
21
- * **Note:** If a node is detached from the model tree, you can manipulate it using it's API.
22
- * However, it is **very important** that nodes already attached to model tree should be only changed through
23
- * {@link module:engine/model/writer~Writer Writer API}.
24
- *
25
- * Changes done by `Node` methods, like {@link module:engine/model/element~Element#_insertChild _insertChild} or
26
- * {@link module:engine/model/node~Node#_setAttribute _setAttribute}
27
- * do not generate {@link module:engine/model/operation/operation~Operation operations}
28
- * which are essential for correct editor work if you modify nodes in {@link module:engine/model/document~Document document} root.
29
- *
30
- * The flow of working on `Node` (and classes that inherits from it) is as such:
31
- * 1. You can create a `Node` instance, modify it using it's API.
32
- * 2. Add `Node` to the model using `Batch` API.
33
- * 3. Change `Node` that was already added to the model using `Batch` API.
34
- *
35
- * Similarly, you cannot use `Batch` API on a node that has not been added to the model tree, with the exception
36
- * of {@link module:engine/model/writer~Writer#insert inserting} that node to the model tree.
37
- *
38
- * Be aware that using {@link module:engine/model/writer~Writer#remove remove from Batch API} does not allow to use `Node` API because
39
- * the information about `Node` is still kept in model document.
40
- *
41
- * In case of {@link module:engine/model/element~Element element node}, adding and removing children also counts as changing a node and
42
- * follows same rules.
43
- */
44
- export default abstract class Node extends TypeCheckable {
45
- /**
46
- * Parent of this node. It could be {@link module:engine/model/element~Element}
47
- * or {@link module:engine/model/documentfragment~DocumentFragment}.
48
- * Equals to `null` if the node has no parent.
49
- */
50
- readonly parent: Element | DocumentFragment | null;
51
- /**
52
- * Unique root name used to identify this root element by {@link module:engine/model/document~Document}.
53
- */
54
- readonly rootName: string | undefined;
55
- /**
56
- * Attributes set on this node.
57
- */
58
- private _attrs;
59
- /**
60
- * Index of this node in its parent or `null` if the node has no parent.
61
- *
62
- * @internal
63
- */
64
- _index: number | null;
65
- /**
66
- * Offset at which this node starts in its parent or `null` if the node has no parent.
67
- *
68
- * @internal
69
- */
70
- _startOffset: number | null;
71
- /**
72
- * Creates a model node.
73
- *
74
- * This is an abstract class, so this constructor should not be used directly.
75
- *
76
- * @param attrs Node's attributes. See {@link module:utils/tomap~toMap} for a list of accepted values.
77
- */
78
- constructor(attrs?: NodeAttributes);
79
- /**
80
- * {@link module:engine/model/document~Document Document} that owns this root element.
81
- */
82
- get document(): Document | null;
83
- /**
84
- * Index of this node in its parent or `null` if the node has no parent.
85
- */
86
- get index(): number | null;
87
- /**
88
- * Offset at which this node starts in its parent. It is equal to the sum of {@link #offsetSize offsetSize}
89
- * of all its previous siblings. Equals to `null` if node has no parent.
90
- */
91
- get startOffset(): number | null;
92
- /**
93
- * Offset size of this node.
94
- *
95
- * Represents how much "offset space" is occupied by the node in its parent. It is important for
96
- * {@link module:engine/model/position~Position position}. When node has `offsetSize` greater than `1`, position can be placed between
97
- * that node start and end. `offsetSize` greater than `1` is for nodes that represents more than one entity, i.e.
98
- * a {@link module:engine/model/text~Text text node}.
99
- */
100
- get offsetSize(): number;
101
- /**
102
- * Offset at which this node ends in its parent. It is equal to the sum of this node's
103
- * {@link module:engine/model/node~Node#startOffset start offset} and {@link #offsetSize offset size}.
104
- * Equals to `null` if the node has no parent.
105
- */
106
- get endOffset(): number | null;
107
- /**
108
- * Node's next sibling or `null` if the node is a last child of it's parent or if the node has no parent.
109
- */
110
- get nextSibling(): Node | null;
111
- /**
112
- * Node's previous sibling or `null` if the node is a first child of it's parent or if the node has no parent.
113
- */
114
- get previousSibling(): Node | null;
115
- /**
116
- * The top-most ancestor of the node. If node has no parent it is the root itself. If the node is a part
117
- * of {@link module:engine/model/documentfragment~DocumentFragment}, it's `root` is equal to that `DocumentFragment`.
118
- */
119
- get root(): Node | DocumentFragment;
120
- /**
121
- * Returns `true` if the node is inside a document root that is attached to the document.
122
- */
123
- isAttached(): boolean;
124
- /**
125
- * Gets path to the node. The path is an array containing starting offsets of consecutive ancestors of this node,
126
- * beginning from {@link module:engine/model/node~Node#root root}, down to this node's starting offset. The path can be used to
127
- * create {@link module:engine/model/position~Position Position} instance.
128
- *
129
- * ```ts
130
- * const abc = new Text( 'abc' );
131
- * const foo = new Text( 'foo' );
132
- * const h1 = new Element( 'h1', null, new Text( 'header' ) );
133
- * const p = new Element( 'p', null, [ abc, foo ] );
134
- * const div = new Element( 'div', null, [ h1, p ] );
135
- * foo.getPath(); // Returns [ 1, 3 ]. `foo` is in `p` which is in `div`. `p` starts at offset 1, while `foo` at 3.
136
- * h1.getPath(); // Returns [ 0 ].
137
- * div.getPath(); // Returns [].
138
- * ```
139
- */
140
- getPath(): Array<number>;
141
- /**
142
- * Returns ancestors array of this node.
143
- *
144
- * @param options Options object.
145
- * @param options.includeSelf When set to `true` this node will be also included in parent's array.
146
- * @param options.parentFirst When set to `true`, array will be sorted from node's parent to root element,
147
- * otherwise root element will be the first item in the array.
148
- * @returns Array with ancestors.
149
- */
150
- getAncestors(options?: {
151
- includeSelf?: boolean;
152
- parentFirst?: boolean;
153
- }): Array<Node | DocumentFragment>;
154
- /**
155
- * Returns a {@link module:engine/model/element~Element} or {@link module:engine/model/documentfragment~DocumentFragment}
156
- * which is a common ancestor of both nodes.
157
- *
158
- * @param node The second node.
159
- * @param options Options object.
160
- * @param options.includeSelf When set to `true` both nodes will be considered "ancestors" too.
161
- * Which means that if e.g. node A is inside B, then their common ancestor will be B.
162
- */
163
- getCommonAncestor(node: Node, options?: {
164
- includeSelf?: boolean;
165
- }): Element | DocumentFragment | null;
166
- /**
167
- * Returns whether this node is before given node. `false` is returned if nodes are in different trees (for example,
168
- * in different {@link module:engine/model/documentfragment~DocumentFragment}s).
169
- *
170
- * @param node Node to compare with.
171
- */
172
- isBefore(node: Node): boolean;
173
- /**
174
- * Returns whether this node is after given node. `false` is returned if nodes are in different trees (for example,
175
- * in different {@link module:engine/model/documentfragment~DocumentFragment}s).
176
- *
177
- * @param node Node to compare with.
178
- */
179
- isAfter(node: Node): boolean;
180
- /**
181
- * Checks if the node has an attribute with given key.
182
- *
183
- * @param key Key of attribute to check.
184
- * @returns `true` if attribute with given key is set on node, `false` otherwise.
185
- */
186
- hasAttribute(key: string): boolean;
187
- /**
188
- * Gets an attribute value for given key or `undefined` if that attribute is not set on node.
189
- *
190
- * @param key Key of attribute to look for.
191
- * @returns Attribute value or `undefined`.
192
- */
193
- getAttribute(key: string): unknown;
194
- /**
195
- * Returns iterator that iterates over this node's attributes.
196
- *
197
- * Attributes are returned as arrays containing two items. First one is attribute key and second is attribute value.
198
- * This format is accepted by native `Map` object and also can be passed in `Node` constructor.
199
- */
200
- getAttributes(): IterableIterator<[string, unknown]>;
201
- /**
202
- * Returns iterator that iterates over this node's attribute keys.
203
- */
204
- getAttributeKeys(): IterableIterator<string>;
205
- /**
206
- * Converts `Node` to plain object and returns it.
207
- *
208
- * @returns `Node` converted to plain object.
209
- */
210
- toJSON(): unknown;
211
- /**
212
- * Creates a copy of this node, that is a node with exactly same attributes, and returns it.
213
- *
214
- * @internal
215
- * @returns Node with same attributes as this node.
216
- */
217
- _clone(_deep?: boolean): Node;
218
- /**
219
- * Removes this node from its parent.
220
- *
221
- * @internal
222
- * @see module:engine/model/writer~Writer#remove
223
- */
224
- _remove(): void;
225
- /**
226
- * Sets attribute on the node. If attribute with the same key already is set, it's value is overwritten.
227
- *
228
- * @see module:engine/model/writer~Writer#setAttribute
229
- * @internal
230
- * @param key Key of attribute to set.
231
- * @param value Attribute value.
232
- */
233
- _setAttribute(key: string, value: unknown): void;
234
- /**
235
- * Removes all attributes from the node and sets given attributes.
236
- *
237
- * @see module:engine/model/writer~Writer#setAttributes
238
- * @internal
239
- * @param attrs Attributes to set. See {@link module:utils/tomap~toMap} for a list of accepted values.
240
- */
241
- _setAttributesTo(attrs: NodeAttributes): void;
242
- /**
243
- * Removes an attribute with given key from the node.
244
- *
245
- * @see module:engine/model/writer~Writer#removeAttribute
246
- * @internal
247
- * @param key Key of attribute to remove.
248
- * @returns `true` if the attribute was set on the element, `false` otherwise.
249
- */
250
- _removeAttribute(key: string): boolean;
251
- /**
252
- * Removes all attributes from the node.
253
- *
254
- * @see module:engine/model/writer~Writer#clearAttributes
255
- * @internal
256
- */
257
- _clearAttributes(): void;
258
- }
259
- /**
260
- * Node's attributes. See {@link module:utils/tomap~toMap} for a list of accepted values.
261
- */
262
- export type NodeAttributes = Record<string, unknown> | Iterable<[string, unknown]>;
@@ -1,119 +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/nodelist
11
- */
12
- import Node from './node.js';
13
- /**
14
- * Provides an interface to operate on a list of {@link module:engine/model/node~Node nodes}. `NodeList` is used internally
15
- * in classes like {@link module:engine/model/element~Element Element}
16
- * or {@link module:engine/model/documentfragment~DocumentFragment DocumentFragment}.
17
- */
18
- export default class NodeList implements Iterable<Node> {
19
- /**
20
- * Nodes contained in this node list.
21
- */
22
- private _nodes;
23
- /**
24
- * This array maps numbers (offsets) to node that is placed at that offset.
25
- *
26
- * This array is similar to `_nodes` with the difference that one node may occupy multiple consecutive items in the array.
27
- *
28
- * This array is needed to quickly retrieve a node that is placed at given offset.
29
- */
30
- private _offsetToNode;
31
- /**
32
- * Creates a node list.
33
- *
34
- * @internal
35
- * @param nodes Nodes contained in this node list.
36
- */
37
- constructor(nodes?: Iterable<Node>);
38
- /**
39
- * Iterable interface.
40
- *
41
- * Iterates over all nodes contained inside this node list.
42
- */
43
- [Symbol.iterator](): IterableIterator<Node>;
44
- /**
45
- * Number of nodes contained inside this node list.
46
- */
47
- get length(): number;
48
- /**
49
- * Sum of {@link module:engine/model/node~Node#offsetSize offset sizes} of all nodes contained inside this node list.
50
- */
51
- get maxOffset(): number;
52
- /**
53
- * Gets the node at the given index. Returns `null` if incorrect index was passed.
54
- */
55
- getNode(index: number): Node | null;
56
- /**
57
- * Gets the node at the given offset. Returns `null` if incorrect offset was passed.
58
- */
59
- getNodeAtOffset(offset: number): Node | null;
60
- /**
61
- * Returns an index of the given node or `null` if given node does not have a parent.
62
- *
63
- * This is an alias to {@link module:engine/model/node~Node#index}.
64
- */
65
- getNodeIndex(node: Node): number | null;
66
- /**
67
- * Returns the offset at which given node is placed in its parent or `null` if given node does not have a parent.
68
- *
69
- * This is an alias to {@link module:engine/model/node~Node#startOffset}.
70
- */
71
- getNodeStartOffset(node: Node): number | null;
72
- /**
73
- * Converts index to offset in node list.
74
- *
75
- * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `model-nodelist-index-out-of-bounds` if given index is less
76
- * than `0` or more than {@link #length}.
77
- */
78
- indexToOffset(index: number): number;
79
- /**
80
- * Converts offset in node list to index.
81
- *
82
- * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `model-nodelist-offset-out-of-bounds` if given offset is less
83
- * than `0` or more than {@link #maxOffset}.
84
- */
85
- offsetToIndex(offset: number): number;
86
- /**
87
- * Inserts given nodes at given index.
88
- *
89
- * @internal
90
- * @param index Index at which nodes should be inserted.
91
- * @param nodes Nodes to be inserted.
92
- */
93
- _insertNodes(index: number, nodes: Iterable<Node>): void;
94
- /**
95
- * Removes one or more nodes starting at the given index.
96
- *
97
- * @internal
98
- * @param indexStart Index of the first node to remove.
99
- * @param howMany Number of nodes to remove.
100
- * @returns Array containing removed nodes.
101
- */
102
- _removeNodes(indexStart: number, howMany?: number): Array<Node>;
103
- /**
104
- * Removes children nodes provided as an array. These nodes do not need to be direct siblings.
105
- *
106
- * This method is faster than removing nodes one by one, as it recalculates offsets only once.
107
- *
108
- * @internal
109
- * @param nodes Array of nodes.
110
- */
111
- _removeNodesArray(nodes: Array<Node>): void;
112
- /**
113
- * Converts `NodeList` instance to an array containing nodes that were inserted in the node list. Nodes
114
- * are also converted to their plain object representation.
115
- *
116
- * @returns `NodeList` instance converted to `Array`.
117
- */
118
- toJSON(): unknown;
119
- }
@@ -1,107 +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/operation/attributeoperation
11
- */
12
- import Operation from './operation.js';
13
- import Range from '../range.js';
14
- import type Document from '../document.js';
15
- import type { Selectable } from '../selection.js';
16
- /**
17
- * Operation to change nodes' attribute.
18
- *
19
- * Using this class you can add, remove or change value of the attribute.
20
- */
21
- export default class AttributeOperation extends Operation {
22
- /**
23
- * Range on which operation should be applied.
24
- *
25
- * @readonly
26
- */
27
- range: Range;
28
- /**
29
- * Key of an attribute to change or remove.
30
- *
31
- * @readonly
32
- */
33
- key: string;
34
- /**
35
- * Old value of the attribute with given key or `null`, if attribute was not set before.
36
- *
37
- * @readonly
38
- */
39
- oldValue: unknown;
40
- /**
41
- * New value of the attribute with given key or `null`, if operation should remove attribute.
42
- *
43
- * @readonly
44
- */
45
- newValue: unknown;
46
- /**
47
- * Creates an operation that changes, removes or adds attributes.
48
- *
49
- * If only `newValue` is set, attribute will be added on a node. Note that all nodes in operation's range must not
50
- * have an attribute with the same key as the added attribute.
51
- *
52
- * If only `oldValue` is set, then attribute with given key will be removed. Note that all nodes in operation's range
53
- * must have an attribute with that key added.
54
- *
55
- * If both `newValue` and `oldValue` are set, then the operation will change the attribute value. Note that all nodes in
56
- * operation's ranges must already have an attribute with given key and `oldValue` as value
57
- *
58
- * @param range Range on which the operation should be applied. Must be a flat range.
59
- * @param key Key of an attribute to change or remove.
60
- * @param oldValue Old value of the attribute with given key or `null`, if attribute was not set before.
61
- * @param newValue New value of the attribute with given key or `null`, if operation should remove attribute.
62
- * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
63
- * can be applied or `null` if the operation operates on detached (non-document) tree.
64
- */
65
- constructor(range: Range, key: string, oldValue: unknown, newValue: unknown, baseVersion: number | null);
66
- /**
67
- * @inheritDoc
68
- */
69
- get type(): 'addAttribute' | 'removeAttribute' | 'changeAttribute';
70
- /**
71
- * @inheritDoc
72
- */
73
- get affectedSelectable(): Selectable;
74
- /**
75
- * Creates and returns an operation that has the same parameters as this operation.
76
- */
77
- clone(): AttributeOperation;
78
- /**
79
- * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
80
- */
81
- getReversed(): Operation;
82
- /**
83
- * @inheritDoc
84
- */
85
- toJSON(): unknown;
86
- /**
87
- * @inheritDoc
88
- * @internal
89
- */
90
- _validate(): void;
91
- /**
92
- * @inheritDoc
93
- * @internal
94
- */
95
- _execute(): void;
96
- /**
97
- * @inheritDoc
98
- */
99
- static get className(): string;
100
- /**
101
- * Creates `AttributeOperation` object from deserialized object, i.e. from parsed JSON string.
102
- *
103
- * @param json Deserialized JSON object.
104
- * @param document Document on which this operation will be applied.
105
- */
106
- static fromJSON(json: any, document: Document): AttributeOperation;
107
- }
@@ -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/operation/detachoperation
11
- */
12
- import Operation from './operation.js';
13
- import type Position from '../position.js';
14
- import type { Selectable } from '../selection.js';
15
- /**
16
- * Operation to permanently remove node from detached root.
17
- * Note this operation is only a local operation and won't be send to the other clients.
18
- */
19
- export default class DetachOperation extends Operation {
20
- /**
21
- * Position before the first {@link module:engine/model/item~Item model item} to detach.
22
- */
23
- sourcePosition: Position;
24
- /**
25
- * Offset size of moved range.
26
- */
27
- howMany: number;
28
- clone: never;
29
- getReversed: never;
30
- /**
31
- * Creates an insert operation.
32
- *
33
- * @param sourcePosition Position before the first {@link module:engine/model/item~Item model item} to move.
34
- * @param howMany Offset size of moved range. Moved range will start from `sourcePosition` and end at
35
- * `sourcePosition` with offset shifted by `howMany`.
36
- */
37
- constructor(sourcePosition: Position, howMany: number);
38
- /**
39
- * @inheritDoc
40
- */
41
- get type(): 'detach';
42
- /**
43
- * @inheritDoc
44
- */
45
- get affectedSelectable(): Selectable;
46
- /**
47
- * @inheritDoc
48
- */
49
- toJSON(): unknown;
50
- /**
51
- * @inheritDoc
52
- * @internal
53
- */
54
- _validate(): void;
55
- /**
56
- * @inheritDoc
57
- * @internal
58
- */
59
- _execute(): void;
60
- /**
61
- * @inheritDoc
62
- */
63
- static get className(): string;
64
- }
@@ -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
- /**
10
- * @module engine/model/operation/insertoperation
11
- */
12
- import Operation from './operation.js';
13
- import Position from '../position.js';
14
- import NodeList from '../nodelist.js';
15
- import { type NodeSet } from './utils.js';
16
- import type { Selectable } from '../selection.js';
17
- import type Document from '../document.js';
18
- /**
19
- * Operation to insert one or more nodes at given position in the model.
20
- */
21
- export default class InsertOperation extends Operation {
22
- /**
23
- * Position of insertion.
24
- *
25
- * @readonly
26
- */
27
- position: Position;
28
- /**
29
- * List of nodes to insert.
30
- *
31
- * @readonly
32
- */
33
- nodes: NodeList;
34
- /**
35
- * Flag deciding how the operation should be transformed. If set to `true`, nodes might get additional attributes
36
- * during operational transformation. This happens when the operation insertion position is inside of a range
37
- * where attributes have changed.
38
- */
39
- shouldReceiveAttributes: boolean;
40
- /**
41
- * Creates an insert operation.
42
- *
43
- * @param position Position of insertion.
44
- * @param nodes The list of nodes to be inserted.
45
- * @param baseVersion Document {@link module:engine/model/document~Document#version} on which operation
46
- * can be applied or `null` if the operation operates on detached (non-document) tree.
47
- */
48
- constructor(position: Position, nodes: NodeSet, baseVersion: number | null);
49
- /**
50
- * @inheritDoc
51
- */
52
- get type(): 'insert';
53
- /**
54
- * Total offset size of inserted nodes.
55
- */
56
- get howMany(): number;
57
- /**
58
- * @inheritDoc
59
- */
60
- get affectedSelectable(): Selectable;
61
- /**
62
- * Creates and returns an operation that has the same parameters as this operation.
63
- */
64
- clone(): InsertOperation;
65
- /**
66
- * See {@link module:engine/model/operation/operation~Operation#getReversed `Operation#getReversed()`}.
67
- */
68
- getReversed(): Operation;
69
- /**
70
- * @inheritDoc
71
- * @internal
72
- */
73
- _validate(): void;
74
- /**
75
- * @inheritDoc
76
- * @internal
77
- */
78
- _execute(): void;
79
- /**
80
- * @inheritDoc
81
- */
82
- toJSON(): unknown;
83
- /**
84
- * @inheritDoc
85
- */
86
- static get className(): string;
87
- /**
88
- * Creates `InsertOperation` object from deserialized object, i.e. from parsed JSON string.
89
- *
90
- * @param json Deserialized JSON object.
91
- * @param document Document on which this operation will be applied.
92
- */
93
- static fromJSON(json: any, document: Document): InsertOperation;
94
- }