@ckeditor/ckeditor5-fullscreen 0.0.1 → 45.0.0-alpha.1

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 (398) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +9 -5
  3. package/README.md +36 -3
  4. package/build/fullscreen.js +5 -0
  5. package/build/translations/af.js +1 -0
  6. package/build/translations/ar.js +1 -0
  7. package/build/translations/ast.js +1 -0
  8. package/build/translations/az.js +1 -0
  9. package/build/translations/be.js +1 -0
  10. package/build/translations/bg.js +1 -0
  11. package/build/translations/bn.js +1 -0
  12. package/build/translations/bs.js +1 -0
  13. package/build/translations/ca.js +1 -0
  14. package/build/translations/cs.js +1 -0
  15. package/build/translations/da.js +1 -0
  16. package/build/translations/de-ch.js +1 -0
  17. package/build/translations/de.js +1 -0
  18. package/build/translations/el.js +1 -0
  19. package/build/translations/en-au.js +1 -0
  20. package/build/translations/en-gb.js +1 -0
  21. package/build/translations/eo.js +1 -0
  22. package/build/translations/es-co.js +1 -0
  23. package/build/translations/es.js +1 -0
  24. package/build/translations/et.js +1 -0
  25. package/build/translations/eu.js +1 -0
  26. package/build/translations/fa.js +1 -0
  27. package/build/translations/fi.js +1 -0
  28. package/build/translations/fr.js +1 -0
  29. package/build/translations/gl.js +1 -0
  30. package/build/translations/gu.js +1 -0
  31. package/build/translations/he.js +1 -0
  32. package/build/translations/hi.js +1 -0
  33. package/build/translations/hr.js +1 -0
  34. package/build/translations/hu.js +1 -0
  35. package/build/translations/hy.js +1 -0
  36. package/build/translations/id.js +1 -0
  37. package/build/translations/it.js +1 -0
  38. package/build/translations/ja.js +1 -0
  39. package/build/translations/jv.js +1 -0
  40. package/build/translations/kk.js +1 -0
  41. package/build/translations/km.js +1 -0
  42. package/build/translations/kn.js +1 -0
  43. package/build/translations/ko.js +1 -0
  44. package/build/translations/ku.js +1 -0
  45. package/build/translations/lt.js +1 -0
  46. package/build/translations/lv.js +1 -0
  47. package/build/translations/ms.js +1 -0
  48. package/build/translations/nb.js +1 -0
  49. package/build/translations/ne.js +1 -0
  50. package/build/translations/nl.js +1 -0
  51. package/build/translations/no.js +1 -0
  52. package/build/translations/oc.js +1 -0
  53. package/build/translations/pl.js +1 -0
  54. package/build/translations/pt-br.js +1 -0
  55. package/build/translations/pt.js +1 -0
  56. package/build/translations/ro.js +1 -0
  57. package/build/translations/ru.js +1 -0
  58. package/build/translations/si.js +1 -0
  59. package/build/translations/sk.js +1 -0
  60. package/build/translations/sl.js +1 -0
  61. package/build/translations/sq.js +1 -0
  62. package/build/translations/sr-latn.js +1 -0
  63. package/build/translations/sr.js +1 -0
  64. package/build/translations/sv.js +1 -0
  65. package/build/translations/th.js +1 -0
  66. package/build/translations/ti.js +1 -0
  67. package/build/translations/tk.js +1 -0
  68. package/build/translations/tr.js +1 -0
  69. package/build/translations/tt.js +1 -0
  70. package/build/translations/ug.js +1 -0
  71. package/build/translations/uk.js +1 -0
  72. package/build/translations/ur.js +1 -0
  73. package/build/translations/uz.js +1 -0
  74. package/build/translations/vi.js +1 -0
  75. package/build/translations/zh-cn.js +1 -0
  76. package/build/translations/zh.js +1 -0
  77. package/ckeditor5-metadata.json +11 -0
  78. package/dist/index-content.css +4 -0
  79. package/dist/index-editor.css +175 -0
  80. package/dist/index.css +209 -0
  81. package/dist/index.css.map +1 -0
  82. package/dist/index.js +710 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/translations/af.d.ts +8 -0
  85. package/dist/translations/af.js +5 -0
  86. package/dist/translations/af.umd.js +11 -0
  87. package/dist/translations/ar.d.ts +8 -0
  88. package/dist/translations/ar.js +5 -0
  89. package/dist/translations/ar.umd.js +11 -0
  90. package/dist/translations/ast.d.ts +8 -0
  91. package/dist/translations/ast.js +5 -0
  92. package/dist/translations/ast.umd.js +11 -0
  93. package/dist/translations/az.d.ts +8 -0
  94. package/dist/translations/az.js +5 -0
  95. package/dist/translations/az.umd.js +11 -0
  96. package/dist/translations/be.d.ts +8 -0
  97. package/dist/translations/be.js +5 -0
  98. package/dist/translations/be.umd.js +11 -0
  99. package/dist/translations/bg.d.ts +8 -0
  100. package/dist/translations/bg.js +5 -0
  101. package/dist/translations/bg.umd.js +11 -0
  102. package/dist/translations/bn.d.ts +8 -0
  103. package/dist/translations/bn.js +5 -0
  104. package/dist/translations/bn.umd.js +11 -0
  105. package/dist/translations/bs.d.ts +8 -0
  106. package/dist/translations/bs.js +5 -0
  107. package/dist/translations/bs.umd.js +11 -0
  108. package/dist/translations/ca.d.ts +8 -0
  109. package/dist/translations/ca.js +5 -0
  110. package/dist/translations/ca.umd.js +11 -0
  111. package/dist/translations/cs.d.ts +8 -0
  112. package/dist/translations/cs.js +5 -0
  113. package/dist/translations/cs.umd.js +11 -0
  114. package/dist/translations/da.d.ts +8 -0
  115. package/dist/translations/da.js +5 -0
  116. package/dist/translations/da.umd.js +11 -0
  117. package/dist/translations/de-ch.d.ts +8 -0
  118. package/dist/translations/de-ch.js +5 -0
  119. package/dist/translations/de-ch.umd.js +11 -0
  120. package/dist/translations/de.d.ts +8 -0
  121. package/dist/translations/de.js +5 -0
  122. package/dist/translations/de.umd.js +11 -0
  123. package/dist/translations/el.d.ts +8 -0
  124. package/dist/translations/el.js +5 -0
  125. package/dist/translations/el.umd.js +11 -0
  126. package/dist/translations/en-au.d.ts +8 -0
  127. package/dist/translations/en-au.js +5 -0
  128. package/dist/translations/en-au.umd.js +11 -0
  129. package/dist/translations/en-gb.d.ts +8 -0
  130. package/dist/translations/en-gb.js +5 -0
  131. package/dist/translations/en-gb.umd.js +11 -0
  132. package/dist/translations/en.d.ts +8 -0
  133. package/dist/translations/en.js +5 -0
  134. package/dist/translations/en.umd.js +11 -0
  135. package/dist/translations/eo.d.ts +8 -0
  136. package/dist/translations/eo.js +5 -0
  137. package/dist/translations/eo.umd.js +11 -0
  138. package/dist/translations/es-co.d.ts +8 -0
  139. package/dist/translations/es-co.js +5 -0
  140. package/dist/translations/es-co.umd.js +11 -0
  141. package/dist/translations/es.d.ts +8 -0
  142. package/dist/translations/es.js +5 -0
  143. package/dist/translations/es.umd.js +11 -0
  144. package/dist/translations/et.d.ts +8 -0
  145. package/dist/translations/et.js +5 -0
  146. package/dist/translations/et.umd.js +11 -0
  147. package/dist/translations/eu.d.ts +8 -0
  148. package/dist/translations/eu.js +5 -0
  149. package/dist/translations/eu.umd.js +11 -0
  150. package/dist/translations/fa.d.ts +8 -0
  151. package/dist/translations/fa.js +5 -0
  152. package/dist/translations/fa.umd.js +11 -0
  153. package/dist/translations/fi.d.ts +8 -0
  154. package/dist/translations/fi.js +5 -0
  155. package/dist/translations/fi.umd.js +11 -0
  156. package/dist/translations/fr.d.ts +8 -0
  157. package/dist/translations/fr.js +5 -0
  158. package/dist/translations/fr.umd.js +11 -0
  159. package/dist/translations/gl.d.ts +8 -0
  160. package/dist/translations/gl.js +5 -0
  161. package/dist/translations/gl.umd.js +11 -0
  162. package/dist/translations/gu.d.ts +8 -0
  163. package/dist/translations/gu.js +5 -0
  164. package/dist/translations/gu.umd.js +11 -0
  165. package/dist/translations/he.d.ts +8 -0
  166. package/dist/translations/he.js +5 -0
  167. package/dist/translations/he.umd.js +11 -0
  168. package/dist/translations/hi.d.ts +8 -0
  169. package/dist/translations/hi.js +5 -0
  170. package/dist/translations/hi.umd.js +11 -0
  171. package/dist/translations/hr.d.ts +8 -0
  172. package/dist/translations/hr.js +5 -0
  173. package/dist/translations/hr.umd.js +11 -0
  174. package/dist/translations/hu.d.ts +8 -0
  175. package/dist/translations/hu.js +5 -0
  176. package/dist/translations/hu.umd.js +11 -0
  177. package/dist/translations/hy.d.ts +8 -0
  178. package/dist/translations/hy.js +5 -0
  179. package/dist/translations/hy.umd.js +11 -0
  180. package/dist/translations/id.d.ts +8 -0
  181. package/dist/translations/id.js +5 -0
  182. package/dist/translations/id.umd.js +11 -0
  183. package/dist/translations/it.d.ts +8 -0
  184. package/dist/translations/it.js +5 -0
  185. package/dist/translations/it.umd.js +11 -0
  186. package/dist/translations/ja.d.ts +8 -0
  187. package/dist/translations/ja.js +5 -0
  188. package/dist/translations/ja.umd.js +11 -0
  189. package/dist/translations/jv.d.ts +8 -0
  190. package/dist/translations/jv.js +5 -0
  191. package/dist/translations/jv.umd.js +11 -0
  192. package/dist/translations/kk.d.ts +8 -0
  193. package/dist/translations/kk.js +5 -0
  194. package/dist/translations/kk.umd.js +11 -0
  195. package/dist/translations/km.d.ts +8 -0
  196. package/dist/translations/km.js +5 -0
  197. package/dist/translations/km.umd.js +11 -0
  198. package/dist/translations/kn.d.ts +8 -0
  199. package/dist/translations/kn.js +5 -0
  200. package/dist/translations/kn.umd.js +11 -0
  201. package/dist/translations/ko.d.ts +8 -0
  202. package/dist/translations/ko.js +5 -0
  203. package/dist/translations/ko.umd.js +11 -0
  204. package/dist/translations/ku.d.ts +8 -0
  205. package/dist/translations/ku.js +5 -0
  206. package/dist/translations/ku.umd.js +11 -0
  207. package/dist/translations/lt.d.ts +8 -0
  208. package/dist/translations/lt.js +5 -0
  209. package/dist/translations/lt.umd.js +11 -0
  210. package/dist/translations/lv.d.ts +8 -0
  211. package/dist/translations/lv.js +5 -0
  212. package/dist/translations/lv.umd.js +11 -0
  213. package/dist/translations/ms.d.ts +8 -0
  214. package/dist/translations/ms.js +5 -0
  215. package/dist/translations/ms.umd.js +11 -0
  216. package/dist/translations/nb.d.ts +8 -0
  217. package/dist/translations/nb.js +5 -0
  218. package/dist/translations/nb.umd.js +11 -0
  219. package/dist/translations/ne.d.ts +8 -0
  220. package/dist/translations/ne.js +5 -0
  221. package/dist/translations/ne.umd.js +11 -0
  222. package/dist/translations/nl.d.ts +8 -0
  223. package/dist/translations/nl.js +5 -0
  224. package/dist/translations/nl.umd.js +11 -0
  225. package/dist/translations/no.d.ts +8 -0
  226. package/dist/translations/no.js +5 -0
  227. package/dist/translations/no.umd.js +11 -0
  228. package/dist/translations/oc.d.ts +8 -0
  229. package/dist/translations/oc.js +5 -0
  230. package/dist/translations/oc.umd.js +11 -0
  231. package/dist/translations/pl.d.ts +8 -0
  232. package/dist/translations/pl.js +5 -0
  233. package/dist/translations/pl.umd.js +11 -0
  234. package/dist/translations/pt-br.d.ts +8 -0
  235. package/dist/translations/pt-br.js +5 -0
  236. package/dist/translations/pt-br.umd.js +11 -0
  237. package/dist/translations/pt.d.ts +8 -0
  238. package/dist/translations/pt.js +5 -0
  239. package/dist/translations/pt.umd.js +11 -0
  240. package/dist/translations/ro.d.ts +8 -0
  241. package/dist/translations/ro.js +5 -0
  242. package/dist/translations/ro.umd.js +11 -0
  243. package/dist/translations/ru.d.ts +8 -0
  244. package/dist/translations/ru.js +5 -0
  245. package/dist/translations/ru.umd.js +11 -0
  246. package/dist/translations/si.d.ts +8 -0
  247. package/dist/translations/si.js +5 -0
  248. package/dist/translations/si.umd.js +11 -0
  249. package/dist/translations/sk.d.ts +8 -0
  250. package/dist/translations/sk.js +5 -0
  251. package/dist/translations/sk.umd.js +11 -0
  252. package/dist/translations/sl.d.ts +8 -0
  253. package/dist/translations/sl.js +5 -0
  254. package/dist/translations/sl.umd.js +11 -0
  255. package/dist/translations/sq.d.ts +8 -0
  256. package/dist/translations/sq.js +5 -0
  257. package/dist/translations/sq.umd.js +11 -0
  258. package/dist/translations/sr-latn.d.ts +8 -0
  259. package/dist/translations/sr-latn.js +5 -0
  260. package/dist/translations/sr-latn.umd.js +11 -0
  261. package/dist/translations/sr.d.ts +8 -0
  262. package/dist/translations/sr.js +5 -0
  263. package/dist/translations/sr.umd.js +11 -0
  264. package/dist/translations/sv.d.ts +8 -0
  265. package/dist/translations/sv.js +5 -0
  266. package/dist/translations/sv.umd.js +11 -0
  267. package/dist/translations/th.d.ts +8 -0
  268. package/dist/translations/th.js +5 -0
  269. package/dist/translations/th.umd.js +11 -0
  270. package/dist/translations/ti.d.ts +8 -0
  271. package/dist/translations/ti.js +5 -0
  272. package/dist/translations/ti.umd.js +11 -0
  273. package/dist/translations/tk.d.ts +8 -0
  274. package/dist/translations/tk.js +5 -0
  275. package/dist/translations/tk.umd.js +11 -0
  276. package/dist/translations/tr.d.ts +8 -0
  277. package/dist/translations/tr.js +5 -0
  278. package/dist/translations/tr.umd.js +11 -0
  279. package/dist/translations/tt.d.ts +8 -0
  280. package/dist/translations/tt.js +5 -0
  281. package/dist/translations/tt.umd.js +11 -0
  282. package/dist/translations/ug.d.ts +8 -0
  283. package/dist/translations/ug.js +5 -0
  284. package/dist/translations/ug.umd.js +11 -0
  285. package/dist/translations/uk.d.ts +8 -0
  286. package/dist/translations/uk.js +5 -0
  287. package/dist/translations/uk.umd.js +11 -0
  288. package/dist/translations/ur.d.ts +8 -0
  289. package/dist/translations/ur.js +5 -0
  290. package/dist/translations/ur.umd.js +11 -0
  291. package/dist/translations/uz.d.ts +8 -0
  292. package/dist/translations/uz.js +5 -0
  293. package/dist/translations/uz.umd.js +11 -0
  294. package/dist/translations/vi.d.ts +8 -0
  295. package/dist/translations/vi.js +5 -0
  296. package/dist/translations/vi.umd.js +11 -0
  297. package/dist/translations/zh-cn.d.ts +8 -0
  298. package/dist/translations/zh-cn.js +5 -0
  299. package/dist/translations/zh-cn.umd.js +11 -0
  300. package/dist/translations/zh.d.ts +8 -0
  301. package/dist/translations/zh.js +5 -0
  302. package/dist/translations/zh.umd.js +11 -0
  303. package/lang/contexts.json +6 -0
  304. package/lang/translations/af.po +28 -0
  305. package/lang/translations/ar.po +28 -0
  306. package/lang/translations/ast.po +28 -0
  307. package/lang/translations/az.po +28 -0
  308. package/lang/translations/be.po +28 -0
  309. package/lang/translations/bg.po +28 -0
  310. package/lang/translations/bn.po +28 -0
  311. package/lang/translations/bs.po +28 -0
  312. package/lang/translations/ca.po +28 -0
  313. package/lang/translations/cs.po +28 -0
  314. package/lang/translations/da.po +28 -0
  315. package/lang/translations/de-ch.po +28 -0
  316. package/lang/translations/de.po +28 -0
  317. package/lang/translations/el.po +28 -0
  318. package/lang/translations/en-au.po +28 -0
  319. package/lang/translations/en-gb.po +28 -0
  320. package/lang/translations/en.po +28 -0
  321. package/lang/translations/eo.po +28 -0
  322. package/lang/translations/es-co.po +28 -0
  323. package/lang/translations/es.po +28 -0
  324. package/lang/translations/et.po +28 -0
  325. package/lang/translations/eu.po +28 -0
  326. package/lang/translations/fa.po +28 -0
  327. package/lang/translations/fi.po +28 -0
  328. package/lang/translations/fr.po +28 -0
  329. package/lang/translations/gl.po +28 -0
  330. package/lang/translations/gu.po +28 -0
  331. package/lang/translations/he.po +28 -0
  332. package/lang/translations/hi.po +28 -0
  333. package/lang/translations/hr.po +28 -0
  334. package/lang/translations/hu.po +28 -0
  335. package/lang/translations/hy.po +28 -0
  336. package/lang/translations/id.po +28 -0
  337. package/lang/translations/it.po +28 -0
  338. package/lang/translations/ja.po +28 -0
  339. package/lang/translations/jv.po +28 -0
  340. package/lang/translations/kk.po +28 -0
  341. package/lang/translations/km.po +28 -0
  342. package/lang/translations/kn.po +28 -0
  343. package/lang/translations/ko.po +28 -0
  344. package/lang/translations/ku.po +28 -0
  345. package/lang/translations/lt.po +28 -0
  346. package/lang/translations/lv.po +28 -0
  347. package/lang/translations/ms.po +28 -0
  348. package/lang/translations/nb.po +28 -0
  349. package/lang/translations/ne.po +28 -0
  350. package/lang/translations/nl.po +28 -0
  351. package/lang/translations/no.po +28 -0
  352. package/lang/translations/oc.po +28 -0
  353. package/lang/translations/pl.po +28 -0
  354. package/lang/translations/pt-br.po +28 -0
  355. package/lang/translations/pt.po +28 -0
  356. package/lang/translations/ro.po +28 -0
  357. package/lang/translations/ru.po +28 -0
  358. package/lang/translations/si.po +28 -0
  359. package/lang/translations/sk.po +28 -0
  360. package/lang/translations/sl.po +28 -0
  361. package/lang/translations/sq.po +28 -0
  362. package/lang/translations/sr-latn.po +28 -0
  363. package/lang/translations/sr.po +28 -0
  364. package/lang/translations/sv.po +28 -0
  365. package/lang/translations/th.po +28 -0
  366. package/lang/translations/ti.po +28 -0
  367. package/lang/translations/tk.po +28 -0
  368. package/lang/translations/tr.po +28 -0
  369. package/lang/translations/tt.po +28 -0
  370. package/lang/translations/ug.po +28 -0
  371. package/lang/translations/uk.po +28 -0
  372. package/lang/translations/ur.po +28 -0
  373. package/lang/translations/uz.po +28 -0
  374. package/lang/translations/vi.po +28 -0
  375. package/lang/translations/zh-cn.po +28 -0
  376. package/lang/translations/zh.po +28 -0
  377. package/package.json +61 -4
  378. package/src/augmentation.d.ts +21 -0
  379. package/src/augmentation.js +5 -0
  380. package/src/fullscreen.d.ts +27 -0
  381. package/src/fullscreen.js +33 -0
  382. package/src/fullscreencommand.d.ts +40 -0
  383. package/src/fullscreencommand.js +68 -0
  384. package/src/fullscreenconfig.d.ts +70 -0
  385. package/src/fullscreenconfig.js +5 -0
  386. package/src/fullscreenediting.d.ts +29 -0
  387. package/src/fullscreenediting.js +59 -0
  388. package/src/fullscreenui.d.ts +35 -0
  389. package/src/fullscreenui.js +76 -0
  390. package/src/handlers/abstracteditorhandler.d.ts +146 -0
  391. package/src/handlers/abstracteditorhandler.js +509 -0
  392. package/src/handlers/classiceditorhandler.d.ts +23 -0
  393. package/src/handlers/classiceditorhandler.js +54 -0
  394. package/src/handlers/decouplededitorhandler.d.ts +26 -0
  395. package/src/handlers/decouplededitorhandler.js +37 -0
  396. package/src/index.d.ts +13 -0
  397. package/src/index.js +11 -0
  398. package/theme/fullscreen.css +206 -0
package/dist/index.js ADDED
@@ -0,0 +1,710 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ import { Command, Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';
6
+ import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic/dist/index.js';
7
+ import { DecoupledEditor } from '@ckeditor/ckeditor5-editor-decoupled/dist/index.js';
8
+ import { BodyCollection, DialogViewPosition, MenuBarView, ButtonView, MenuBarMenuListItemButtonView } from '@ckeditor/ckeditor5-ui/dist/index.js';
9
+ import { global, createElement, Rect } from '@ckeditor/ckeditor5-utils/dist/index.js';
10
+ import { IconFullscreenLeave, IconFullscreenEnter } from '@ckeditor/ckeditor5-icons/dist/index.js';
11
+
12
+ const DIALOG_OFFSET = 28;
13
+ /**
14
+ * The abstract editor type handler. It should be extended by the particular editor type handler.
15
+ */ class AbstractEditorHandler {
16
+ /**
17
+ * Maps placeholder names to placeholder elements and moved elements.
18
+ */ _placeholderMap;
19
+ /**
20
+ * The wrapper element that holds the fullscreen mode layout.
21
+ */ _wrapper = null;
22
+ /**
23
+ * The document object in which the editor is located.
24
+ */ _document;
25
+ /**
26
+ * Data of the annotations UIs that were active before entering the fullscreen mode.
27
+ */ _annotationsUIsData = null;
28
+ /**
29
+ * The pagination body collection that is used in the fullscreen mode.
30
+ * If we don't move pagination lines to the fullscreen container, they won't be visible.
31
+ */ _paginationBodyCollection = null;
32
+ /**
33
+ * A callback that hides the document outline header when the source editing mode is enabled.
34
+ * Document outline element itself is hidden by source editing plugin.
35
+ */ /* istanbul ignore next -- @preserve */ _sourceEditingCallback = (_evt, _name, value)=>{
36
+ this.getWrapper().querySelector('.ck-fullscreen__document-outline-header').style.display = value ? 'none' : '';
37
+ };
38
+ /**
39
+ * A map of elements that were hidden when entering the fullscreen mode.
40
+ * It is used to restore their previous visibility when leaving the fullscreen mode and avoid showing elements
41
+ * that were hidden before entering the fullscreen mode.
42
+ */ _hiddenElements = new Map();
43
+ /**
44
+ * A callback that shows the revision viewer, stored to restore the original one after exiting the fullscreen mode.
45
+ */ _showRevisionViewerCallback = null;
46
+ /**
47
+ * A callback that closes the revision viewer, stored to restore the original one after exiting the fullscreen mode.
48
+ */ _closeRevisionViewerCallback = null;
49
+ /**
50
+ * @inheritDoc
51
+ */ constructor(editor){
52
+ this._placeholderMap = new Map();
53
+ if (editor.plugins.has('RevisionHistory')) {
54
+ this._showRevisionViewerCallback = editor.config.get('revisionHistory').showRevisionViewerCallback;
55
+ this._closeRevisionViewerCallback = editor.config.get('revisionHistory').closeRevisionViewerCallback;
56
+ }
57
+ this._editor = editor;
58
+ this._document = this._editor.sourceElement ? this._editor.sourceElement.ownerDocument : global.document;
59
+ this._editor.config.define('fullscreen.container', this._document.body);
60
+ editor.on('destroy', ()=>{
61
+ if (this._wrapper) {
62
+ this.destroy();
63
+ }
64
+ });
65
+ }
66
+ /**
67
+ * Moves the given element to the fullscreen mode container, leaving a placeholder in its place.
68
+ */ moveToFullscreen(elementToMove, placeholderName) {
69
+ const placeholderElement = createElement(this._document, 'div');
70
+ placeholderElement.setAttribute('data-ck-fullscreen-placeholder', placeholderName);
71
+ elementToMove.replaceWith(placeholderElement);
72
+ this.getWrapper().querySelector(`[data-ck-fullscreen="${placeholderName}"]`).append(elementToMove);
73
+ this._placeholderMap.set(placeholderName, {
74
+ placeholderElement,
75
+ movedElement: elementToMove
76
+ });
77
+ }
78
+ /**
79
+ * Returns a single moved element to its original place.
80
+ */ restoreMovedElementLocation(placeholderName) {
81
+ if (!this._placeholderMap.has(placeholderName)) {
82
+ return;
83
+ }
84
+ const { placeholderElement, movedElement } = this._placeholderMap.get(placeholderName);
85
+ placeholderElement.replaceWith(movedElement);
86
+ placeholderElement.remove();
87
+ this._placeholderMap.delete(placeholderName);
88
+ if (this._placeholderMap.size === 0) {
89
+ this._destroyContainer();
90
+ }
91
+ }
92
+ /**
93
+ * Returns the fullscreen mode container element.
94
+ */ getWrapper() {
95
+ if (!this._wrapper) {
96
+ this._wrapper = createElement(this._document, 'div', {
97
+ class: 'ck ck-fullscreen__main-wrapper'
98
+ });
99
+ // For now, the container is generated in a very straightforward way. If necessary, it may be rewritten using our UI lib.
100
+ this._wrapper.innerHTML = `
101
+ <div class="ck ck-fullscreen__top-wrapper ck-reset_all">
102
+ <div class="ck ck-fullscreen__menu-bar" data-ck-fullscreen="menu-bar"></div>
103
+ <div class="ck ck-fullscreen__toolbar" data-ck-fullscreen="toolbar"></div>
104
+ </div>
105
+ <div class="ck ck-fullscreen__editable-wrapper">
106
+ <div class="ck ck-fullscreen__sidebar ck-fullscreen__left-sidebar" data-ck-fullscreen="left-sidebar">
107
+ <div class="ck ck-fullscreen__left-sidebar--sticky" data-ck-fullscreen="left-sidebar-sticky"></div>
108
+ </div>
109
+ <div class="ck ck-fullscreen__editable" data-ck-fullscreen="editable">
110
+ <div class="ck ck-fullscreen__pagination-view" data-ck-fullscreen="pagination-view"></div>
111
+ </div>
112
+ <div class="ck ck-fullscreen__sidebar ck-fullscreen__right-sidebar" data-ck-fullscreen="right-sidebar"></div>
113
+ </div>
114
+ <div class="ck ck-fullscreen__bottom-wrapper">
115
+ <div class="ck ck-fullscreen__body-wrapper" data-ck-fullscreen="body-wrapper"></div>
116
+ </div>
117
+ `;
118
+ this._editor.config.get('fullscreen.container').appendChild(this._wrapper);
119
+ }
120
+ return this._wrapper;
121
+ }
122
+ /**
123
+ * Enables the fullscreen mode. It executes the editor-specific enable handler and then the configured callback.
124
+ */ enable() {
125
+ this._defaultOnEnter();
126
+ // Block scroll if the fullscreen container is the body element. Otherwise the document has to stay scrollable.
127
+ if (this._editor.config.get('fullscreen.container') === this._document.body) {
128
+ this._document.body.classList.add('ck-fullscreen');
129
+ this._document.body.parentElement.classList.add('ck-fullscreen');
130
+ }
131
+ if (this._editor.plugins.has('Dialog')) {
132
+ this._registerFullscreenDialogPositionAdjustments();
133
+ }
134
+ // Code coverage is provided in the commercial package repository as integration unit tests.
135
+ /* istanbul ignore if -- @preserve */ if (this._editor.plugins.has('PresenceListUI')) {
136
+ this._generatePresenceListContainer();
137
+ }
138
+ // Code coverage is provided in the commercial package repository as integration unit tests.
139
+ /* istanbul ignore if -- @preserve */ if (this._editor.plugins.has('DocumentOutlineUI')) {
140
+ this._generateDocumentOutlineContainer();
141
+ }
142
+ // Code coverage is provided in the commercial package repository as integration unit tests.
143
+ /* istanbul ignore if -- @preserve */ if (this._editor.plugins.has('Pagination')) {
144
+ const paginationRenderer = this._editor.plugins.get('PaginationRenderer');
145
+ paginationRenderer.setupScrollableAncestor();
146
+ this._paginationBodyCollection = new BodyCollection(this._editor.locale);
147
+ this._paginationBodyCollection.attachToDom();
148
+ paginationRenderer.linesRepository.setViewCollection(this._paginationBodyCollection);
149
+ this._editor.once('destroy', ()=>{
150
+ this._paginationBodyCollection.detachFromDom();
151
+ });
152
+ this.moveToFullscreen(this._paginationBodyCollection.bodyCollectionContainer, 'body-wrapper');
153
+ }
154
+ // Code coverage is provided in the commercial package repository as integration unit tests.
155
+ /* istanbul ignore if -- @preserve */ if (this._editor.plugins.has('AnnotationsUIs')) {
156
+ this._overrideAnnotationsUIs();
157
+ }
158
+ if (this._editor.plugins.has('RevisionHistory')) {
159
+ // Code coverage is provided in the commercial package repository as integration unit tests.
160
+ /* istanbul ignore if -- @preserve */ if (this._editor.plugins.get('RevisionHistory').isRevisionViewerOpen) {
161
+ // Keep in mind that closing the revision history viewer is an asynchronous operation.
162
+ this._editor.config.get('revisionHistory.closeRevisionViewerCallback')();
163
+ }
164
+ this._overrideRevisionHistoryCallbacks();
165
+ }
166
+ if (this._editor.plugins.has('SourceEditing') && this._editor.plugins.has('DocumentOutlineUI')) {
167
+ this._editor.plugins.get('SourceEditing').on('change:isSourceEditingMode', this._sourceEditingCallback);
168
+ }
169
+ // Hide all other elements in the container to ensure they don't create an empty unscrollable space.
170
+ for (const element of this._editor.config.get('fullscreen.container').children){
171
+ // Do not hide body wrapper and ckbox wrapper to keep dialogs, balloons etc visible.
172
+ if (element !== this._wrapper && !element.classList.contains('ck-body-wrapper') && !element.classList.contains('ckbox-wrapper') && // Already hidden elements are not hidden again to avoid accidentally showing them after leaving fullscreen.
173
+ element.style.display !== 'none') {
174
+ this._hiddenElements.set(element, element.style.display);
175
+ element.style.display = 'none';
176
+ }
177
+ }
178
+ if (this._editor.config.get('fullscreen.onEnterCallback')) {
179
+ this._editor.config.get('fullscreen.onEnterCallback')(this.getWrapper());
180
+ }
181
+ }
182
+ /**
183
+ * Disables the fullscreen mode by restoring all moved elements and destroying the fullscreen container.
184
+ */ disable() {
185
+ if (this._editor.config.get('fullscreen.onLeaveCallback')) {
186
+ this._editor.config.get('fullscreen.onLeaveCallback')(this.getWrapper());
187
+ }
188
+ this._document.body.classList.remove('ck-fullscreen');
189
+ this._document.body.parentElement.classList.remove('ck-fullscreen');
190
+ // Code coverage is provided in the commercial package repository as integration unit tests.
191
+ /* istanbul ignore if -- @preserve */ if (this._editor.plugins.has('DocumentOutlineUI')) {
192
+ this._restoreDocumentOutlineDefaultContainer();
193
+ }
194
+ // Code coverage is provided in the commercial package repository as integration unit tests.
195
+ /* istanbul ignore if -- @preserve */ if (this._annotationsUIsData) {
196
+ this._restoreAnnotationsUIs();
197
+ }
198
+ if (this._editor.plugins.has('RevisionHistory')) {
199
+ this._restoreRevisionHistoryCallbacks();
200
+ }
201
+ if (this._editor.plugins.has('SourceEditing') && this._editor.plugins.has('DocumentOutlineUI')) {
202
+ this._editor.plugins.get('SourceEditing').off('change:isSourceEditingMode', this._sourceEditingCallback);
203
+ }
204
+ for (const placeholderName of this._placeholderMap.keys()){
205
+ this.restoreMovedElementLocation(placeholderName);
206
+ }
207
+ this._editor.ui.view.toolbar.switchBehavior(this._editor.config.get('toolbar.shouldNotGroupWhenFull') === true ? 'static' : 'dynamic');
208
+ if (this._placeholderMap.size === 0) {
209
+ this._destroyContainer();
210
+ }
211
+ // Pagination has to be restored after leaving fullscreen mode to ensure proper rendering.
212
+ // Code coverage is provided in the commercial package repository as integration unit tests.
213
+ /* istanbul ignore if -- @preserve */ if (this._editor.plugins.has('Pagination')) {
214
+ const paginationRenderer = this._editor.plugins.get('PaginationRenderer');
215
+ paginationRenderer.setupScrollableAncestor();
216
+ paginationRenderer.linesRepository.setViewCollection(this._editor.ui.view.body);
217
+ this._paginationBodyCollection.detachFromDom();
218
+ this._paginationBodyCollection?.destroy();
219
+ }
220
+ // Also dialog position needs to be recalculated after leaving fullscreen mode.
221
+ if (this._editor.plugins.has('Dialog')) {
222
+ this._unregisterFullscreenDialogPositionAdjustments();
223
+ }
224
+ }
225
+ /**
226
+ * @inheritDoc
227
+ */ destroy() {
228
+ for (const { placeholderElement, movedElement } of this._placeholderMap.values()){
229
+ placeholderElement.remove();
230
+ movedElement.remove();
231
+ }
232
+ this._destroyContainer();
233
+ this._document.body.classList.remove('ck-fullscreen');
234
+ this._document.body.parentElement.classList.remove('ck-fullscreen');
235
+ }
236
+ /**
237
+ * A function that moves the editor UI elements to the fullscreen mode. It should be set by the particular editor type handler.
238
+ *
239
+ * Returns the fullscreen mode container element so it can be further customized via
240
+ * `fullscreen.onEnterCallback` configuration property.
241
+ */ _defaultOnEnter() {
242
+ return this.getWrapper();
243
+ }
244
+ /**
245
+ * Destroys the fullscreen mode container.
246
+ */ _destroyContainer() {
247
+ if (!this._wrapper) {
248
+ return;
249
+ }
250
+ this._wrapper.remove();
251
+ this._wrapper = null;
252
+ // Restore visibility of all other elements in the container.
253
+ for (const [element, displayValue] of this._hiddenElements){
254
+ element.style.display = displayValue;
255
+ }
256
+ this._hiddenElements.clear();
257
+ }
258
+ /**
259
+ * Checks if the PresenceListUI plugin is available and moves its elements to fullscreen mode.
260
+ */ // Code coverage is provided in the commercial package repository as integration unit tests.
261
+ /* istanbul ignore next -- @preserve */ _generatePresenceListContainer() {
262
+ const presenceListElement = createElement(document, 'div', {
263
+ class: 'ck ck-fullscreen__left-sidebar-item'
264
+ });
265
+ presenceListElement.innerHTML = `
266
+ <div class="ck ck-fullscreen__left-sidebar-header">Connected users</div>
267
+ <div class="ck ck-fullscreen__presence-list" data-ck-fullscreen="presence-list"></div>
268
+ `;
269
+ document.querySelector('[data-ck-fullscreen="left-sidebar-sticky"]').appendChild(presenceListElement);
270
+ const presenceListUI = this._editor.plugins.get('PresenceListUI');
271
+ this.moveToFullscreen(presenceListUI.view.element, 'presence-list');
272
+ }
273
+ /**
274
+ * Checks if the DocumentOutlineUI plugin is available and moves its elements to fullscreen mode.
275
+ */ // Code coverage is provided in the commercial package repository as integration unit tests.
276
+ /* istanbul ignore next -- @preserve */ _generateDocumentOutlineContainer() {
277
+ const documentOutlineHeaderElement = createElement(document, 'div', {
278
+ class: 'ck-fullscreen__left-sidebar-item ck-fullscreen__left-sidebar-item--no-margin'
279
+ });
280
+ documentOutlineHeaderElement.innerHTML = `
281
+ <div class="ck ck-fullscreen__left-sidebar-header ck-fullscreen__document-outline-header">
282
+ Document outline
283
+ </div>
284
+ `;
285
+ const documentOutlineBodyWrapper = createElement(document, 'div', {
286
+ class: 'ck ck-fullscreen__left-sidebar-item ck-fullscreen__document-outline-wrapper'
287
+ });
288
+ documentOutlineBodyWrapper.innerHTML = `
289
+ <div class="ck ck-fullscreen__document-outline" data-ck-fullscreen="document-outline"></div>
290
+ `;
291
+ document.querySelector('[data-ck-fullscreen="left-sidebar"]').appendChild(documentOutlineBodyWrapper);
292
+ document.querySelector('[data-ck-fullscreen="left-sidebar-sticky"]').appendChild(documentOutlineHeaderElement);
293
+ const documentOutlineUI = this._editor.plugins.get('DocumentOutlineUI');
294
+ documentOutlineUI.view.documentOutlineContainer = document.querySelector('[data-ck-fullscreen="left-sidebar"]');
295
+ this.moveToFullscreen(documentOutlineUI.view.element, 'document-outline');
296
+ }
297
+ /**
298
+ * Restores the default value of documentOutlineContainer, which is modified in fullscreen mode.
299
+ */ // Code coverage is provided in the commercial package repository as integration unit tests.
300
+ /* istanbul ignore next -- @preserve */ _restoreDocumentOutlineDefaultContainer() {
301
+ const documentOutlineUI = this._editor.plugins.get('DocumentOutlineUI');
302
+ documentOutlineUI.view.documentOutlineContainer = documentOutlineUI.view.element;
303
+ }
304
+ /**
305
+ * Stores the current state of the annotations UIs to restore it when leaving fullscreen mode.
306
+ */ // Code coverage is provided in the commercial package repository as integration unit tests.
307
+ /* istanbul ignore next -- @preserve */ _overrideAnnotationsUIs() {
308
+ const annotationsUIs = this._editor.plugins.get('AnnotationsUIs');
309
+ this._annotationsUIsData = new Map(annotationsUIs.uisData);
310
+ // Switch to the wide sidebar.
311
+ const sidebarPlugin = this._editor.plugins.get('Sidebar');
312
+ if (!sidebarPlugin.container) {
313
+ sidebarPlugin.setContainer(this.getWrapper().querySelector('[data-ck-fullscreen="right-sidebar"]'));
314
+ }
315
+ const annotationsFilters = new Map();
316
+ for (const [uiName, data] of [
317
+ ...this._annotationsUIsData
318
+ ]){
319
+ // Default filter is `() => true`. Only store filters that are different.
320
+ if (data.filter !== annotationsUIs.defaultFilter) {
321
+ annotationsFilters.set(uiName, data.filter);
322
+ }
323
+ }
324
+ annotationsUIs.deactivateAll();
325
+ // Check if someone has a filter defined for `wideSidebar`. If so, retrieve and apply it in fullscreen. Do not show any other UI.
326
+ if (annotationsFilters.has('wideSidebar')) {
327
+ annotationsUIs.activate('wideSidebar', annotationsFilters.get('wideSidebar'));
328
+ } else if (annotationsFilters.size) {
329
+ annotationsUIs.activate('wideSidebar', (annotation)=>[
330
+ ...annotationsFilters.values()
331
+ ].some((filter)=>filter(annotation)));
332
+ } else {
333
+ annotationsUIs.switchTo('wideSidebar');
334
+ }
335
+ this.moveToFullscreen(sidebarPlugin.container.firstElementChild, 'right-sidebar');
336
+ }
337
+ /**
338
+ * Restores the saved state of the annotations UIs.
339
+ */ // Code coverage is provided in the commercial package repository as integration unit tests.
340
+ /* istanbul ignore next -- @preserve */ _restoreAnnotationsUIs() {
341
+ const annotationsUIs = this._editor.plugins.get('AnnotationsUIs');
342
+ annotationsUIs.deactivateAll();
343
+ for (const [uiName, data] of [
344
+ ...this._annotationsUIsData
345
+ ]){
346
+ annotationsUIs.activate(uiName, data.filter);
347
+ }
348
+ this._annotationsUIsData = null;
349
+ }
350
+ /**
351
+ * Modifies the revision history viewer callbacks to display the viewer in the fullscreen mode.
352
+ */ _overrideRevisionHistoryCallbacks() {
353
+ // * Hide editor's editable, toolbar and sidebar;
354
+ // * Disable menu bar;
355
+ // * Show revision viewer editable, toolbar and sidebar.
356
+ // Code coverage is provided in the commercial package repository as integration unit tests.
357
+ /* istanbul ignore next -- @preserve */ this._editor.config.set('revisionHistory.showRevisionViewerCallback', async ()=>{
358
+ const revisionViewerEditor = await this._showRevisionViewerCallback();
359
+ if (this._editor.plugins.has('DocumentOutlineUI')) {
360
+ this.getWrapper().querySelector('.ck-fullscreen__document-outline-header').style.display = 'none';
361
+ }
362
+ this.restoreMovedElementLocation('editable');
363
+ this.restoreMovedElementLocation('toolbar');
364
+ this.restoreMovedElementLocation('right-sidebar');
365
+ if (this._annotationsUIsData) {
366
+ this._restoreAnnotationsUIs();
367
+ }
368
+ if (this._editor.ui.view.menuBarView) {
369
+ this._editor.ui.view.menuBarView.disable();
370
+ }
371
+ this.moveToFullscreen(revisionViewerEditor.ui.getEditableElement(), 'editable');
372
+ this.moveToFullscreen(revisionViewerEditor.ui.view.toolbar.element, 'toolbar');
373
+ this.moveToFullscreen(this._editor.config.get('revisionHistory.viewerSidebarContainer'), 'right-sidebar');
374
+ return revisionViewerEditor;
375
+ });
376
+ // * Hide revision viewer editable, toolbar and sidebar;
377
+ // * Enable menu bar;
378
+ // * Show editor's editable, toolbar and sidebar.
379
+ // Code coverage is provided in the commercial package repository as integration unit tests.
380
+ /* istanbul ignore next -- @preserve */ this._editor.config.set('revisionHistory.closeRevisionViewerCallback', async ()=>{
381
+ this.restoreMovedElementLocation('toolbar');
382
+ this.restoreMovedElementLocation('editable');
383
+ this.restoreMovedElementLocation('right-sidebar');
384
+ if (this._editor.plugins.has('DocumentOutlineUI')) {
385
+ this.getWrapper().querySelector('.ck-fullscreen__document-outline-header').style.display = '';
386
+ }
387
+ this.moveToFullscreen(this._editor.ui.getEditableElement(), 'editable');
388
+ this.moveToFullscreen(this._editor.ui.view.toolbar.element, 'toolbar');
389
+ await this._closeRevisionViewerCallback();
390
+ if (this._editor.plugins.has('AnnotationsUIs')) {
391
+ this._overrideAnnotationsUIs();
392
+ }
393
+ if (this._editor.ui.view.menuBarView) {
394
+ this._editor.ui.view.menuBarView.enable();
395
+ }
396
+ });
397
+ }
398
+ /**
399
+ * Resets the revision history viewer callbacks to their original values.
400
+ */ _restoreRevisionHistoryCallbacks() {
401
+ // Code coverage is provided in the commercial package repository as integration unit tests.
402
+ /* istanbul ignore next -- @preserve */ this._editor.config.set('revisionHistory.showRevisionViewerCallback', async ()=>{
403
+ return this._showRevisionViewerCallback();
404
+ });
405
+ // Code coverage is provided in the commercial package repository as integration unit tests.
406
+ /* istanbul ignore next -- @preserve */ this._editor.config.set('revisionHistory.closeRevisionViewerCallback', async ()=>{
407
+ return this._closeRevisionViewerCallback();
408
+ });
409
+ }
410
+ /**
411
+ * Adds an event listener when the dialog opens to adjust its position in fullscreen mode,
412
+ * utilizing the empty space on the right side of the editable element.
413
+ */ _registerFullscreenDialogPositionAdjustments() {
414
+ const dialog = this._editor.plugins.get('Dialog');
415
+ this._setNewDialogPosition();
416
+ dialog.on('change:isOpen', this.updateDialogPositionCallback, {
417
+ priority: 'highest'
418
+ });
419
+ }
420
+ /**
421
+ * Removes an event listener that adjusts the dialog's position in fullscreen mode.
422
+ */ _unregisterFullscreenDialogPositionAdjustments() {
423
+ const dialog = this._editor.plugins.get('Dialog');
424
+ const dialogView = dialog.view;
425
+ if (dialogView && dialogView.position === null) {
426
+ dialogView.position = DialogViewPosition.EDITOR_TOP_SIDE;
427
+ }
428
+ if (dialogView) {
429
+ dialogView.updatePosition();
430
+ }
431
+ dialog.off('change:isOpen', this.updateDialogPositionCallback);
432
+ }
433
+ /**
434
+ * Stores a bound reference to the _updateDialogPosition method, allowing it to be attached and detached from change event.
435
+ */ updateDialogPositionCallback = this._updateDialogPosition.bind(this);
436
+ /**
437
+ * If dialog is open, adjust its positioning.
438
+ */ _updateDialogPosition(_evt, _name, isOpen) {
439
+ if (isOpen) {
440
+ this._setNewDialogPosition();
441
+ }
442
+ }
443
+ /**
444
+ * Adjusts the dialog position to utilize the empty space on the right side of the editable.
445
+ * The new dialog position should be on the right side of the fullscreen view with a 30px margin.
446
+ * Only dialogs with the position set to "editor-top-side" should have their position changed.
447
+ */ _setNewDialogPosition() {
448
+ const dialog = this._editor.plugins.get('Dialog');
449
+ const dialogView = dialog.view;
450
+ if (!dialogView || dialogView.position !== DialogViewPosition.EDITOR_TOP_SIDE) {
451
+ return;
452
+ }
453
+ const fullscreenViewContainerRect = new Rect(this._wrapper).getVisible();
454
+ const editorContainerRect = new Rect(document.querySelector('.ck-fullscreen__editable')).getVisible();
455
+ const dialogRect = new Rect(dialogView.element.querySelector('.ck-dialog')).getVisible();
456
+ const scrollOffset = new Rect(document.querySelector('.ck-fullscreen__editable-wrapper')).excludeScrollbarsAndBorders().getVisible().width - new Rect(document.querySelector('.ck-fullscreen__editable-wrapper')).getVisible().width;
457
+ if (fullscreenViewContainerRect && editorContainerRect && dialogRect) {
458
+ dialogView.position = null;
459
+ dialogView.moveTo(fullscreenViewContainerRect.left + fullscreenViewContainerRect.width - dialogRect.width - DIALOG_OFFSET + scrollOffset, editorContainerRect.top);
460
+ }
461
+ }
462
+ }
463
+
464
+ /**
465
+ * The classic editor fullscreen mode handler.
466
+ */ class ClassicEditorHandler extends AbstractEditorHandler {
467
+ /**
468
+ * An editor instance.
469
+ */ _editor;
470
+ /**
471
+ * @inheritDoc
472
+ */ constructor(editor){
473
+ super(editor);
474
+ this._editor = editor;
475
+ }
476
+ /**
477
+ * A function that moves the editor UI elements to the fullscreen mode.
478
+ */ _defaultOnEnter() {
479
+ const editorUI = this._editor.ui;
480
+ const editorUIView = editorUI.view;
481
+ /* istanbul ignore if -- @preserve */ if (this._editor.plugins.has('Pagination')) {
482
+ this.moveToFullscreen(editorUI.getEditableElement().parentElement.querySelector('.ck-pagination-view'), 'pagination-view');
483
+ }
484
+ this.moveToFullscreen(editorUI.getEditableElement(), 'editable');
485
+ this.moveToFullscreen(editorUIView.toolbar.element, 'toolbar');
486
+ editorUIView.toolbar.switchBehavior(this._editor.config.get('fullscreen.toolbar.shouldNotGroupWhenFull') === true ? 'static' : 'dynamic');
487
+ // In classic editor, the `dir` attribute is set on the top-level container and it affects the styling
488
+ // in both menu bar and toolbar (adding the side padding to the elements).
489
+ // Since we don't move the whole container but only parts, we need to reapply the attribute value manually.
490
+ // Decupled editor doesn't have this issue because there is no top-level container,
491
+ // so `dir` is set on each component separately.
492
+ this.getWrapper().setAttribute('dir', editorUIView.element.getAttribute('dir'));
493
+ if (this._editor.config.get('fullscreen.menuBar.isVisible')) {
494
+ if (!editorUIView.menuBarView) {
495
+ editorUIView.menuBarView = new MenuBarView(this._editor.locale);
496
+ editorUIView.menuBarView.render();
497
+ editorUI.initMenuBar(editorUIView.menuBarView);
498
+ }
499
+ this.moveToFullscreen(editorUIView.menuBarView.element, 'menu-bar');
500
+ }
501
+ return this.getWrapper();
502
+ }
503
+ }
504
+
505
+ /**
506
+ * The decoupled editor fullscreen mode handler.
507
+ */ class DecoupledEditorHandler extends AbstractEditorHandler {
508
+ /**
509
+ * An editor instance.
510
+ */ _editor;
511
+ /**
512
+ * @inheritDoc
513
+ */ constructor(editor){
514
+ super(editor);
515
+ this._editor = editor;
516
+ }
517
+ /**
518
+ * A function that moves the editor UI elements to the fullscreen mode.
519
+ */ _defaultOnEnter() {
520
+ /* istanbul ignore if -- @preserve */ if (this._editor.plugins.has('Pagination')) {
521
+ this.moveToFullscreen(this._editor.ui.getEditableElement().parentElement.querySelector('.ck-pagination-view'), 'pagination-view');
522
+ }
523
+ this.moveToFullscreen(this._editor.ui.getEditableElement(), 'editable');
524
+ this.moveToFullscreen(this._editor.ui.view.toolbar.element, 'toolbar');
525
+ this._editor.ui.view.toolbar.switchBehavior(this._editor.config.get('fullscreen.toolbar.shouldNotGroupWhenFull') === true ? 'static' : 'dynamic');
526
+ if (this._editor.config.get('fullscreen.menuBar.isVisible')) {
527
+ this.moveToFullscreen(this._editor.ui.view.menuBarView.element, 'menu-bar');
528
+ }
529
+ return this.getWrapper();
530
+ }
531
+ }
532
+
533
+ /**
534
+ * A command toggling the fullscreen mode.
535
+ */ class FullscreenCommand extends Command {
536
+ /**
537
+ * Specialized class handling the fullscreen mode toggling for a specific editor type.
538
+ */ _fullscreenHandler;
539
+ /**
540
+ * @inheritDoc
541
+ */ constructor(editor){
542
+ super(editor);
543
+ this.affectsData = false;
544
+ this.isEnabled = true;
545
+ this.value = false;
546
+ // Choose the appropriate handler based on the editor type.
547
+ // Currently only ClassicEditor and DecoupledEditor are supported. For other editor types, the abstract handler is used
548
+ // which will throw if user tries to enable the fullscreen mode.
549
+ if (editor instanceof ClassicEditor) {
550
+ this._fullscreenHandler = new ClassicEditorHandler(editor);
551
+ } else if (editor instanceof DecoupledEditor) {
552
+ this._fullscreenHandler = new DecoupledEditorHandler(editor);
553
+ } else {
554
+ this._fullscreenHandler = new AbstractEditorHandler(editor);
555
+ }
556
+ }
557
+ /**
558
+ * Toggles the fullscreen mode.
559
+ */ execute() {
560
+ if (this.value) {
561
+ this._disableFullscreenMode();
562
+ } else {
563
+ this._enableFullscreenMode();
564
+ }
565
+ }
566
+ /**
567
+ * Enables the fullscreen mode.
568
+ */ _enableFullscreenMode() {
569
+ this._fullscreenHandler.enable();
570
+ this.value = true;
571
+ }
572
+ /**
573
+ * Disables the fullscreen mode.
574
+ */ _disableFullscreenMode() {
575
+ this._fullscreenHandler.disable();
576
+ this.value = false;
577
+ }
578
+ }
579
+
580
+ /**
581
+ * A plugin that registers the fullscreen mode command.
582
+ */ class FullscreenEditing extends Plugin {
583
+ /**
584
+ * @inheritDoc
585
+ */ static get pluginName() {
586
+ return 'FullscreenEditing';
587
+ }
588
+ /**
589
+ * @inheritDoc
590
+ */ static get isOfficialPlugin() {
591
+ return true;
592
+ }
593
+ /**
594
+ * @inheritDoc
595
+ */ constructor(editor){
596
+ super(editor);
597
+ editor.config.define('fullscreen.menuBar.isVisible', true);
598
+ // By default, toolbar should behave the same way in fullscreen mode as in normal mode.
599
+ // This means that the toolbar buttons should be grouped when the toolbar is full.
600
+ editor.config.define('fullscreen.toolbar.shouldNotGroupWhenFull', editor.config.get('toolbar.shouldNotGroupWhenFull') === true);
601
+ }
602
+ /**
603
+ * @inheritDoc
604
+ */ init() {
605
+ this.editor.commands.add('toggleFullscreen', new FullscreenCommand(this.editor));
606
+ const t = this.editor.locale.t;
607
+ // Set the Ctrl+Shift+F keystroke.
608
+ this.editor.keystrokes.set('Ctrl+Shift+F', (evt, cancel)=>{
609
+ this.editor.execute('toggleFullscreen');
610
+ this.editor.editing.view.focus();
611
+ cancel();
612
+ });
613
+ // Add the information about the keystroke to the accessibility database.
614
+ this.editor.accessibility.addKeystrokeInfos({
615
+ keystrokes: [
616
+ {
617
+ label: t('Toggle fullscreen mode'),
618
+ keystroke: 'CTRL+SHIFT+F'
619
+ }
620
+ ],
621
+ categoryId: 'navigation'
622
+ });
623
+ }
624
+ }
625
+
626
+ const COMMAND_NAME = 'toggleFullscreen';
627
+ /**
628
+ * A plugin registering the fullscreen mode buttons.
629
+ */ class FullscreenUI extends Plugin {
630
+ /**
631
+ * @inheritDoc
632
+ */ static get requires() {
633
+ return [
634
+ FullscreenEditing
635
+ ];
636
+ }
637
+ /**
638
+ * @inheritDoc
639
+ */ static get pluginName() {
640
+ return 'FullscreenUI';
641
+ }
642
+ /**
643
+ * @inheritDoc
644
+ */ static get isOfficialPlugin() {
645
+ return true;
646
+ }
647
+ /**
648
+ * @inheritDoc
649
+ */ init() {
650
+ const editor = this.editor;
651
+ editor.ui.componentFactory.add('fullscreen', ()=>this._createButton(ButtonView));
652
+ editor.ui.componentFactory.add('menuBar:fullscreen', ()=>this._createButton(MenuBarMenuListItemButtonView));
653
+ }
654
+ /**
655
+ * Creates a button that toggles the fullscreen mode.
656
+ */ _createButton(ButtonClass) {
657
+ const editor = this.editor;
658
+ const t = editor.t;
659
+ const command = editor.commands.get(COMMAND_NAME);
660
+ const view = new ButtonClass(editor.locale);
661
+ view.set({
662
+ isToggleable: true
663
+ });
664
+ view.bind('isEnabled').to(command, 'isEnabled');
665
+ view.bind('isOn').to(command, 'value');
666
+ if (view instanceof MenuBarMenuListItemButtonView) {
667
+ view.set({
668
+ role: 'menuitemcheckbox',
669
+ label: t('Fullscreen mode')
670
+ });
671
+ } else {
672
+ view.bind('icon').to(command, 'value', (value)=>value ? IconFullscreenLeave : IconFullscreenEnter);
673
+ view.bind('label').to(command, 'value', (value)=>value ? t('Leave fullscreen mode') : t('Enter fullscreen mode'));
674
+ view.set({
675
+ tooltip: true
676
+ });
677
+ }
678
+ this.listenTo(view, 'execute', ()=>{
679
+ editor.execute(COMMAND_NAME);
680
+ editor.editing.view.focus();
681
+ });
682
+ return view;
683
+ }
684
+ }
685
+
686
+ /**
687
+ * The fullscreen mode feature.
688
+ */ class Fullscreen extends Plugin {
689
+ /**
690
+ * @inheritDoc
691
+ */ static get requires() {
692
+ return [
693
+ FullscreenEditing,
694
+ FullscreenUI
695
+ ];
696
+ }
697
+ /**
698
+ * @inheritDoc
699
+ */ static get pluginName() {
700
+ return 'Fullscreen';
701
+ }
702
+ /**
703
+ * @inheritDoc
704
+ */ static get isOfficialPlugin() {
705
+ return true;
706
+ }
707
+ }
708
+
709
+ export { Fullscreen, FullscreenEditing, FullscreenUI };
710
+ //# sourceMappingURL=index.js.map