@ckeditor/ckeditor5-engine 0.0.0-internal-20241017.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/CHANGELOG.md +4 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +36 -0
  4. package/dist/controller/datacontroller.d.ts +339 -0
  5. package/dist/controller/editingcontroller.d.ts +102 -0
  6. package/dist/conversion/conversion.d.ts +482 -0
  7. package/dist/conversion/conversionhelpers.d.ts +30 -0
  8. package/dist/conversion/downcastdispatcher.d.ts +566 -0
  9. package/dist/conversion/downcasthelpers.d.ts +1194 -0
  10. package/dist/conversion/mapper.d.ts +507 -0
  11. package/dist/conversion/modelconsumable.d.ts +205 -0
  12. package/dist/conversion/upcastdispatcher.d.ts +496 -0
  13. package/dist/conversion/upcasthelpers.d.ts +503 -0
  14. package/dist/conversion/viewconsumable.d.ts +373 -0
  15. package/dist/dataprocessor/basichtmlwriter.d.ts +22 -0
  16. package/dist/dataprocessor/dataprocessor.d.ts +65 -0
  17. package/dist/dataprocessor/htmldataprocessor.d.ts +80 -0
  18. package/dist/dataprocessor/htmlwriter.d.ts +20 -0
  19. package/dist/dataprocessor/xmldataprocessor.d.ts +94 -0
  20. package/dist/dev-utils/model.d.ts +130 -0
  21. package/dist/dev-utils/operationreplayer.d.ts +55 -0
  22. package/dist/dev-utils/utils.d.ts +41 -0
  23. package/dist/dev-utils/view.d.ts +324 -0
  24. package/dist/index-content.css +4 -0
  25. package/dist/index-editor.css +24 -0
  26. package/dist/index.css +49 -0
  27. package/dist/index.css.map +1 -0
  28. package/dist/index.d.ts +122 -0
  29. package/dist/index.js +37775 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/model/batch.d.ts +110 -0
  32. package/dist/model/differ.d.ts +511 -0
  33. package/dist/model/document.d.ts +278 -0
  34. package/dist/model/documentfragment.d.ts +204 -0
  35. package/dist/model/documentselection.d.ts +424 -0
  36. package/dist/model/element.d.ts +169 -0
  37. package/dist/model/history.d.ts +118 -0
  38. package/dist/model/item.d.ts +18 -0
  39. package/dist/model/liveposition.d.ts +81 -0
  40. package/dist/model/liverange.d.ts +106 -0
  41. package/dist/model/markercollection.d.ts +339 -0
  42. package/dist/model/model.d.ts +923 -0
  43. package/dist/model/node.d.ts +259 -0
  44. package/dist/model/nodelist.d.ts +95 -0
  45. package/dist/model/operation/attributeoperation.d.ts +107 -0
  46. package/dist/model/operation/detachoperation.d.ts +64 -0
  47. package/dist/model/operation/insertoperation.d.ts +94 -0
  48. package/dist/model/operation/markeroperation.d.ts +95 -0
  49. package/dist/model/operation/mergeoperation.d.ts +104 -0
  50. package/dist/model/operation/moveoperation.d.ts +100 -0
  51. package/dist/model/operation/nooperation.d.ts +42 -0
  52. package/dist/model/operation/operation.d.ts +100 -0
  53. package/dist/model/operation/operationfactory.d.ts +22 -0
  54. package/dist/model/operation/renameoperation.d.ts +87 -0
  55. package/dist/model/operation/rootattributeoperation.d.ts +102 -0
  56. package/dist/model/operation/rootoperation.d.ts +80 -0
  57. package/dist/model/operation/splitoperation.d.ts +113 -0
  58. package/dist/model/operation/transform.d.ts +104 -0
  59. package/dist/model/operation/utils.d.ts +75 -0
  60. package/dist/model/position.d.ts +542 -0
  61. package/dist/model/range.d.ts +462 -0
  62. package/dist/model/rootelement.d.ts +64 -0
  63. package/dist/model/schema.d.ts +1334 -0
  64. package/dist/model/selection.d.ts +486 -0
  65. package/dist/model/text.d.ts +70 -0
  66. package/dist/model/textproxy.d.ts +148 -0
  67. package/dist/model/treewalker.d.ts +190 -0
  68. package/dist/model/typecheckable.d.ts +289 -0
  69. package/dist/model/utils/autoparagraphing.d.ts +41 -0
  70. package/dist/model/utils/deletecontent.d.ts +62 -0
  71. package/dist/model/utils/getselectedcontent.d.ts +34 -0
  72. package/dist/model/utils/insertcontent.d.ts +50 -0
  73. package/dist/model/utils/insertobject.d.ts +51 -0
  74. package/dist/model/utils/modifyselection.d.ts +52 -0
  75. package/dist/model/utils/selection-post-fixer.d.ts +78 -0
  76. package/dist/model/writer.d.ts +855 -0
  77. package/dist/view/attributeelement.d.ts +112 -0
  78. package/dist/view/containerelement.d.ts +53 -0
  79. package/dist/view/datatransfer.d.ts +83 -0
  80. package/dist/view/document.d.ts +188 -0
  81. package/dist/view/documentfragment.d.ts +157 -0
  82. package/dist/view/documentselection.d.ts +310 -0
  83. package/dist/view/domconverter.d.ts +665 -0
  84. package/dist/view/downcastwriter.d.ts +1000 -0
  85. package/dist/view/editableelement.d.ts +66 -0
  86. package/dist/view/element.d.ts +472 -0
  87. package/dist/view/elementdefinition.d.ts +91 -0
  88. package/dist/view/emptyelement.d.ts +45 -0
  89. package/dist/view/filler.d.ts +115 -0
  90. package/dist/view/item.d.ts +18 -0
  91. package/dist/view/matcher.d.ts +490 -0
  92. package/dist/view/node.d.ts +166 -0
  93. package/dist/view/observer/arrowkeysobserver.d.ts +49 -0
  94. package/dist/view/observer/bubblingemittermixin.d.ts +170 -0
  95. package/dist/view/observer/bubblingeventinfo.d.ts +51 -0
  96. package/dist/view/observer/clickobserver.d.ts +47 -0
  97. package/dist/view/observer/compositionobserver.d.ts +86 -0
  98. package/dist/view/observer/domeventdata.d.ts +54 -0
  99. package/dist/view/observer/domeventobserver.d.ts +82 -0
  100. package/dist/view/observer/fakeselectionobserver.d.ts +51 -0
  101. package/dist/view/observer/focusobserver.d.ts +98 -0
  102. package/dist/view/observer/inputobserver.d.ts +90 -0
  103. package/dist/view/observer/keyobserver.d.ts +70 -0
  104. package/dist/view/observer/mouseobserver.d.ts +93 -0
  105. package/dist/view/observer/mutationobserver.d.ts +119 -0
  106. package/dist/view/observer/observer.d.ts +93 -0
  107. package/dist/view/observer/selectionobserver.d.ts +151 -0
  108. package/dist/view/observer/tabobserver.d.ts +50 -0
  109. package/dist/view/placeholder.d.ts +100 -0
  110. package/dist/view/position.d.ts +192 -0
  111. package/dist/view/range.d.ts +283 -0
  112. package/dist/view/rawelement.d.ts +77 -0
  113. package/dist/view/renderer.d.ts +281 -0
  114. package/dist/view/rooteditableelement.d.ts +45 -0
  115. package/dist/view/selection.d.ts +379 -0
  116. package/dist/view/styles/background.d.ts +37 -0
  117. package/dist/view/styles/border.d.ts +47 -0
  118. package/dist/view/styles/margin.d.ts +33 -0
  119. package/dist/view/styles/padding.d.ts +33 -0
  120. package/dist/view/styles/utils.d.ts +97 -0
  121. package/dist/view/stylesmap.d.ts +677 -0
  122. package/dist/view/text.d.ts +78 -0
  123. package/dist/view/textproxy.d.ts +101 -0
  124. package/dist/view/treewalker.d.ts +199 -0
  125. package/dist/view/typecheckable.d.ts +452 -0
  126. package/dist/view/uielement.d.ts +100 -0
  127. package/dist/view/upcastwriter.d.ts +421 -0
  128. package/dist/view/view.d.ts +488 -0
  129. package/package.json +49 -0
  130. package/src/controller/datacontroller.d.ts +335 -0
  131. package/src/controller/datacontroller.js +481 -0
  132. package/src/controller/editingcontroller.d.ts +98 -0
  133. package/src/controller/editingcontroller.js +191 -0
  134. package/src/conversion/conversion.d.ts +478 -0
  135. package/src/conversion/conversion.js +601 -0
  136. package/src/conversion/conversionhelpers.d.ts +26 -0
  137. package/src/conversion/conversionhelpers.js +32 -0
  138. package/src/conversion/downcastdispatcher.d.ts +562 -0
  139. package/src/conversion/downcastdispatcher.js +548 -0
  140. package/src/conversion/downcasthelpers.d.ts +1190 -0
  141. package/src/conversion/downcasthelpers.js +2161 -0
  142. package/src/conversion/mapper.d.ts +503 -0
  143. package/src/conversion/mapper.js +536 -0
  144. package/src/conversion/modelconsumable.d.ts +201 -0
  145. package/src/conversion/modelconsumable.js +333 -0
  146. package/src/conversion/upcastdispatcher.d.ts +492 -0
  147. package/src/conversion/upcastdispatcher.js +460 -0
  148. package/src/conversion/upcasthelpers.d.ts +499 -0
  149. package/src/conversion/upcasthelpers.js +943 -0
  150. package/src/conversion/viewconsumable.d.ts +369 -0
  151. package/src/conversion/viewconsumable.js +535 -0
  152. package/src/dataprocessor/basichtmlwriter.d.ts +18 -0
  153. package/src/dataprocessor/basichtmlwriter.js +20 -0
  154. package/src/dataprocessor/dataprocessor.d.ts +61 -0
  155. package/src/dataprocessor/dataprocessor.js +5 -0
  156. package/src/dataprocessor/htmldataprocessor.d.ts +76 -0
  157. package/src/dataprocessor/htmldataprocessor.js +96 -0
  158. package/src/dataprocessor/htmlwriter.d.ts +16 -0
  159. package/src/dataprocessor/htmlwriter.js +5 -0
  160. package/src/dataprocessor/xmldataprocessor.d.ts +90 -0
  161. package/src/dataprocessor/xmldataprocessor.js +108 -0
  162. package/src/dev-utils/model.d.ts +126 -0
  163. package/src/dev-utils/model.js +397 -0
  164. package/src/dev-utils/operationreplayer.d.ts +51 -0
  165. package/src/dev-utils/operationreplayer.js +112 -0
  166. package/src/dev-utils/utils.d.ts +37 -0
  167. package/src/dev-utils/utils.js +80 -0
  168. package/src/dev-utils/view.d.ts +320 -0
  169. package/src/dev-utils/view.js +970 -0
  170. package/src/index.d.ts +118 -0
  171. package/src/index.js +83 -0
  172. package/src/model/batch.d.ts +106 -0
  173. package/src/model/batch.js +96 -0
  174. package/src/model/differ.d.ts +507 -0
  175. package/src/model/differ.js +1285 -0
  176. package/src/model/document.d.ts +274 -0
  177. package/src/model/document.js +360 -0
  178. package/src/model/documentfragment.d.ts +200 -0
  179. package/src/model/documentfragment.js +306 -0
  180. package/src/model/documentselection.d.ts +420 -0
  181. package/src/model/documentselection.js +993 -0
  182. package/src/model/element.d.ts +165 -0
  183. package/src/model/element.js +281 -0
  184. package/src/model/history.d.ts +114 -0
  185. package/src/model/history.js +207 -0
  186. package/src/model/item.d.ts +14 -0
  187. package/src/model/item.js +5 -0
  188. package/src/model/liveposition.d.ts +77 -0
  189. package/src/model/liveposition.js +93 -0
  190. package/src/model/liverange.d.ts +102 -0
  191. package/src/model/liverange.js +120 -0
  192. package/src/model/markercollection.d.ts +335 -0
  193. package/src/model/markercollection.js +403 -0
  194. package/src/model/model.d.ts +919 -0
  195. package/src/model/model.js +838 -0
  196. package/src/model/node.d.ts +255 -0
  197. package/src/model/node.js +373 -0
  198. package/src/model/nodelist.d.ts +91 -0
  199. package/src/model/nodelist.js +170 -0
  200. package/src/model/operation/attributeoperation.d.ts +103 -0
  201. package/src/model/operation/attributeoperation.js +148 -0
  202. package/src/model/operation/detachoperation.d.ts +60 -0
  203. package/src/model/operation/detachoperation.js +77 -0
  204. package/src/model/operation/insertoperation.d.ts +90 -0
  205. package/src/model/operation/insertoperation.js +135 -0
  206. package/src/model/operation/markeroperation.d.ts +91 -0
  207. package/src/model/operation/markeroperation.js +107 -0
  208. package/src/model/operation/mergeoperation.d.ts +100 -0
  209. package/src/model/operation/mergeoperation.js +167 -0
  210. package/src/model/operation/moveoperation.d.ts +96 -0
  211. package/src/model/operation/moveoperation.js +164 -0
  212. package/src/model/operation/nooperation.d.ts +38 -0
  213. package/src/model/operation/nooperation.js +48 -0
  214. package/src/model/operation/operation.d.ts +96 -0
  215. package/src/model/operation/operation.js +59 -0
  216. package/src/model/operation/operationfactory.d.ts +18 -0
  217. package/src/model/operation/operationfactory.js +44 -0
  218. package/src/model/operation/renameoperation.d.ts +83 -0
  219. package/src/model/operation/renameoperation.js +115 -0
  220. package/src/model/operation/rootattributeoperation.d.ts +98 -0
  221. package/src/model/operation/rootattributeoperation.js +155 -0
  222. package/src/model/operation/rootoperation.d.ts +76 -0
  223. package/src/model/operation/rootoperation.js +90 -0
  224. package/src/model/operation/splitoperation.d.ts +109 -0
  225. package/src/model/operation/splitoperation.js +194 -0
  226. package/src/model/operation/transform.d.ts +100 -0
  227. package/src/model/operation/transform.js +2119 -0
  228. package/src/model/operation/utils.d.ts +71 -0
  229. package/src/model/operation/utils.js +217 -0
  230. package/src/model/position.d.ts +538 -0
  231. package/src/model/position.js +977 -0
  232. package/src/model/range.d.ts +458 -0
  233. package/src/model/range.js +872 -0
  234. package/src/model/rootelement.d.ts +60 -0
  235. package/src/model/rootelement.js +74 -0
  236. package/src/model/schema.d.ts +1330 -0
  237. package/src/model/schema.js +1524 -0
  238. package/src/model/selection.d.ts +482 -0
  239. package/src/model/selection.js +789 -0
  240. package/src/model/text.d.ts +66 -0
  241. package/src/model/text.js +85 -0
  242. package/src/model/textproxy.d.ts +144 -0
  243. package/src/model/textproxy.js +189 -0
  244. package/src/model/treewalker.d.ts +186 -0
  245. package/src/model/treewalker.js +244 -0
  246. package/src/model/typecheckable.d.ts +285 -0
  247. package/src/model/typecheckable.js +16 -0
  248. package/src/model/utils/autoparagraphing.d.ts +37 -0
  249. package/src/model/utils/autoparagraphing.js +63 -0
  250. package/src/model/utils/deletecontent.d.ts +58 -0
  251. package/src/model/utils/deletecontent.js +488 -0
  252. package/src/model/utils/getselectedcontent.d.ts +30 -0
  253. package/src/model/utils/getselectedcontent.js +125 -0
  254. package/src/model/utils/insertcontent.d.ts +46 -0
  255. package/src/model/utils/insertcontent.js +661 -0
  256. package/src/model/utils/insertobject.d.ts +47 -0
  257. package/src/model/utils/insertobject.js +135 -0
  258. package/src/model/utils/modifyselection.d.ts +48 -0
  259. package/src/model/utils/modifyselection.js +186 -0
  260. package/src/model/utils/selection-post-fixer.d.ts +74 -0
  261. package/src/model/utils/selection-post-fixer.js +260 -0
  262. package/src/model/writer.d.ts +851 -0
  263. package/src/model/writer.js +1306 -0
  264. package/src/view/attributeelement.d.ts +108 -0
  265. package/src/view/attributeelement.js +185 -0
  266. package/src/view/containerelement.d.ts +49 -0
  267. package/src/view/containerelement.js +80 -0
  268. package/src/view/datatransfer.d.ts +79 -0
  269. package/src/view/datatransfer.js +98 -0
  270. package/src/view/document.d.ts +184 -0
  271. package/src/view/document.js +122 -0
  272. package/src/view/documentfragment.d.ts +153 -0
  273. package/src/view/documentfragment.js +234 -0
  274. package/src/view/documentselection.d.ts +306 -0
  275. package/src/view/documentselection.js +256 -0
  276. package/src/view/domconverter.d.ts +661 -0
  277. package/src/view/domconverter.js +1523 -0
  278. package/src/view/downcastwriter.d.ts +996 -0
  279. package/src/view/downcastwriter.js +1696 -0
  280. package/src/view/editableelement.d.ts +62 -0
  281. package/src/view/editableelement.js +62 -0
  282. package/src/view/element.d.ts +468 -0
  283. package/src/view/element.js +724 -0
  284. package/src/view/elementdefinition.d.ts +87 -0
  285. package/src/view/elementdefinition.js +5 -0
  286. package/src/view/emptyelement.d.ts +41 -0
  287. package/src/view/emptyelement.js +73 -0
  288. package/src/view/filler.d.ts +111 -0
  289. package/src/view/filler.js +150 -0
  290. package/src/view/item.d.ts +14 -0
  291. package/src/view/item.js +5 -0
  292. package/src/view/matcher.d.ts +486 -0
  293. package/src/view/matcher.js +507 -0
  294. package/src/view/node.d.ts +162 -0
  295. package/src/view/node.js +226 -0
  296. package/src/view/observer/arrowkeysobserver.d.ts +45 -0
  297. package/src/view/observer/arrowkeysobserver.js +40 -0
  298. package/src/view/observer/bubblingemittermixin.d.ts +166 -0
  299. package/src/view/observer/bubblingemittermixin.js +172 -0
  300. package/src/view/observer/bubblingeventinfo.d.ts +47 -0
  301. package/src/view/observer/bubblingeventinfo.js +37 -0
  302. package/src/view/observer/clickobserver.d.ts +43 -0
  303. package/src/view/observer/clickobserver.js +29 -0
  304. package/src/view/observer/compositionobserver.d.ts +82 -0
  305. package/src/view/observer/compositionobserver.js +62 -0
  306. package/src/view/observer/domeventdata.d.ts +50 -0
  307. package/src/view/observer/domeventdata.js +47 -0
  308. package/src/view/observer/domeventobserver.d.ts +78 -0
  309. package/src/view/observer/domeventobserver.js +84 -0
  310. package/src/view/observer/fakeselectionobserver.d.ts +47 -0
  311. package/src/view/observer/fakeselectionobserver.js +91 -0
  312. package/src/view/observer/focusobserver.d.ts +94 -0
  313. package/src/view/observer/focusobserver.js +116 -0
  314. package/src/view/observer/inputobserver.d.ts +86 -0
  315. package/src/view/observer/inputobserver.js +166 -0
  316. package/src/view/observer/keyobserver.d.ts +66 -0
  317. package/src/view/observer/keyobserver.js +39 -0
  318. package/src/view/observer/mouseobserver.d.ts +89 -0
  319. package/src/view/observer/mouseobserver.js +29 -0
  320. package/src/view/observer/mutationobserver.d.ts +115 -0
  321. package/src/view/observer/mutationobserver.js +203 -0
  322. package/src/view/observer/observer.d.ts +89 -0
  323. package/src/view/observer/observer.js +84 -0
  324. package/src/view/observer/selectionobserver.d.ts +147 -0
  325. package/src/view/observer/selectionobserver.js +220 -0
  326. package/src/view/observer/tabobserver.d.ts +46 -0
  327. package/src/view/observer/tabobserver.js +42 -0
  328. package/src/view/placeholder.d.ts +96 -0
  329. package/src/view/placeholder.js +267 -0
  330. package/src/view/position.d.ts +188 -0
  331. package/src/view/position.js +322 -0
  332. package/src/view/range.d.ts +279 -0
  333. package/src/view/range.js +430 -0
  334. package/src/view/rawelement.d.ts +73 -0
  335. package/src/view/rawelement.js +105 -0
  336. package/src/view/renderer.d.ts +277 -0
  337. package/src/view/renderer.js +1056 -0
  338. package/src/view/rooteditableelement.d.ts +41 -0
  339. package/src/view/rooteditableelement.js +69 -0
  340. package/src/view/selection.d.ts +375 -0
  341. package/src/view/selection.js +559 -0
  342. package/src/view/styles/background.d.ts +33 -0
  343. package/src/view/styles/background.js +74 -0
  344. package/src/view/styles/border.d.ts +43 -0
  345. package/src/view/styles/border.js +316 -0
  346. package/src/view/styles/margin.d.ts +29 -0
  347. package/src/view/styles/margin.js +34 -0
  348. package/src/view/styles/padding.d.ts +29 -0
  349. package/src/view/styles/padding.js +34 -0
  350. package/src/view/styles/utils.d.ts +93 -0
  351. package/src/view/styles/utils.js +219 -0
  352. package/src/view/stylesmap.d.ts +673 -0
  353. package/src/view/stylesmap.js +762 -0
  354. package/src/view/text.d.ts +74 -0
  355. package/src/view/text.js +93 -0
  356. package/src/view/textproxy.d.ts +97 -0
  357. package/src/view/textproxy.js +124 -0
  358. package/src/view/treewalker.d.ts +195 -0
  359. package/src/view/treewalker.js +327 -0
  360. package/src/view/typecheckable.d.ts +448 -0
  361. package/src/view/typecheckable.js +19 -0
  362. package/src/view/uielement.d.ts +96 -0
  363. package/src/view/uielement.js +183 -0
  364. package/src/view/upcastwriter.d.ts +417 -0
  365. package/src/view/upcastwriter.js +359 -0
  366. package/src/view/view.d.ts +484 -0
  367. package/src/view/view.js +560 -0
  368. package/theme/placeholder.css +36 -0
  369. package/theme/renderer.css +9 -0
@@ -0,0 +1,94 @@
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
+ * @module engine/view/observer/focusobserver
7
+ */
8
+ import DomEventObserver from './domeventobserver.js';
9
+ import type DomEventData from './domeventdata.js';
10
+ import type View from '../view.js';
11
+ /**
12
+ * {@link module:engine/view/document~Document#event:focus Focus}
13
+ * and {@link module:engine/view/document~Document#event:blur blur} events observer.
14
+ * Focus observer handle also {@link module:engine/view/rooteditableelement~RootEditableElement#isFocused isFocused} property of the
15
+ * {@link module:engine/view/rooteditableelement~RootEditableElement root elements}.
16
+ *
17
+ * Note that this observer is attached by the {@link module:engine/view/view~View} and is available by default.
18
+ */
19
+ export default class FocusObserver extends DomEventObserver<'focus' | 'blur'> {
20
+ /**
21
+ * Identifier of the timeout currently used by focus listener to delay rendering execution.
22
+ */
23
+ private _renderTimeoutId;
24
+ /**
25
+ * Set to `true` if the document is in the process of setting the focus.
26
+ *
27
+ * The flag is used to indicate that setting the focus is in progress.
28
+ */
29
+ private _isFocusChanging;
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ readonly domEventType: readonly ["focus", "blur"];
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ constructor(view: View);
38
+ /**
39
+ * Finishes setting the document focus state.
40
+ */
41
+ flush(): void;
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ onDomEvent(domEvent: FocusEvent): void;
46
+ /**
47
+ * @inheritDoc
48
+ */
49
+ destroy(): void;
50
+ /**
51
+ * The `focus` event handler.
52
+ */
53
+ private _handleFocus;
54
+ /**
55
+ * The `blur` event handler.
56
+ */
57
+ private _handleBlur;
58
+ /**
59
+ * Clears timeout.
60
+ */
61
+ private _clearTimeout;
62
+ }
63
+ /**
64
+ * Fired when one of the editables gets focus.
65
+ *
66
+ * Introduced by {@link module:engine/view/observer/focusobserver~FocusObserver}.
67
+ *
68
+ * Note that because {@link module:engine/view/observer/focusobserver~FocusObserver} is attached by the
69
+ * {@link module:engine/view/view~View} this event is available by default.
70
+ *
71
+ * @see module:engine/view/observer/focusobserver~FocusObserver
72
+ * @eventName module:engine/view/document~Document#focus
73
+ * @param data Event data.
74
+ */
75
+ export type ViewDocumentFocusEvent = {
76
+ name: 'focus';
77
+ args: [data: DomEventData<FocusEvent>];
78
+ };
79
+ /**
80
+ * Fired when one of the editables loses focus.
81
+ *
82
+ * Introduced by {@link module:engine/view/observer/focusobserver~FocusObserver}.
83
+ *
84
+ * Note that because {@link module:engine/view/observer/focusobserver~FocusObserver} is attached by the
85
+ * {@link module:engine/view/view~View} this event is available by default.
86
+ *
87
+ * @see module:engine/view/observer/focusobserver~FocusObserver
88
+ * @eventName module:engine/view/document~Document#blur
89
+ * @param data Event data.
90
+ */
91
+ export type ViewDocumentBlurEvent = {
92
+ name: 'blur';
93
+ args: [data: DomEventData<FocusEvent>];
94
+ };
@@ -0,0 +1,116 @@
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
+ * @module engine/view/observer/focusobserver
7
+ */
8
+ /* globals setTimeout, clearTimeout */
9
+ import DomEventObserver from './domeventobserver.js';
10
+ /**
11
+ * {@link module:engine/view/document~Document#event:focus Focus}
12
+ * and {@link module:engine/view/document~Document#event:blur blur} events observer.
13
+ * Focus observer handle also {@link module:engine/view/rooteditableelement~RootEditableElement#isFocused isFocused} property of the
14
+ * {@link module:engine/view/rooteditableelement~RootEditableElement root elements}.
15
+ *
16
+ * Note that this observer is attached by the {@link module:engine/view/view~View} and is available by default.
17
+ */
18
+ export default class FocusObserver extends DomEventObserver {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ constructor(view) {
23
+ super(view);
24
+ /**
25
+ * Identifier of the timeout currently used by focus listener to delay rendering execution.
26
+ */
27
+ this._renderTimeoutId = null;
28
+ /**
29
+ * Set to `true` if the document is in the process of setting the focus.
30
+ *
31
+ * The flag is used to indicate that setting the focus is in progress.
32
+ */
33
+ this._isFocusChanging = false;
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ this.domEventType = ['focus', 'blur'];
38
+ this.useCapture = true;
39
+ const document = this.document;
40
+ document.on('focus', () => this._handleFocus());
41
+ document.on('blur', (evt, data) => this._handleBlur(data));
42
+ // Focus the editor in cases where browser dispatches `beforeinput` event to a not-focused editable element.
43
+ // This is flushed by the beforeinput listener in the `InsertTextObserver`.
44
+ // Note that focus is set only if the document is not focused yet.
45
+ // See https://github.com/ckeditor/ckeditor5/issues/14702.
46
+ document.on('beforeinput', () => {
47
+ if (!document.isFocused) {
48
+ this._handleFocus();
49
+ }
50
+ }, { priority: 'highest' });
51
+ }
52
+ /**
53
+ * Finishes setting the document focus state.
54
+ */
55
+ flush() {
56
+ if (this._isFocusChanging) {
57
+ this._isFocusChanging = false;
58
+ this.document.isFocused = true;
59
+ }
60
+ }
61
+ /**
62
+ * @inheritDoc
63
+ */
64
+ onDomEvent(domEvent) {
65
+ this.fire(domEvent.type, domEvent);
66
+ }
67
+ /**
68
+ * @inheritDoc
69
+ */
70
+ destroy() {
71
+ this._clearTimeout();
72
+ super.destroy();
73
+ }
74
+ /**
75
+ * The `focus` event handler.
76
+ */
77
+ _handleFocus() {
78
+ this._clearTimeout();
79
+ this._isFocusChanging = true;
80
+ // Unfortunately native `selectionchange` event is fired asynchronously.
81
+ // We need to wait until `SelectionObserver` handle the event and then render. Otherwise rendering will
82
+ // overwrite new DOM selection with selection from the view.
83
+ // See https://github.com/ckeditor/ckeditor5-engine/issues/795 for more details.
84
+ // Long timeout is needed to solve #676 and https://github.com/ckeditor/ckeditor5-engine/issues/1157 issues.
85
+ //
86
+ // Using `view.change()` instead of `view.forceRender()` to prevent double rendering
87
+ // in a situation where `selectionchange` already caused selection change.
88
+ this._renderTimeoutId = setTimeout(() => {
89
+ this._renderTimeoutId = null;
90
+ this.flush();
91
+ this.view.change(() => { });
92
+ }, 50);
93
+ }
94
+ /**
95
+ * The `blur` event handler.
96
+ */
97
+ _handleBlur(data) {
98
+ const selectedEditable = this.document.selection.editableElement;
99
+ if (selectedEditable === null || selectedEditable === data.target) {
100
+ this.document.isFocused = false;
101
+ this._isFocusChanging = false;
102
+ // Re-render the document to update view elements
103
+ // (changing document.isFocused already marked view as changed since last rendering).
104
+ this.view.change(() => { });
105
+ }
106
+ }
107
+ /**
108
+ * Clears timeout.
109
+ */
110
+ _clearTimeout() {
111
+ if (this._renderTimeoutId) {
112
+ clearTimeout(this._renderTimeoutId);
113
+ this._renderTimeoutId = null;
114
+ }
115
+ }
116
+ }
@@ -0,0 +1,86 @@
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
+ * @module engine/view/observer/inputobserver
7
+ */
8
+ import DomEventObserver from './domeventobserver.js';
9
+ import type DomEventData from './domeventdata.js';
10
+ import type ViewRange from '../range.js';
11
+ import DataTransfer from '../datatransfer.js';
12
+ /**
13
+ * Observer for events connected with data input.
14
+ *
15
+ * **Note**: This observer is attached by {@link module:engine/view/view~View} and available by default in all
16
+ * editor instances.
17
+ */
18
+ export default class InputObserver extends DomEventObserver<'beforeinput'> {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ readonly domEventType: "beforeinput";
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ onDomEvent(domEvent: InputEvent): void;
27
+ }
28
+ /**
29
+ * Fired before the web browser inputs, deletes, or formats some data.
30
+ *
31
+ * This event is introduced by {@link module:engine/view/observer/inputobserver~InputObserver} and available
32
+ * by default in all editor instances (attached by {@link module:engine/view/view~View}).
33
+ *
34
+ * @see module:engine/view/observer/inputobserver~InputObserver
35
+ * @eventName module:engine/view/document~Document#beforeinput
36
+ * @param data Event data containing detailed information about the event.
37
+ */
38
+ export type ViewDocumentInputEvent = {
39
+ name: 'beforeinput';
40
+ args: [data: InputEventData];
41
+ };
42
+ /**
43
+ * The value of the {@link ~ViewDocumentInputEvent} event.
44
+ */
45
+ export interface InputEventData extends DomEventData<InputEvent> {
46
+ /**
47
+ * The type of the input event (e.g. "insertText" or "deleteWordBackward"). Corresponds to native `InputEvent#inputType`.
48
+ */
49
+ readonly inputType: string;
50
+ /**
51
+ * A unified text data passed along with the input event. Depending on:
52
+ *
53
+ * * the web browser and input events implementation (for instance [Level 1](https://www.w3.org/TR/input-events-1/) or
54
+ * [Level 2](https://www.w3.org/TR/input-events-2/)),
55
+ * * {@link module:engine/view/observer/inputobserver~InputEventData#inputType input type}
56
+ *
57
+ * text data is sometimes passed in the `data` and sometimes in the `dataTransfer` property.
58
+ *
59
+ * * If `InputEvent#data` was set, this property reflects its value.
60
+ * * If `InputEvent#data` is unavailable, this property contains the `'text/plain'` data from
61
+ * {@link module:engine/view/observer/inputobserver~InputEventData#dataTransfer}.
62
+ * * If the event ({@link module:engine/view/observer/inputobserver~InputEventData#inputType input type})
63
+ * provides no data whatsoever, this property is `null`.
64
+ */
65
+ readonly data: string | null;
66
+ /**
67
+ * The data transfer instance of the input event. Corresponds to native `InputEvent#dataTransfer`.
68
+ *
69
+ * The value is `null` when no `dataTransfer` was passed along with the input event.
70
+ */
71
+ readonly dataTransfer: DataTransfer;
72
+ /**
73
+ * A flag indicating that the `beforeinput` event was fired during composition.
74
+ *
75
+ * Corresponds to the
76
+ * {@link module:engine/view/document~Document#event:compositionstart},
77
+ * {@link module:engine/view/document~Document#event:compositionupdate},
78
+ * and {@link module:engine/view/document~Document#event:compositionend } trio.
79
+ */
80
+ readonly isComposing: boolean;
81
+ /**
82
+ * Editing {@link module:engine/view/range~Range view ranges} corresponding to DOM ranges provided by the web browser
83
+ * (as returned by `InputEvent#getTargetRanges()`).
84
+ */
85
+ readonly targetRanges: Array<ViewRange>;
86
+ }
@@ -0,0 +1,166 @@
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
+ * @module engine/view/observer/inputobserver
7
+ */
8
+ import DomEventObserver from './domeventobserver.js';
9
+ import DataTransfer from '../datatransfer.js';
10
+ import { env } from '@ckeditor/ckeditor5-utils';
11
+ // @if CK_DEBUG_TYPING // const { _debouncedLine } = require( '../../dev-utils/utils.js' );
12
+ /**
13
+ * Observer for events connected with data input.
14
+ *
15
+ * **Note**: This observer is attached by {@link module:engine/view/view~View} and available by default in all
16
+ * editor instances.
17
+ */
18
+ export default class InputObserver extends DomEventObserver {
19
+ constructor() {
20
+ super(...arguments);
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ this.domEventType = 'beforeinput';
25
+ }
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ onDomEvent(domEvent) {
30
+ // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {
31
+ // @if CK_DEBUG_TYPING // _debouncedLine();
32
+ // @if CK_DEBUG_TYPING // console.group( `%c[InputObserver]%c ${ domEvent.type }: ${ domEvent.inputType }`,
33
+ // @if CK_DEBUG_TYPING // 'color: green', 'color: default'
34
+ // @if CK_DEBUG_TYPING // );
35
+ // @if CK_DEBUG_TYPING // }
36
+ const domTargetRanges = domEvent.getTargetRanges();
37
+ const view = this.view;
38
+ const viewDocument = view.document;
39
+ let dataTransfer = null;
40
+ let data = null;
41
+ let targetRanges = [];
42
+ if (domEvent.dataTransfer) {
43
+ dataTransfer = new DataTransfer(domEvent.dataTransfer);
44
+ }
45
+ if (domEvent.data !== null) {
46
+ data = domEvent.data;
47
+ // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {
48
+ // @if CK_DEBUG_TYPING // console.info( `%c[InputObserver]%c event data: %c${ JSON.stringify( data ) }`,
49
+ // @if CK_DEBUG_TYPING // 'color: green; font-weight: bold', 'font-weight: bold', 'color: blue;'
50
+ // @if CK_DEBUG_TYPING // );
51
+ // @if CK_DEBUG_TYPING // }
52
+ }
53
+ else if (dataTransfer) {
54
+ data = dataTransfer.getData('text/plain');
55
+ // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {
56
+ // @if CK_DEBUG_TYPING // console.info( `%c[InputObserver]%c event data transfer: %c${ JSON.stringify( data ) }`,
57
+ // @if CK_DEBUG_TYPING // 'color: green; font-weight: bold', 'font-weight: bold', 'color: blue;'
58
+ // @if CK_DEBUG_TYPING // );
59
+ // @if CK_DEBUG_TYPING // }
60
+ }
61
+ // If the editor selection is fake (an object is selected), the DOM range does not make sense because it is anchored
62
+ // in the fake selection container.
63
+ if (viewDocument.selection.isFake) {
64
+ // Future-proof: in case of multi-range fake selections being possible.
65
+ targetRanges = Array.from(viewDocument.selection.getRanges());
66
+ // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {
67
+ // @if CK_DEBUG_TYPING // console.info( '%c[InputObserver]%c using fake selection:',
68
+ // @if CK_DEBUG_TYPING // 'color: green; font-weight: bold', 'font-weight: bold', targetRanges,
69
+ // @if CK_DEBUG_TYPING // viewDocument.selection.isFake ? 'fake view selection' : 'fake DOM parent'
70
+ // @if CK_DEBUG_TYPING // );
71
+ // @if CK_DEBUG_TYPING // }
72
+ }
73
+ else if (domTargetRanges.length) {
74
+ targetRanges = domTargetRanges.map(domRange => {
75
+ // Sometimes browser provides range that starts before editable node.
76
+ // We try to fall back to collapsed range at the valid end position.
77
+ // See https://github.com/ckeditor/ckeditor5/issues/14411.
78
+ // See https://github.com/ckeditor/ckeditor5/issues/14050.
79
+ const viewStart = view.domConverter.domPositionToView(domRange.startContainer, domRange.startOffset);
80
+ const viewEnd = view.domConverter.domPositionToView(domRange.endContainer, domRange.endOffset);
81
+ if (viewStart) {
82
+ return view.createRange(viewStart, viewEnd);
83
+ }
84
+ else if (viewEnd) {
85
+ return view.createRange(viewEnd);
86
+ }
87
+ }).filter((range) => !!range);
88
+ // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {
89
+ // @if CK_DEBUG_TYPING // console.info( '%c[InputObserver]%c using target ranges:',
90
+ // @if CK_DEBUG_TYPING // 'color: green; font-weight: bold', 'font-weight: bold', targetRanges
91
+ // @if CK_DEBUG_TYPING // );
92
+ // @if CK_DEBUG_TYPING // }
93
+ }
94
+ // For Android devices we use a fallback to the current DOM selection, Android modifies it according
95
+ // to the expected target ranges of input event.
96
+ else if (env.isAndroid) {
97
+ const domSelection = domEvent.target.ownerDocument.defaultView.getSelection();
98
+ targetRanges = Array.from(view.domConverter.domSelectionToView(domSelection).getRanges());
99
+ // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {
100
+ // @if CK_DEBUG_TYPING // console.info( '%c[InputObserver]%c using selection ranges:',
101
+ // @if CK_DEBUG_TYPING // 'color: green; font-weight: bold', 'font-weight: bold', targetRanges
102
+ // @if CK_DEBUG_TYPING // );
103
+ // @if CK_DEBUG_TYPING // }
104
+ }
105
+ // Android sometimes fires insertCompositionText with a new-line character at the end of the data
106
+ // instead of firing insertParagraph beforeInput event.
107
+ // Fire the correct type of beforeInput event and ignore the replaced fragment of text because
108
+ // it wants to replace "test" with "test\n".
109
+ // https://github.com/ckeditor/ckeditor5/issues/12368.
110
+ if (env.isAndroid && domEvent.inputType == 'insertCompositionText' && data && data.endsWith('\n')) {
111
+ this.fire(domEvent.type, domEvent, {
112
+ inputType: 'insertParagraph',
113
+ targetRanges: [view.createRange(targetRanges[0].end)]
114
+ });
115
+ // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {
116
+ // @if CK_DEBUG_TYPING // console.groupEnd();
117
+ // @if CK_DEBUG_TYPING // }
118
+ return;
119
+ }
120
+ // Normalize the insertText data that includes new-line characters.
121
+ // https://github.com/ckeditor/ckeditor5/issues/2045.
122
+ if (domEvent.inputType == 'insertText' && data && data.includes('\n')) {
123
+ // There might be a single new-line or double for new paragraph, but we translate
124
+ // it to paragraphs as it is our default action for enter handling.
125
+ const parts = data.split(/\n{1,2}/g);
126
+ let partTargetRanges = targetRanges;
127
+ for (let i = 0; i < parts.length; i++) {
128
+ const dataPart = parts[i];
129
+ if (dataPart != '') {
130
+ this.fire(domEvent.type, domEvent, {
131
+ data: dataPart,
132
+ dataTransfer,
133
+ targetRanges: partTargetRanges,
134
+ inputType: domEvent.inputType,
135
+ isComposing: domEvent.isComposing
136
+ });
137
+ // Use the result view selection so following events will be added one after another.
138
+ partTargetRanges = [viewDocument.selection.getFirstRange()];
139
+ }
140
+ if (i + 1 < parts.length) {
141
+ this.fire(domEvent.type, domEvent, {
142
+ inputType: 'insertParagraph',
143
+ targetRanges: partTargetRanges
144
+ });
145
+ // Use the result view selection so following events will be added one after another.
146
+ partTargetRanges = [viewDocument.selection.getFirstRange()];
147
+ }
148
+ }
149
+ // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {
150
+ // @if CK_DEBUG_TYPING // console.groupEnd();
151
+ // @if CK_DEBUG_TYPING // }
152
+ return;
153
+ }
154
+ // Fire the normalized beforeInput event.
155
+ this.fire(domEvent.type, domEvent, {
156
+ data,
157
+ dataTransfer,
158
+ targetRanges,
159
+ inputType: domEvent.inputType,
160
+ isComposing: domEvent.isComposing
161
+ });
162
+ // @if CK_DEBUG_TYPING // if ( ( window as any ).logCKETyping ) {
163
+ // @if CK_DEBUG_TYPING // console.groupEnd();
164
+ // @if CK_DEBUG_TYPING // }
165
+ }
166
+ }
@@ -0,0 +1,66 @@
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
+ * @module engine/view/observer/keyobserver
7
+ */
8
+ import DomEventObserver from './domeventobserver.js';
9
+ import type DomEventData from './domeventdata.js';
10
+ import { type KeystrokeInfo } from '@ckeditor/ckeditor5-utils';
11
+ /**
12
+ * Observer for events connected with pressing keyboard keys.
13
+ *
14
+ * Note that this observer is attached by the {@link module:engine/view/view~View} and is available by default.
15
+ */
16
+ export default class KeyObserver extends DomEventObserver<'keydown' | 'keyup', KeystrokeInfo & {
17
+ keystroke: number;
18
+ }> {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ readonly domEventType: readonly ["keydown", "keyup"];
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ onDomEvent(domEvt: KeyboardEvent): void;
27
+ }
28
+ /**
29
+ * Fired when a key has been pressed.
30
+ *
31
+ * Introduced by {@link module:engine/view/observer/keyobserver~KeyObserver}.
32
+ *
33
+ * Note that because {@link module:engine/view/observer/keyobserver~KeyObserver} is attached by the
34
+ * {@link module:engine/view/view~View} this event is available by default.
35
+ *
36
+ * @see module:engine/view/observer/keyobserver~KeyObserver
37
+ * @eventName module:engine/view/document~Document#keydown
38
+ */
39
+ export type ViewDocumentKeyDownEvent = {
40
+ name: 'keydown';
41
+ args: [data: KeyEventData];
42
+ };
43
+ /**
44
+ * Fired when a key has been released.
45
+ *
46
+ * Introduced by {@link module:engine/view/observer/keyobserver~KeyObserver}.
47
+ *
48
+ * Note that because {@link module:engine/view/observer/keyobserver~KeyObserver} is attached by the
49
+ * {@link module:engine/view/view~View} this event is available by default.
50
+ *
51
+ * @see module:engine/view/observer/keyobserver~KeyObserver
52
+ * @eventName module:engine/view/document~Document#keyup
53
+ */
54
+ export type ViewDocumentKeyUpEvent = {
55
+ name: 'keyup';
56
+ args: [data: KeyEventData];
57
+ };
58
+ /**
59
+ * The value of both events - {@link ~ViewDocumentKeyDownEvent} and {@link ~ViewDocumentKeyUpEvent}.
60
+ */
61
+ export interface KeyEventData extends DomEventData<KeyboardEvent>, KeystrokeInfo {
62
+ /**
63
+ * Code of the whole keystroke. See {@link module:utils/keyboard~getCode}.
64
+ */
65
+ keystroke: number;
66
+ }
@@ -0,0 +1,39 @@
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
+ * @module engine/view/observer/keyobserver
7
+ */
8
+ import DomEventObserver from './domeventobserver.js';
9
+ import { getCode } from '@ckeditor/ckeditor5-utils';
10
+ /**
11
+ * Observer for events connected with pressing keyboard keys.
12
+ *
13
+ * Note that this observer is attached by the {@link module:engine/view/view~View} and is available by default.
14
+ */
15
+ export default class KeyObserver extends DomEventObserver {
16
+ constructor() {
17
+ super(...arguments);
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ this.domEventType = ['keydown', 'keyup'];
22
+ }
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ onDomEvent(domEvt) {
27
+ const data = {
28
+ keyCode: domEvt.keyCode,
29
+ altKey: domEvt.altKey,
30
+ ctrlKey: domEvt.ctrlKey,
31
+ shiftKey: domEvt.shiftKey,
32
+ metaKey: domEvt.metaKey,
33
+ get keystroke() {
34
+ return getCode(this);
35
+ }
36
+ };
37
+ this.fire(domEvt.type, domEvt, data);
38
+ }
39
+ }
@@ -0,0 +1,89 @@
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
+ * @module engine/view/observer/mouseobserver
7
+ */
8
+ import DomEventObserver from './domeventobserver.js';
9
+ import type DomEventData from './domeventdata.js';
10
+ /**
11
+ * Mouse events observer.
12
+ *
13
+ * Note that this observer is not available by default. To make it available it needs to be added to
14
+ * {@link module:engine/view/view~View} by {@link module:engine/view/view~View#addObserver} method.
15
+ */
16
+ export default class MouseObserver extends DomEventObserver<'mousedown' | 'mouseup' | 'mouseover' | 'mouseout'> {
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ readonly domEventType: readonly ["mousedown", "mouseup", "mouseover", "mouseout"];
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ onDomEvent(domEvent: MouseEvent): void;
25
+ }
26
+ /**
27
+ * Fired when the mouse button is pressed down on one of the editing roots of the editor.
28
+ *
29
+ * Introduced by {@link module:engine/view/observer/mouseobserver~MouseObserver}.
30
+ *
31
+ * Note that this event is not available by default. To make it available, {@link module:engine/view/observer/mouseobserver~MouseObserver}
32
+ * needs to be added to {@link module:engine/view/view~View} by the {@link module:engine/view/view~View#addObserver} method.
33
+ *
34
+ * @see module:engine/view/observer/mouseobserver~MouseObserver
35
+ * @eventName module:engine/view/document~Document#mousedown
36
+ * @param data The event data.
37
+ */
38
+ export type ViewDocumentMouseDownEvent = {
39
+ name: 'mousedown';
40
+ args: [data: DomEventData<MouseEvent>];
41
+ };
42
+ /**
43
+ * Fired when the mouse button is released over one of the editing roots of the editor.
44
+ *
45
+ * Introduced by {@link module:engine/view/observer/mouseobserver~MouseObserver}.
46
+ *
47
+ * Note that this event is not available by default. To make it available, {@link module:engine/view/observer/mouseobserver~MouseObserver}
48
+ * needs to be added to {@link module:engine/view/view~View} by the {@link module:engine/view/view~View#addObserver} method.
49
+ *
50
+ * @see module:engine/view/observer/mouseobserver~MouseObserver
51
+ * @eventName module:engine/view/document~Document#mouseup
52
+ * @param data The event data.
53
+ */
54
+ export type ViewDocumentMouseUpEvent = {
55
+ name: 'mouseup';
56
+ args: [data: DomEventData<MouseEvent>];
57
+ };
58
+ /**
59
+ * Fired when the mouse is over one of the editing roots of the editor.
60
+ *
61
+ * Introduced by {@link module:engine/view/observer/mouseobserver~MouseObserver}.
62
+ *
63
+ * Note that this event is not available by default. To make it available, {@link module:engine/view/observer/mouseobserver~MouseObserver}
64
+ * needs to be added to {@link module:engine/view/view~View} by the {@link module:engine/view/view~View#addObserver} method.
65
+ *
66
+ * @see module:engine/view/observer/mouseobserver~MouseObserver
67
+ * @eventName module:engine/view/document~Document#mouseover
68
+ * @param data The event data.
69
+ */
70
+ export type ViewDocumentMouseOverEvent = {
71
+ name: 'mouseover';
72
+ args: [data: DomEventData<MouseEvent>];
73
+ };
74
+ /**
75
+ * Fired when the mouse is moved out of the one of the editing roots of the editor.
76
+ *
77
+ * Introduced by {@link module:engine/view/observer/mouseobserver~MouseObserver}.
78
+ *
79
+ * Note that this event is not available by default. To make it available, {@link module:engine/view/observer/mouseobserver~MouseObserver}
80
+ * needs to be added to {@link module:engine/view/view~View} by the {@link module:engine/view/view~View#addObserver} method.
81
+ *
82
+ * @see module:engine/view/observer/mouseobserver~MouseObserver
83
+ * @eventName module:engine/view/document~Document#mouseout
84
+ * @param data The event data.
85
+ */
86
+ export type ViewDocumentMouseOutEvent = {
87
+ name: 'mouseout';
88
+ args: [data: DomEventData<MouseEvent>];
89
+ };