@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,488 +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/view/view
11
- */
12
- import Document from './document.js';
13
- import DowncastWriter from './downcastwriter.js';
14
- import DomConverter from './domconverter.js';
15
- import Position, { type PositionOffset } from './position.js';
16
- import Range from './range.js';
17
- import Selection, { type PlaceOrOffset, type Selectable, type SelectionOptions } from './selection.js';
18
- import type { default as Observer, ObserverConstructor } from './observer/observer.js';
19
- import type { StylesProcessor } from './stylesmap.js';
20
- import type Element from './element.js';
21
- import type { default as Node } from './node.js';
22
- import type Item from './item.js';
23
- import KeyObserver from './observer/keyobserver.js';
24
- import FakeSelectionObserver from './observer/fakeselectionobserver.js';
25
- import MutationObserver from './observer/mutationobserver.js';
26
- import SelectionObserver from './observer/selectionobserver.js';
27
- import FocusObserver from './observer/focusobserver.js';
28
- import CompositionObserver from './observer/compositionobserver.js';
29
- import InputObserver from './observer/inputobserver.js';
30
- import ArrowKeysObserver from './observer/arrowkeysobserver.js';
31
- import TabObserver from './observer/tabobserver.js';
32
- type IfTrue<T> = T extends true ? true : never;
33
- type DomRange = globalThis.Range;
34
- declare const View_base: {
35
- new (): import("@ckeditor/ckeditor5-utils").Observable;
36
- prototype: import("@ckeditor/ckeditor5-utils").Observable;
37
- };
38
- /**
39
- * Editor's view controller class. Its main responsibility is DOM - View management for editing purposes, to provide
40
- * abstraction over the DOM structure and events and hide all browsers quirks.
41
- *
42
- * View controller renders view document to DOM whenever view structure changes. To determine when view can be rendered,
43
- * all changes need to be done using the {@link module:engine/view/view~View#change} method, using
44
- * {@link module:engine/view/downcastwriter~DowncastWriter}:
45
- *
46
- * ```ts
47
- * view.change( writer => {
48
- * writer.insert( position, writer.createText( 'foo' ) );
49
- * } );
50
- * ```
51
- *
52
- * View controller also register {@link module:engine/view/observer/observer~Observer observers} which observes changes
53
- * on DOM and fire events on the {@link module:engine/view/document~Document Document}.
54
- * Note that the following observers are added by the class constructor and are always available:
55
- *
56
- * * {@link module:engine/view/observer/selectionobserver~SelectionObserver},
57
- * * {@link module:engine/view/observer/focusobserver~FocusObserver},
58
- * * {@link module:engine/view/observer/keyobserver~KeyObserver},
59
- * * {@link module:engine/view/observer/fakeselectionobserver~FakeSelectionObserver}.
60
- * * {@link module:engine/view/observer/compositionobserver~CompositionObserver}.
61
- * * {@link module:engine/view/observer/inputobserver~InputObserver}.
62
- * * {@link module:engine/view/observer/arrowkeysobserver~ArrowKeysObserver}.
63
- * * {@link module:engine/view/observer/tabobserver~TabObserver}.
64
- *
65
- * This class also {@link module:engine/view/view~View#attachDomRoot binds the DOM and the view elements}.
66
- *
67
- * If you do not need full a DOM - view management, and only want to transform a tree of view elements to a tree of DOM
68
- * elements you do not need this controller. You can use the {@link module:engine/view/domconverter~DomConverter DomConverter} instead.
69
- */
70
- export default class View extends /* #__PURE__ */ View_base {
71
- /**
72
- * Instance of the {@link module:engine/view/document~Document} associated with this view controller.
73
- */
74
- readonly document: Document;
75
- /**
76
- * Instance of the {@link module:engine/view/domconverter~DomConverter domConverter} used by
77
- * {@link module:engine/view/view~View#_renderer renderer}
78
- * and {@link module:engine/view/observer/observer~Observer observers}.
79
- */
80
- readonly domConverter: DomConverter;
81
- /**
82
- * Roots of the DOM tree. Map on the `HTMLElement`s with roots names as keys.
83
- */
84
- readonly domRoots: Map<string, HTMLElement>;
85
- /**
86
- * Used to prevent calling {@link #forceRender} and {@link #change} during rendering view to the DOM.
87
- *
88
- * @observable
89
- * @readonly
90
- */
91
- isRenderingInProgress: boolean;
92
- /**
93
- * Informs whether the DOM selection is inside any of the DOM roots managed by the view.
94
- *
95
- * @observable
96
- * @readonly
97
- */
98
- hasDomSelection: boolean;
99
- /**
100
- * Instance of the {@link module:engine/view/renderer~Renderer renderer}.
101
- */
102
- private readonly _renderer;
103
- /**
104
- * A DOM root attributes cache. It saves the initial values of DOM root attributes before the DOM element
105
- * is {@link module:engine/view/view~View#attachDomRoot attached} to the view so later on, when
106
- * the view is destroyed ({@link module:engine/view/view~View#detachDomRoot}), they can be easily restored.
107
- * This way, the DOM element can go back to the (clean) state as if the editing view never used it.
108
- */
109
- private readonly _initialDomRootAttributes;
110
- /**
111
- * Map of registered {@link module:engine/view/observer/observer~Observer observers}.
112
- */
113
- private readonly _observers;
114
- /**
115
- * DowncastWriter instance used in {@link #change change method} callbacks.
116
- */
117
- private readonly _writer;
118
- /**
119
- * Is set to `true` when {@link #change view changes} are currently in progress.
120
- */
121
- private _ongoingChange;
122
- /**
123
- * Used to prevent calling {@link #forceRender} and {@link #change} during rendering view to the DOM.
124
- */
125
- private _postFixersInProgress;
126
- /**
127
- * Internal flag to temporary disable rendering. See the usage in the {@link #_disableRendering}.
128
- */
129
- private _renderingDisabled;
130
- /**
131
- * Internal flag that disables rendering when there are no changes since the last rendering.
132
- * It stores information about changed selection and changed elements from attached document roots.
133
- */
134
- private _hasChangedSinceTheLastRendering;
135
- /**
136
- * @param stylesProcessor The styles processor instance.
137
- */
138
- constructor(stylesProcessor: StylesProcessor);
139
- /**
140
- * Attaches a DOM root element to the view element and enable all observers on that element.
141
- * Also {@link module:engine/view/renderer~Renderer#markToSync mark element} to be synchronized
142
- * with the view what means that all child nodes will be removed and replaced with content of the view root.
143
- *
144
- * This method also will change view element name as the same as tag name of given dom root.
145
- * Name is always transformed to lower case.
146
- *
147
- * **Note:** Use {@link #detachDomRoot `detachDomRoot()`} to revert this action.
148
- *
149
- * @param domRoot DOM root element.
150
- * @param name Name of the root.
151
- */
152
- attachDomRoot(domRoot: HTMLElement, name?: string): void;
153
- /**
154
- * Detaches a DOM root element from the view element and restores its attributes to the state before
155
- * {@link #attachDomRoot `attachDomRoot()`}.
156
- *
157
- * @param name Name of the root to detach.
158
- */
159
- detachDomRoot(name: string): void;
160
- /**
161
- * Gets DOM root element.
162
- *
163
- * @param name Name of the root.
164
- * @returns DOM root element instance.
165
- */
166
- getDomRoot(name?: string): HTMLElement | undefined;
167
- /**
168
- * Creates observer of the given type if not yet created, {@link module:engine/view/observer/observer~Observer#enable enables} it
169
- * and {@link module:engine/view/observer/observer~Observer#observe attaches} to all existing and future
170
- * {@link #domRoots DOM roots}.
171
- *
172
- * Note: Observers are recognized by their constructor (classes). A single observer will be instantiated and used only
173
- * when registered for the first time. This means that features and other components can register a single observer
174
- * multiple times without caring whether it has been already added or not.
175
- *
176
- * @param ObserverConstructor The constructor of an observer to add.
177
- * Should create an instance inheriting from {@link module:engine/view/observer/observer~Observer}.
178
- * @returns Added observer instance.
179
- */
180
- addObserver(ObserverConstructor: ObserverConstructor): Observer;
181
- getObserver<T extends ObserverConstructor>(ObserverConstructor: T): T extends AlwaysRegisteredObservers ? InstanceType<T> : InstanceType<T> | undefined;
182
- /**
183
- * Disables all added observers.
184
- */
185
- disableObservers(): void;
186
- /**
187
- * Enables all added observers.
188
- */
189
- enableObservers(): void;
190
- /**
191
- * Scrolls the page viewport and {@link #domRoots} with their ancestors to reveal the
192
- * caret, **if not already visible to the user**.
193
- *
194
- * **Note**: Calling this method fires the {@link module:engine/view/view~ViewScrollToTheSelectionEvent} event that
195
- * allows custom behaviors.
196
- *
197
- * @param options Additional configuration of the scrolling behavior.
198
- * @param options.viewportOffset A distance between the DOM selection and the viewport boundary to be maintained
199
- * while scrolling to the selection (default is 20px). Setting this value to `0` will reveal the selection precisely at
200
- * the viewport boundary.
201
- * @param options.ancestorOffset A distance between the DOM selection and scrollable DOM root ancestor(s) to be maintained
202
- * while scrolling to the selection (default is 20px). Setting this value to `0` will reveal the selection precisely at
203
- * the scrollable ancestor(s) boundary.
204
- * @param options.alignToTop When set `true`, the DOM selection will be aligned to the top of the viewport if not already visible
205
- * (see `forceScroll` to learn more).
206
- * @param options.forceScroll When set `true`, the DOM selection will be aligned to the top of the viewport and scrollable ancestors
207
- * whether it is already visible or not. This option will only work when `alignToTop` is `true`.
208
- */
209
- scrollToTheSelection<T extends boolean, U extends IfTrue<T>>({ alignToTop, forceScroll, viewportOffset, ancestorOffset }?: {
210
- readonly viewportOffset?: number | {
211
- top: number;
212
- bottom: number;
213
- left: number;
214
- right: number;
215
- };
216
- readonly ancestorOffset?: number;
217
- readonly alignToTop?: T;
218
- readonly forceScroll?: U;
219
- }): void;
220
- /**
221
- * It will focus DOM element representing {@link module:engine/view/editableelement~EditableElement EditableElement}
222
- * that is currently having selection inside.
223
- */
224
- focus(): void;
225
- /**
226
- * The `change()` method is the primary way of changing the view. You should use it to modify any node in the view tree.
227
- * It makes sure that after all changes are made the view is rendered to the DOM (assuming that the view will be changed
228
- * inside the callback). It prevents situations when the DOM is updated when the view state is not yet correct. It allows
229
- * to nest calls one inside another and still performs a single rendering after all those changes are made.
230
- * It also returns the return value of its callback.
231
- *
232
- * ```ts
233
- * const text = view.change( writer => {
234
- * const newText = writer.createText( 'foo' );
235
- * writer.insert( position1, newText );
236
- *
237
- * view.change( writer => {
238
- * writer.insert( position2, writer.createText( 'bar' ) );
239
- * } );
240
- *
241
- * writer.remove( range );
242
- *
243
- * return newText;
244
- * } );
245
- * ```
246
- *
247
- * When the outermost change block is done and rendering to the DOM is over the
248
- * {@link module:engine/view/view~View#event:render `View#render`} event is fired.
249
- *
250
- * This method throws a `applying-view-changes-on-rendering` error when
251
- * the change block is used after rendering to the DOM has started.
252
- *
253
- * @param callback Callback function which may modify the view.
254
- * @returns Value returned by the callback.
255
- */
256
- change<TReturn>(callback: (writer: DowncastWriter) => TReturn): TReturn;
257
- /**
258
- * Forces rendering {@link module:engine/view/document~Document view document} to DOM. If any view changes are
259
- * currently in progress, rendering will start after all {@link #change change blocks} are processed.
260
- *
261
- * Note that this method is dedicated for special cases. All view changes should be wrapped in the {@link #change}
262
- * block and the view will automatically check whether it needs to render DOM or not.
263
- *
264
- * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `applying-view-changes-on-rendering` when
265
- * trying to re-render when rendering to DOM has already started.
266
- */
267
- forceRender(): void;
268
- /**
269
- * Destroys this instance. Makes sure that all observers are destroyed and listeners removed.
270
- */
271
- destroy(): void;
272
- /**
273
- * Creates position at the given location. The location can be specified as:
274
- *
275
- * * a {@link module:engine/view/position~Position position},
276
- * * parent element and offset (offset defaults to `0`),
277
- * * parent element and `'end'` (sets position at the end of that element),
278
- * * {@link module:engine/view/item~Item view item} and `'before'` or `'after'` (sets position before or after given view item).
279
- *
280
- * This method is a shortcut to other constructors such as:
281
- *
282
- * * {@link #createPositionBefore},
283
- * * {@link #createPositionAfter},
284
- *
285
- * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~Item view item}.
286
- */
287
- createPositionAt(itemOrPosition: Item | Position, offset?: PositionOffset): Position;
288
- /**
289
- * Creates a new position after given view item.
290
- *
291
- * @param item View item after which the position should be located.
292
- */
293
- createPositionAfter(item: Item): Position;
294
- /**
295
- * Creates a new position before given view item.
296
- *
297
- * @param item View item before which the position should be located.
298
- */
299
- createPositionBefore(item: Item): Position;
300
- /**
301
- * Creates a range spanning from `start` position to `end` position.
302
- *
303
- * **Note:** This factory method creates it's own {@link module:engine/view/position~Position} instances basing on passed values.
304
- *
305
- * @param start Start position.
306
- * @param end End position. If not set, range will be collapsed at `start` position.
307
- */
308
- createRange(start: Position, end?: Position | null): Range;
309
- /**
310
- * Creates a range that starts before given {@link module:engine/view/item~Item view item} and ends after it.
311
- */
312
- createRangeOn(item: Item): Range;
313
- /**
314
- * Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of
315
- * that element and ends after the last child of that element.
316
- *
317
- * @param element Element which is a parent for the range.
318
- */
319
- createRangeIn(element: Element): Range;
320
- /**
321
- * Creates new {@link module:engine/view/selection~Selection} instance.
322
- *
323
- * ```ts
324
- * // Creates collapsed selection at the position of given item and offset.
325
- * const paragraph = view.createContainerElement( 'paragraph' );
326
- * const selection = view.createSelection( paragraph, offset );
327
- *
328
- * // Creates a range inside an {@link module:engine/view/element~Element element} which starts before the
329
- * // first child of that element and ends after the last child of that element.
330
- * const selection = view.createSelection( paragraph, 'in' );
331
- *
332
- * // Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends
333
- * // just after the item.
334
- * const selection = view.createSelection( paragraph, 'on' );
335
- * ```
336
- *
337
- * `Selection`'s factory method allow passing additional options (`backward`, `fake` and `label`) as the last argument.
338
- *
339
- * ```ts
340
- * // Creates backward selection.
341
- * const selection = view.createSelection( paragraph, 'in', { backward: true } );
342
- * ```
343
- *
344
- * Fake selection does not render as browser native selection over selected elements and is hidden to the user.
345
- * This way, no native selection UI artifacts are displayed to the user and selection over elements can be
346
- * represented in other way, for example by applying proper CSS class.
347
- *
348
- * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
349
- * (and be properly handled by screen readers).
350
- *
351
- * ```ts
352
- * // Creates fake selection with label.
353
- * const selection = view.createSelection( element, 'in', { fake: true, label: 'foo' } );
354
- * ```
355
- *
356
- * See also: {@link #createSelection:SELECTABLE `createSelection( selectable, options )`}.
357
- *
358
- * @label NODE_OFFSET
359
- */
360
- createSelection(selectable: Node, placeOrOffset: PlaceOrOffset, options?: SelectionOptions): Selection;
361
- /**
362
- * Creates new {@link module:engine/view/selection~Selection} instance.
363
- *
364
- * ```ts
365
- * // Creates empty selection without ranges.
366
- * const selection = view.createSelection();
367
- *
368
- * // Creates selection at the given range.
369
- * const range = view.createRange( start, end );
370
- * const selection = view.createSelection( range );
371
- *
372
- * // Creates selection at the given ranges
373
- * const ranges = [ view.createRange( start1, end2 ), view.createRange( star2, end2 ) ];
374
- * const selection = view.createSelection( ranges );
375
- *
376
- * // Creates selection from the other selection.
377
- * const otherSelection = view.createSelection();
378
- * const selection = view.createSelection( otherSelection );
379
- *
380
- * // Creates selection from the document selection.
381
- * const selection = view.createSelection( editor.editing.view.document.selection );
382
- *
383
- * // Creates selection at the given position.
384
- * const position = view.createPositionFromPath( root, path );
385
- * const selection = view.createSelection( position );
386
- * ```
387
- *
388
- * `Selection`'s factory method allow passing additional options (`backward`, `fake` and `label`) as the last argument.
389
- *
390
- * ```ts
391
- * // Creates backward selection.
392
- * const selection = view.createSelection( range, { backward: true } );
393
- * ```
394
- *
395
- * Fake selection does not render as browser native selection over selected elements and is hidden to the user.
396
- * This way, no native selection UI artifacts are displayed to the user and selection over elements can be
397
- * represented in other way, for example by applying proper CSS class.
398
- *
399
- * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
400
- * (and be properly handled by screen readers).
401
- *
402
- * ```ts
403
- * // Creates fake selection with label.
404
- * const selection = view.createSelection( range, { fake: true, label: 'foo' } );
405
- * ```
406
- *
407
- * See also: {@link #createSelection:NODE_OFFSET `createSelection( node, placeOrOffset, options )`}.
408
- *
409
- * @label SELECTABLE
410
- */
411
- createSelection(selectable?: Exclude<Selectable, Node>, options?: SelectionOptions): Selection;
412
- /**
413
- * Disables or enables rendering. If the flag is set to `true` then the rendering will be disabled.
414
- * If the flag is set to `false` and if there was some change in the meantime, then the rendering action will be performed.
415
- *
416
- * @internal
417
- * @param flag A flag indicates whether the rendering should be disabled.
418
- */
419
- _disableRendering(flag: boolean): void;
420
- /**
421
- * Renders all changes. In order to avoid triggering the observers (e.g. selection) all observers are disabled
422
- * before rendering and re-enabled after that.
423
- */
424
- private _render;
425
- }
426
- /**
427
- * Fired after a topmost {@link module:engine/view/view~View#change change block} and all
428
- * {@link module:engine/view/document~Document#registerPostFixer post-fixers} are executed.
429
- *
430
- * Actual rendering is performed as a first listener on 'normal' priority.
431
- *
432
- * ```ts
433
- * view.on( 'render', () => {
434
- * // Rendering to the DOM is complete.
435
- * } );
436
- * ```
437
- *
438
- * This event is useful when you want to update interface elements after the rendering, e.g. position of the
439
- * balloon panel. If you wants to change view structure use
440
- * {@link module:engine/view/document~Document#registerPostFixer post-fixers}.
441
- *
442
- * @eventName ~View#render
443
- */
444
- export type ViewRenderEvent = {
445
- name: 'render';
446
- args: [];
447
- };
448
- /**
449
- * An event fired at the moment of {@link module:engine/view/view~View#scrollToTheSelection} being called. It
450
- * carries two objects in its payload (`args`):
451
- *
452
- * * The first argument is the {@link module:engine/view/view~ViewScrollToTheSelectionEventData object containing data} that gets
453
- * passed down to the {@link module:utils/dom/scroll~scrollViewportToShowTarget} helper. If some event listener modifies it, it can
454
- * adjust the behavior of the scrolling (e.g. include additional `viewportOffset`).
455
- * * The second argument corresponds to the original arguments passed to {@link module:utils/dom/scroll~scrollViewportToShowTarget}.
456
- * It allows listeners to re-execute the `scrollViewportToShowTarget()` method with its original arguments if there is such a need,
457
- * for instance, if the integration requires re–scrolling after certain interaction.
458
- *
459
- * @eventName ~View#scrollToTheSelection
460
- */
461
- export type ViewScrollToTheSelectionEvent = {
462
- name: 'scrollToTheSelection';
463
- args: [
464
- ViewScrollToTheSelectionEventData,
465
- Parameters<View['scrollToTheSelection']>[0]
466
- ];
467
- };
468
- /**
469
- * An object passed down to the {@link module:utils/dom/scroll~scrollViewportToShowTarget} helper while calling
470
- * {@link module:engine/view/view~View#scrollToTheSelection}.
471
- */
472
- export type ViewScrollToTheSelectionEventData = {
473
- target: DomRange;
474
- viewportOffset: {
475
- top: number;
476
- bottom: number;
477
- left: number;
478
- right: number;
479
- };
480
- ancestorOffset: number;
481
- alignToTop?: boolean;
482
- forceScroll?: boolean;
483
- };
484
- /**
485
- * Observers that are always registered.
486
- */
487
- export type AlwaysRegisteredObservers = typeof MutationObserver | typeof FocusObserver | typeof SelectionObserver | typeof KeyObserver | typeof FakeSelectionObserver | typeof CompositionObserver | typeof ArrowKeysObserver | typeof InputObserver | typeof TabObserver;
488
- export {};