@ckeditor/ckeditor5-fullscreen 45.0.0 → 45.1.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 (309) hide show
  1. package/build/fullscreen.js +2 -2
  2. package/build/translations/af.js +1 -1
  3. package/build/translations/ar.js +1 -1
  4. package/build/translations/ast.js +1 -1
  5. package/build/translations/az.js +1 -1
  6. package/build/translations/be.js +1 -1
  7. package/build/translations/bg.js +1 -1
  8. package/build/translations/bn.js +1 -1
  9. package/build/translations/bs.js +1 -1
  10. package/build/translations/ca.js +1 -1
  11. package/build/translations/cs.js +1 -1
  12. package/build/translations/da.js +1 -1
  13. package/build/translations/de-ch.js +1 -1
  14. package/build/translations/de.js +1 -1
  15. package/build/translations/el.js +1 -1
  16. package/build/translations/en-au.js +1 -1
  17. package/build/translations/en-gb.js +1 -1
  18. package/build/translations/eo.js +1 -1
  19. package/build/translations/es-co.js +1 -1
  20. package/build/translations/es.js +1 -1
  21. package/build/translations/et.js +1 -1
  22. package/build/translations/eu.js +1 -1
  23. package/build/translations/fa.js +1 -1
  24. package/build/translations/fi.js +1 -1
  25. package/build/translations/fr.js +1 -1
  26. package/build/translations/gl.js +1 -1
  27. package/build/translations/gu.js +1 -1
  28. package/build/translations/he.js +1 -1
  29. package/build/translations/hi.js +1 -1
  30. package/build/translations/hr.js +1 -1
  31. package/build/translations/hu.js +1 -1
  32. package/build/translations/hy.js +1 -1
  33. package/build/translations/id.js +1 -1
  34. package/build/translations/it.js +1 -1
  35. package/build/translations/ja.js +1 -1
  36. package/build/translations/jv.js +1 -1
  37. package/build/translations/kk.js +1 -1
  38. package/build/translations/km.js +1 -1
  39. package/build/translations/kn.js +1 -1
  40. package/build/translations/ko.js +1 -1
  41. package/build/translations/ku.js +1 -1
  42. package/build/translations/lt.js +1 -1
  43. package/build/translations/lv.js +1 -1
  44. package/build/translations/ms.js +1 -1
  45. package/build/translations/nb.js +1 -1
  46. package/build/translations/ne.js +1 -1
  47. package/build/translations/nl.js +1 -1
  48. package/build/translations/no.js +1 -1
  49. package/build/translations/oc.js +1 -1
  50. package/build/translations/pl.js +1 -1
  51. package/build/translations/pt-br.js +1 -1
  52. package/build/translations/pt.js +1 -1
  53. package/build/translations/ro.js +1 -1
  54. package/build/translations/ru.js +1 -1
  55. package/build/translations/si.js +1 -1
  56. package/build/translations/sk.js +1 -1
  57. package/build/translations/sl.js +1 -1
  58. package/build/translations/sq.js +1 -1
  59. package/build/translations/sr-latn.js +1 -1
  60. package/build/translations/sr.js +1 -1
  61. package/build/translations/sv.js +1 -1
  62. package/build/translations/th.js +1 -1
  63. package/build/translations/ti.js +1 -1
  64. package/build/translations/tk.js +1 -1
  65. package/build/translations/tr.js +1 -1
  66. package/build/translations/tt.js +1 -1
  67. package/build/translations/ug.js +1 -1
  68. package/build/translations/uk.js +1 -1
  69. package/build/translations/ur.js +1 -1
  70. package/build/translations/uz.js +1 -1
  71. package/build/translations/vi.js +1 -1
  72. package/build/translations/zh-cn.js +1 -1
  73. package/build/translations/zh.js +1 -1
  74. package/dist/index-editor.css +2 -1
  75. package/dist/index.css +3 -2
  76. package/dist/index.css.map +1 -1
  77. package/dist/index.js +111 -23
  78. package/dist/index.js.map +1 -1
  79. package/dist/translations/af.js +1 -1
  80. package/dist/translations/af.umd.js +1 -1
  81. package/dist/translations/ar.js +1 -1
  82. package/dist/translations/ar.umd.js +1 -1
  83. package/dist/translations/ast.js +1 -1
  84. package/dist/translations/ast.umd.js +1 -1
  85. package/dist/translations/az.js +1 -1
  86. package/dist/translations/az.umd.js +1 -1
  87. package/dist/translations/be.js +1 -1
  88. package/dist/translations/be.umd.js +1 -1
  89. package/dist/translations/bg.js +1 -1
  90. package/dist/translations/bg.umd.js +1 -1
  91. package/dist/translations/bn.js +1 -1
  92. package/dist/translations/bn.umd.js +1 -1
  93. package/dist/translations/bs.js +1 -1
  94. package/dist/translations/bs.umd.js +1 -1
  95. package/dist/translations/ca.js +1 -1
  96. package/dist/translations/ca.umd.js +1 -1
  97. package/dist/translations/cs.js +1 -1
  98. package/dist/translations/cs.umd.js +1 -1
  99. package/dist/translations/da.js +1 -1
  100. package/dist/translations/da.umd.js +1 -1
  101. package/dist/translations/de-ch.js +1 -1
  102. package/dist/translations/de-ch.umd.js +1 -1
  103. package/dist/translations/de.js +1 -1
  104. package/dist/translations/de.umd.js +1 -1
  105. package/dist/translations/el.js +1 -1
  106. package/dist/translations/el.umd.js +1 -1
  107. package/dist/translations/en-au.js +1 -1
  108. package/dist/translations/en-au.umd.js +1 -1
  109. package/dist/translations/en-gb.js +1 -1
  110. package/dist/translations/en-gb.umd.js +1 -1
  111. package/dist/translations/en.js +1 -1
  112. package/dist/translations/en.umd.js +1 -1
  113. package/dist/translations/eo.js +1 -1
  114. package/dist/translations/eo.umd.js +1 -1
  115. package/dist/translations/es-co.js +1 -1
  116. package/dist/translations/es-co.umd.js +1 -1
  117. package/dist/translations/es.js +1 -1
  118. package/dist/translations/es.umd.js +1 -1
  119. package/dist/translations/et.js +1 -1
  120. package/dist/translations/et.umd.js +1 -1
  121. package/dist/translations/eu.js +1 -1
  122. package/dist/translations/eu.umd.js +1 -1
  123. package/dist/translations/fa.js +1 -1
  124. package/dist/translations/fa.umd.js +1 -1
  125. package/dist/translations/fi.js +1 -1
  126. package/dist/translations/fi.umd.js +1 -1
  127. package/dist/translations/fr.js +1 -1
  128. package/dist/translations/fr.umd.js +1 -1
  129. package/dist/translations/gl.js +1 -1
  130. package/dist/translations/gl.umd.js +1 -1
  131. package/dist/translations/gu.js +1 -1
  132. package/dist/translations/gu.umd.js +1 -1
  133. package/dist/translations/he.js +1 -1
  134. package/dist/translations/he.umd.js +1 -1
  135. package/dist/translations/hi.js +1 -1
  136. package/dist/translations/hi.umd.js +1 -1
  137. package/dist/translations/hr.js +1 -1
  138. package/dist/translations/hr.umd.js +1 -1
  139. package/dist/translations/hu.js +1 -1
  140. package/dist/translations/hu.umd.js +1 -1
  141. package/dist/translations/hy.js +1 -1
  142. package/dist/translations/hy.umd.js +1 -1
  143. package/dist/translations/id.js +1 -1
  144. package/dist/translations/id.umd.js +1 -1
  145. package/dist/translations/it.js +1 -1
  146. package/dist/translations/it.umd.js +1 -1
  147. package/dist/translations/ja.js +1 -1
  148. package/dist/translations/ja.umd.js +1 -1
  149. package/dist/translations/jv.js +1 -1
  150. package/dist/translations/jv.umd.js +1 -1
  151. package/dist/translations/kk.js +1 -1
  152. package/dist/translations/kk.umd.js +1 -1
  153. package/dist/translations/km.js +1 -1
  154. package/dist/translations/km.umd.js +1 -1
  155. package/dist/translations/kn.js +1 -1
  156. package/dist/translations/kn.umd.js +1 -1
  157. package/dist/translations/ko.js +1 -1
  158. package/dist/translations/ko.umd.js +1 -1
  159. package/dist/translations/ku.js +1 -1
  160. package/dist/translations/ku.umd.js +1 -1
  161. package/dist/translations/lt.js +1 -1
  162. package/dist/translations/lt.umd.js +1 -1
  163. package/dist/translations/lv.js +1 -1
  164. package/dist/translations/lv.umd.js +1 -1
  165. package/dist/translations/ms.js +1 -1
  166. package/dist/translations/ms.umd.js +1 -1
  167. package/dist/translations/nb.js +1 -1
  168. package/dist/translations/nb.umd.js +1 -1
  169. package/dist/translations/ne.js +1 -1
  170. package/dist/translations/ne.umd.js +1 -1
  171. package/dist/translations/nl.js +1 -1
  172. package/dist/translations/nl.umd.js +1 -1
  173. package/dist/translations/no.js +1 -1
  174. package/dist/translations/no.umd.js +1 -1
  175. package/dist/translations/oc.js +1 -1
  176. package/dist/translations/oc.umd.js +1 -1
  177. package/dist/translations/pl.js +1 -1
  178. package/dist/translations/pl.umd.js +1 -1
  179. package/dist/translations/pt-br.js +1 -1
  180. package/dist/translations/pt-br.umd.js +1 -1
  181. package/dist/translations/pt.js +1 -1
  182. package/dist/translations/pt.umd.js +1 -1
  183. package/dist/translations/ro.js +1 -1
  184. package/dist/translations/ro.umd.js +1 -1
  185. package/dist/translations/ru.js +1 -1
  186. package/dist/translations/ru.umd.js +1 -1
  187. package/dist/translations/si.js +1 -1
  188. package/dist/translations/si.umd.js +1 -1
  189. package/dist/translations/sk.js +1 -1
  190. package/dist/translations/sk.umd.js +1 -1
  191. package/dist/translations/sl.js +1 -1
  192. package/dist/translations/sl.umd.js +1 -1
  193. package/dist/translations/sq.js +1 -1
  194. package/dist/translations/sq.umd.js +1 -1
  195. package/dist/translations/sr-latn.js +1 -1
  196. package/dist/translations/sr-latn.umd.js +1 -1
  197. package/dist/translations/sr.js +1 -1
  198. package/dist/translations/sr.umd.js +1 -1
  199. package/dist/translations/sv.js +1 -1
  200. package/dist/translations/sv.umd.js +1 -1
  201. package/dist/translations/th.js +1 -1
  202. package/dist/translations/th.umd.js +1 -1
  203. package/dist/translations/ti.js +1 -1
  204. package/dist/translations/ti.umd.js +1 -1
  205. package/dist/translations/tk.js +1 -1
  206. package/dist/translations/tk.umd.js +1 -1
  207. package/dist/translations/tr.js +1 -1
  208. package/dist/translations/tr.umd.js +1 -1
  209. package/dist/translations/tt.js +1 -1
  210. package/dist/translations/tt.umd.js +1 -1
  211. package/dist/translations/ug.js +1 -1
  212. package/dist/translations/ug.umd.js +1 -1
  213. package/dist/translations/uk.js +1 -1
  214. package/dist/translations/uk.umd.js +1 -1
  215. package/dist/translations/ur.js +1 -1
  216. package/dist/translations/ur.umd.js +1 -1
  217. package/dist/translations/uz.js +1 -1
  218. package/dist/translations/uz.umd.js +1 -1
  219. package/dist/translations/vi.js +1 -1
  220. package/dist/translations/vi.umd.js +1 -1
  221. package/dist/translations/zh-cn.js +1 -1
  222. package/dist/translations/zh-cn.umd.js +1 -1
  223. package/dist/translations/zh.js +1 -1
  224. package/dist/translations/zh.umd.js +1 -1
  225. package/lang/translations/af.po +8 -0
  226. package/lang/translations/ar.po +8 -0
  227. package/lang/translations/ast.po +8 -0
  228. package/lang/translations/az.po +8 -0
  229. package/lang/translations/be.po +8 -0
  230. package/lang/translations/bg.po +8 -0
  231. package/lang/translations/bn.po +8 -0
  232. package/lang/translations/bs.po +8 -0
  233. package/lang/translations/ca.po +8 -0
  234. package/lang/translations/cs.po +8 -0
  235. package/lang/translations/da.po +8 -0
  236. package/lang/translations/de-ch.po +8 -0
  237. package/lang/translations/de.po +8 -0
  238. package/lang/translations/el.po +8 -0
  239. package/lang/translations/en-au.po +8 -0
  240. package/lang/translations/en-gb.po +8 -0
  241. package/lang/translations/en.po +8 -0
  242. package/lang/translations/eo.po +8 -0
  243. package/lang/translations/es-co.po +8 -0
  244. package/lang/translations/es.po +8 -0
  245. package/lang/translations/et.po +8 -0
  246. package/lang/translations/eu.po +8 -0
  247. package/lang/translations/fa.po +8 -0
  248. package/lang/translations/fi.po +8 -0
  249. package/lang/translations/fr.po +8 -0
  250. package/lang/translations/gl.po +8 -0
  251. package/lang/translations/gu.po +8 -0
  252. package/lang/translations/he.po +8 -0
  253. package/lang/translations/hi.po +8 -0
  254. package/lang/translations/hr.po +8 -0
  255. package/lang/translations/hu.po +8 -0
  256. package/lang/translations/hy.po +8 -0
  257. package/lang/translations/id.po +8 -0
  258. package/lang/translations/it.po +8 -0
  259. package/lang/translations/ja.po +8 -0
  260. package/lang/translations/jv.po +8 -0
  261. package/lang/translations/kk.po +8 -0
  262. package/lang/translations/km.po +8 -0
  263. package/lang/translations/kn.po +8 -0
  264. package/lang/translations/ko.po +8 -0
  265. package/lang/translations/ku.po +8 -0
  266. package/lang/translations/lt.po +8 -0
  267. package/lang/translations/lv.po +8 -0
  268. package/lang/translations/ms.po +8 -0
  269. package/lang/translations/nb.po +8 -0
  270. package/lang/translations/ne.po +8 -0
  271. package/lang/translations/nl.po +8 -0
  272. package/lang/translations/no.po +8 -0
  273. package/lang/translations/oc.po +8 -0
  274. package/lang/translations/pl.po +8 -0
  275. package/lang/translations/pt-br.po +8 -0
  276. package/lang/translations/pt.po +8 -0
  277. package/lang/translations/ro.po +8 -0
  278. package/lang/translations/ru.po +8 -0
  279. package/lang/translations/si.po +8 -0
  280. package/lang/translations/sk.po +8 -0
  281. package/lang/translations/sl.po +8 -0
  282. package/lang/translations/sq.po +8 -0
  283. package/lang/translations/sr-latn.po +8 -0
  284. package/lang/translations/sr.po +8 -0
  285. package/lang/translations/sv.po +8 -0
  286. package/lang/translations/th.po +8 -0
  287. package/lang/translations/ti.po +8 -0
  288. package/lang/translations/tk.po +8 -0
  289. package/lang/translations/tr.po +8 -0
  290. package/lang/translations/tt.po +8 -0
  291. package/lang/translations/ug.po +8 -0
  292. package/lang/translations/uk.po +8 -0
  293. package/lang/translations/ur.po +8 -0
  294. package/lang/translations/uz.po +8 -0
  295. package/lang/translations/vi.po +8 -0
  296. package/lang/translations/zh-cn.po +8 -0
  297. package/lang/translations/zh.po +8 -0
  298. package/package.json +8 -13
  299. package/src/fullscreencommand.d.ts +15 -1
  300. package/src/fullscreencommand.js +35 -12
  301. package/src/handlers/abstracteditorhandler.d.ts +61 -5
  302. package/src/handlers/abstracteditorhandler.js +72 -9
  303. package/src/handlers/classiceditorhandler.d.ts +1 -1
  304. package/src/handlers/classiceditorhandler.js +1 -1
  305. package/src/handlers/decouplededitorhandler.d.ts +1 -1
  306. package/src/handlers/decouplededitorhandler.js +1 -1
  307. package/src/index.d.ts +1 -0
  308. package/src/index.js +1 -0
  309. package/theme/fullscreen.css +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-fullscreen",
3
- "version": "45.0.0",
3
+ "version": "45.1.0-alpha.1",
4
4
  "description": "Fullscreen mode feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,18 +13,13 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "@ckeditor/ckeditor5-comments": "45.0.0",
17
- "@ckeditor/ckeditor5-core": "45.0.0",
18
- "@ckeditor/ckeditor5-document-outline": "45.0.0",
19
- "@ckeditor/ckeditor5-editor-classic": "45.0.0",
20
- "@ckeditor/ckeditor5-editor-decoupled": "45.0.0",
21
- "@ckeditor/ckeditor5-icons": "45.0.0",
22
- "@ckeditor/ckeditor5-pagination": "45.0.0",
23
- "@ckeditor/ckeditor5-real-time-collaboration": "45.0.0",
24
- "@ckeditor/ckeditor5-revision-history": "45.0.0",
25
- "@ckeditor/ckeditor5-ui": "45.0.0",
26
- "@ckeditor/ckeditor5-utils": "45.0.0",
27
- "ckeditor5": "45.0.0"
16
+ "@ckeditor/ckeditor5-core": "45.1.0-alpha.1",
17
+ "@ckeditor/ckeditor5-editor-classic": "45.1.0-alpha.1",
18
+ "@ckeditor/ckeditor5-editor-decoupled": "45.1.0-alpha.1",
19
+ "@ckeditor/ckeditor5-icons": "45.1.0-alpha.1",
20
+ "@ckeditor/ckeditor5-ui": "45.1.0-alpha.1",
21
+ "@ckeditor/ckeditor5-utils": "45.1.0-alpha.1",
22
+ "ckeditor5": "45.1.0-alpha.1"
28
23
  },
29
24
  "author": "CKSource (http://cksource.com/)",
30
25
  "license": "SEE LICENSE IN LICENSE.md",
@@ -6,6 +6,7 @@
6
6
  * @module fullscreen/fullscreencommand
7
7
  */
8
8
  import { Command, type Editor } from 'ckeditor5/src/core.js';
9
+ import AbstractEditorHandler from './handlers/abstracteditorhandler.js';
9
10
  /**
10
11
  * A command toggling the fullscreen mode.
11
12
  */
@@ -19,8 +20,21 @@ export default class FullscreenCommand extends Command {
19
20
  value: boolean;
20
21
  /**
21
22
  * Specialized class handling the fullscreen mode toggling for a specific editor type.
23
+ *
24
+ * If you want to add support for a new editor type (for now, only Classic and Decoupled editors are handled),
25
+ * create a custom handler that extends `AbstractEditorHandler` and replace `fullscreenHandler` with it after editor initialization:
26
+ *
27
+ * ```ts
28
+ * // See the details of how to implement a custom handler in the `AbstractEditorHandler` class API docs.
29
+ * class CustomEditorHandler extends AbstractEditorHandler {}
30
+ *
31
+ * CustomEditorClass.create( document.querySelector( '#editor' ), {} )
32
+ * .then( ( editor ) => {
33
+ * editor.commands.get( 'toggleFullscreen' ).fullscreenHandler = new CustomEditorHandler( editor );
34
+ * } );
35
+ * ```
22
36
  */
23
- private _fullscreenHandler;
37
+ fullscreenHandler: AbstractEditorHandler;
24
38
  /**
25
39
  * @inheritDoc
26
40
  */
@@ -6,8 +6,6 @@
6
6
  * @module fullscreen/fullscreencommand
7
7
  */
8
8
  import { Command } from 'ckeditor5/src/core.js';
9
- import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic';
10
- import { DecoupledEditor } from '@ckeditor/ckeditor5-editor-decoupled';
11
9
  import AbstractEditorHandler from './handlers/abstracteditorhandler.js';
12
10
  import ClassicEditorHandler from './handlers/classiceditorhandler.js';
13
11
  import DecoupledEditorHandler from './handlers/decouplededitorhandler.js';
@@ -17,8 +15,21 @@ import DecoupledEditorHandler from './handlers/decouplededitorhandler.js';
17
15
  export default class FullscreenCommand extends Command {
18
16
  /**
19
17
  * Specialized class handling the fullscreen mode toggling for a specific editor type.
18
+ *
19
+ * If you want to add support for a new editor type (for now, only Classic and Decoupled editors are handled),
20
+ * create a custom handler that extends `AbstractEditorHandler` and replace `fullscreenHandler` with it after editor initialization:
21
+ *
22
+ * ```ts
23
+ * // See the details of how to implement a custom handler in the `AbstractEditorHandler` class API docs.
24
+ * class CustomEditorHandler extends AbstractEditorHandler {}
25
+ *
26
+ * CustomEditorClass.create( document.querySelector( '#editor' ), {} )
27
+ * .then( ( editor ) => {
28
+ * editor.commands.get( 'toggleFullscreen' ).fullscreenHandler = new CustomEditorHandler( editor );
29
+ * } );
30
+ * ```
20
31
  */
21
- _fullscreenHandler;
32
+ fullscreenHandler;
22
33
  /**
23
34
  * @inheritDoc
24
35
  */
@@ -28,16 +39,16 @@ export default class FullscreenCommand extends Command {
28
39
  this.isEnabled = true;
29
40
  this.value = false;
30
41
  // Choose the appropriate handler based on the editor type.
31
- // Currently only ClassicEditor and DecoupledEditor are supported. For other editor types, the abstract handler is used
32
- // which will throw if user tries to enable the fullscreen mode.
33
- if (editor instanceof ClassicEditor) {
34
- this._fullscreenHandler = new ClassicEditorHandler(editor);
42
+ // Currently only `ClassicEditor` and `DecoupledEditor` are supported. For other editor types, you should create a custom handler
43
+ // that extends `AbstractEditorHandler` and replace `fullscreenHandler` with it.
44
+ if (isClassicEditor(editor)) {
45
+ this.fullscreenHandler = new ClassicEditorHandler(editor);
35
46
  }
36
- else if (editor instanceof DecoupledEditor) {
37
- this._fullscreenHandler = new DecoupledEditorHandler(editor);
47
+ else if (isDecoupledEditor(editor)) {
48
+ this.fullscreenHandler = new DecoupledEditorHandler(editor);
38
49
  }
39
50
  else {
40
- this._fullscreenHandler = new AbstractEditorHandler(editor);
51
+ this.fullscreenHandler = new AbstractEditorHandler(editor);
41
52
  }
42
53
  }
43
54
  /**
@@ -55,14 +66,26 @@ export default class FullscreenCommand extends Command {
55
66
  * Enables the fullscreen mode.
56
67
  */
57
68
  _enableFullscreenMode() {
58
- this._fullscreenHandler.enable();
69
+ this.fullscreenHandler.enable();
59
70
  this.value = true;
60
71
  }
61
72
  /**
62
73
  * Disables the fullscreen mode.
63
74
  */
64
75
  _disableFullscreenMode() {
65
- this._fullscreenHandler.disable();
76
+ this.fullscreenHandler.disable();
66
77
  this.value = false;
67
78
  }
68
79
  }
80
+ /**
81
+ * Classic editor typeguard.
82
+ */
83
+ function isClassicEditor(editor) {
84
+ return editor.constructor.editorName === 'ClassicEditor';
85
+ }
86
+ /**
87
+ * Decoupled editor typeguard.
88
+ */
89
+ function isDecoupledEditor(editor) {
90
+ return editor.constructor.editorName === 'DecoupledEditor';
91
+ }
@@ -4,9 +4,65 @@
4
4
  */
5
5
  import { type EventInfo } from 'ckeditor5/src/utils.js';
6
6
  import type { ElementApi, Editor, EditorConfig } from 'ckeditor5/src/core.js';
7
- import type { RevisionViewerEditor } from '@ckeditor/ckeditor5-revision-history';
8
7
  /**
9
- * The abstract editor type handler. It should be extended by the particular editor type handler.
8
+ * The abstract editor type handler.
9
+ *
10
+ * This class defines some actions and behaviors that are applied when fullscreen mode is toggled, and which are common
11
+ * regardless of the editor type. Then, specific classes like `ClassicEditorHandler` or `DecoupledEditorHandler`
12
+ * extend this class with actions specific for these editor types.
13
+ *
14
+ * Extend this class to provide fullscreen mode handling for unsupported editor types,
15
+ * or if you wish to heavily customize the default behavior.
16
+ *
17
+ * The only method that is necessary to provide when extending this class is {@link #defaultOnEnter}. However, make sure to
18
+ * familiarize yourself with the below full list of actions taken by `AbstractEditorHandler` to understand what is covered by default,
19
+ * and what should be provided by you.
20
+ *
21
+ * When entering the fullscreen mode, the {@link #enable} method is called. It creates the properly styled container
22
+ * and handles the editor features that need it, in the following order:
23
+ *
24
+ * 1. Saves the scroll positions of all ancestors of the editable element to restore them after leaving the fullscreen mode.
25
+ * 2. Executes the {@link #defaultOnEnter} method to move the proper editor UI elements to the fullscreen mode.
26
+ * **If you extend the abstract handler, you should override this method** to move the elements that are specific to your editor type, like:
27
+ * editable, toolbar, menu bar.
28
+ * Use {@link #moveToFullscreen} method for this purpose to ensure they are automatically cleaned up after leaving the fullscreen mode.
29
+ * 3. Adds proper classes to the `<body>` and `<html>` elements to block page scrolling, adjust `z-index` etc.
30
+ * 4. Changes the position of some dialogs to utilize the empty space on the right side of the editable element.
31
+ *
32
+ * Steps 5-11 are only executed if the corresponding features are used.
33
+ *
34
+ * 5. If presence list is used, moves it to the fullscreen mode container.
35
+ * 6. If document outline is used, moves it to the fullscreen mode.
36
+ * 7. If pagination is used, adjusts it's configuration for the changed view.
37
+ * 8. If annotations are used, moves them to the fullscreen mode.
38
+ * 9. If revision history is used, overrides the callbacks to show the revision viewer in the fullscreen mode.
39
+ * 10. If source editing and document outline are both used, hides the document outline header.
40
+ * 11. If custom container is used, hides all other elements in it to ensure they don't create an empty unscrollable space.
41
+ *
42
+ * Then finally:
43
+ *
44
+ * 12. Executes the configured {@link module:fullscreen/fullscreenconfig~FullscreenConfig#onEnterCallback
45
+ * `config.fullscreen.onEnterCallback`} function.
46
+ * By default, it returns the fullscreen mode container element so it can be further customized.
47
+ *
48
+ * When leaving the fullscreen mode, the {@link #disable} method is called. It does the following:
49
+ *
50
+ * 1. Execute the configured {@link module:fullscreen/fullscreenconfig~FullscreenConfig#onLeaveCallback
51
+ * `config.fullscreen.onLeaveCallback`} function.
52
+ * 2. Remove the classes added to the `<body>` and `<html>` elements.
53
+ * 3. If document outline is used, restore its default container.
54
+ * 4. If annotations are used, restore their original state (UI, filters etc).
55
+ * 5. If revision history is used, restore the original callbacks.
56
+ * 6. If source editing and document outline are both used, restore the document outline header.
57
+ * 7. Restore all moved elements to their original place.
58
+ * 8. Destroy the fullscreen mode container.
59
+ * 9. If the editor has a toolbar, switch its behavior to the one configured in the
60
+ * {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull} property.
61
+ * 10. Restore the scroll positions of all ancestors of the editable element.
62
+ * 11. If pagination is used, restore its default configuration.
63
+ * 12. Restore default dialogs positions.
64
+ *
65
+ * This class is exported to allow for custom extensions.
10
66
  */
11
67
  export default class AbstractEditorHandler {
12
68
  /**
@@ -48,11 +104,11 @@ export default class AbstractEditorHandler {
48
104
  /**
49
105
  * A callback that shows the revision viewer, stored to restore the original one after exiting the fullscreen mode.
50
106
  */
51
- protected _showRevisionViewerCallback: ((config?: EditorConfig) => Promise<RevisionViewerEditor | null>) | null;
107
+ protected _showRevisionViewerCallback: ((config?: EditorConfig) => Promise<any>) | null;
52
108
  /**
53
109
  * A callback that closes the revision viewer, stored to restore the original one after exiting the fullscreen mode.
54
110
  */
55
- protected _closeRevisionViewerCallback: ((viewerEditor?: RevisionViewerEditor) => Promise<unknown>) | null;
111
+ protected _closeRevisionViewerCallback: ((viewerEditor?: any) => Promise<unknown>) | null;
56
112
  /**
57
113
  * An editor instance. It should be set by the particular editor type handler.
58
114
  */
@@ -91,7 +147,7 @@ export default class AbstractEditorHandler {
91
147
  * Returns the fullscreen mode container element so it can be further customized via
92
148
  * `fullscreen.onEnterCallback` configuration property.
93
149
  */
94
- protected _defaultOnEnter(): HTMLElement;
150
+ defaultOnEnter(): HTMLElement;
95
151
  /**
96
152
  * Destroys the fullscreen mode container.
97
153
  */
@@ -9,7 +9,64 @@ import { BodyCollection, DialogViewPosition } from 'ckeditor5/src/ui.js';
9
9
  import { global, createElement, Rect } from 'ckeditor5/src/utils.js';
10
10
  const DIALOG_OFFSET = 28;
11
11
  /**
12
- * The abstract editor type handler. It should be extended by the particular editor type handler.
12
+ * The abstract editor type handler.
13
+ *
14
+ * This class defines some actions and behaviors that are applied when fullscreen mode is toggled, and which are common
15
+ * regardless of the editor type. Then, specific classes like `ClassicEditorHandler` or `DecoupledEditorHandler`
16
+ * extend this class with actions specific for these editor types.
17
+ *
18
+ * Extend this class to provide fullscreen mode handling for unsupported editor types,
19
+ * or if you wish to heavily customize the default behavior.
20
+ *
21
+ * The only method that is necessary to provide when extending this class is {@link #defaultOnEnter}. However, make sure to
22
+ * familiarize yourself with the below full list of actions taken by `AbstractEditorHandler` to understand what is covered by default,
23
+ * and what should be provided by you.
24
+ *
25
+ * When entering the fullscreen mode, the {@link #enable} method is called. It creates the properly styled container
26
+ * and handles the editor features that need it, in the following order:
27
+ *
28
+ * 1. Saves the scroll positions of all ancestors of the editable element to restore them after leaving the fullscreen mode.
29
+ * 2. Executes the {@link #defaultOnEnter} method to move the proper editor UI elements to the fullscreen mode.
30
+ * **If you extend the abstract handler, you should override this method** to move the elements that are specific to your editor type, like:
31
+ * editable, toolbar, menu bar.
32
+ * Use {@link #moveToFullscreen} method for this purpose to ensure they are automatically cleaned up after leaving the fullscreen mode.
33
+ * 3. Adds proper classes to the `<body>` and `<html>` elements to block page scrolling, adjust `z-index` etc.
34
+ * 4. Changes the position of some dialogs to utilize the empty space on the right side of the editable element.
35
+ *
36
+ * Steps 5-11 are only executed if the corresponding features are used.
37
+ *
38
+ * 5. If presence list is used, moves it to the fullscreen mode container.
39
+ * 6. If document outline is used, moves it to the fullscreen mode.
40
+ * 7. If pagination is used, adjusts it's configuration for the changed view.
41
+ * 8. If annotations are used, moves them to the fullscreen mode.
42
+ * 9. If revision history is used, overrides the callbacks to show the revision viewer in the fullscreen mode.
43
+ * 10. If source editing and document outline are both used, hides the document outline header.
44
+ * 11. If custom container is used, hides all other elements in it to ensure they don't create an empty unscrollable space.
45
+ *
46
+ * Then finally:
47
+ *
48
+ * 12. Executes the configured {@link module:fullscreen/fullscreenconfig~FullscreenConfig#onEnterCallback
49
+ * `config.fullscreen.onEnterCallback`} function.
50
+ * By default, it returns the fullscreen mode container element so it can be further customized.
51
+ *
52
+ * When leaving the fullscreen mode, the {@link #disable} method is called. It does the following:
53
+ *
54
+ * 1. Execute the configured {@link module:fullscreen/fullscreenconfig~FullscreenConfig#onLeaveCallback
55
+ * `config.fullscreen.onLeaveCallback`} function.
56
+ * 2. Remove the classes added to the `<body>` and `<html>` elements.
57
+ * 3. If document outline is used, restore its default container.
58
+ * 4. If annotations are used, restore their original state (UI, filters etc).
59
+ * 5. If revision history is used, restore the original callbacks.
60
+ * 6. If source editing and document outline are both used, restore the document outline header.
61
+ * 7. Restore all moved elements to their original place.
62
+ * 8. Destroy the fullscreen mode container.
63
+ * 9. If the editor has a toolbar, switch its behavior to the one configured in the
64
+ * {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull} property.
65
+ * 10. Restore the scroll positions of all ancestors of the editable element.
66
+ * 11. If pagination is used, restore its default configuration.
67
+ * 12. Restore default dialogs positions.
68
+ *
69
+ * This class is exported to allow for custom extensions.
13
70
  */
14
71
  export default class AbstractEditorHandler {
15
72
  /**
@@ -111,7 +168,7 @@ export default class AbstractEditorHandler {
111
168
  this._wrapper = createElement(this._document, 'div', {
112
169
  class: 'ck ck-fullscreen__main-wrapper'
113
170
  });
114
- // For now, the container is generated in a very straightforward way. If necessary, it may be rewritten using our UI lib.
171
+ // For now, the container is generated in a very straightforward way. If necessary, it may be rewritten using editor's UI lib.
115
172
  this._wrapper.innerHTML = `
116
173
  <div class="ck ck-fullscreen__top-wrapper ck-reset_all">
117
174
  <div class="ck ck-fullscreen__menu-bar" data-ck-fullscreen="menu-bar"></div>
@@ -139,7 +196,7 @@ export default class AbstractEditorHandler {
139
196
  */
140
197
  enable() {
141
198
  this._saveAncestorsScrollPositions(this._editor.ui.getEditableElement());
142
- this._defaultOnEnter();
199
+ this.defaultOnEnter();
143
200
  // Block scroll if the fullscreen container is the body element. Otherwise the document has to stay scrollable.
144
201
  if (this._editor.config.get('fullscreen.container') === this._document.body) {
145
202
  this._document.body.classList.add('ck-fullscreen');
@@ -232,15 +289,21 @@ export default class AbstractEditorHandler {
232
289
  for (const placeholderName of this._placeholderMap.keys()) {
233
290
  this.restoreMovedElementLocation(placeholderName);
234
291
  }
235
- this._editor.ui.view.toolbar.switchBehavior(this._editor.config.get('toolbar.shouldNotGroupWhenFull') === true ? 'static' : 'dynamic');
236
- if (this._placeholderMap.size === 0) {
237
- this._destroyContainer();
292
+ // Container is also destroyed in the `restoreMovedElementLocation()` method, but we need to do it here
293
+ // to ensure that the container is destroyed even if no elements were moved.
294
+ this._destroyContainer();
295
+ if (this._editor.ui.view.toolbar) {
296
+ this._editor.ui.view.toolbar.switchBehavior(this._editor.config.get('toolbar.shouldNotGroupWhenFull') === true ? 'static' : 'dynamic');
238
297
  }
239
298
  // Restore scroll positions of all ancestors. It may include the closest editable wrapper causing the editor to change
240
299
  // the visible content, which is not what we want. Thus, after executing the command, we use
241
300
  // `editor.editing.view.scrollToTheSelection()` to scroll the editor viewport to the current selection.
301
+ // Using `behavior: 'instant'` is necessary to force scroll if some of the containers has `scroll-behavior: smooth` set (otherwise
302
+ // the scroll won't happen).
242
303
  for (const [ancestor, value] of this._savedAncestorsScrollPositions) {
243
- ancestor.scrollTo(value.scrollLeft, value.scrollTop);
304
+ // `ScrollBehavior` has incorrect type definition in currently used TS version (5.0.4). Fix should be present since 5.1.0:
305
+ // https://github.com/Microsoft/TypeScript/issues/28755. Hence we need a type assertion here.
306
+ ancestor.scrollTo({ left: value.scrollLeft, top: value.scrollTop, behavior: 'instant' });
244
307
  }
245
308
  this._savedAncestorsScrollPositions.clear();
246
309
  // Pagination has to be restored after leaving fullscreen mode to ensure proper rendering.
@@ -276,7 +339,7 @@ export default class AbstractEditorHandler {
276
339
  * Returns the fullscreen mode container element so it can be further customized via
277
340
  * `fullscreen.onEnterCallback` configuration property.
278
341
  */
279
- _defaultOnEnter() {
342
+ defaultOnEnter() {
280
343
  return this.getWrapper();
281
344
  }
282
345
  /**
@@ -376,7 +439,7 @@ export default class AbstractEditorHandler {
376
439
  // If no filter is defined for `wideSidebar`, read the filters for the active display(s) mode and apply them.
377
440
  // It's possible there are filters for both `narrowSidebar` and `inline` modes, so display annotations that match any of them.
378
441
  else if (annotationsFilters.size) {
379
- annotationsUIs.activate('wideSidebar', annotation => [...annotationsFilters.values()].some(filter => filter(annotation)));
442
+ annotationsUIs.activate('wideSidebar', (annotation) => [...annotationsFilters.values()].some(filter => filter(annotation)));
380
443
  }
381
444
  // If no filters are defined for the active display mode(s), simply display all annotations in the wide sidebar.
382
445
  else {
@@ -19,5 +19,5 @@ export default class ClassicEditorHandler extends AbstractEditorHandler {
19
19
  /**
20
20
  * A function that moves the editor UI elements to the fullscreen mode.
21
21
  */
22
- protected _defaultOnEnter(): HTMLElement;
22
+ defaultOnEnter(): HTMLElement;
23
23
  }
@@ -25,7 +25,7 @@ export default class ClassicEditorHandler extends AbstractEditorHandler {
25
25
  /**
26
26
  * A function that moves the editor UI elements to the fullscreen mode.
27
27
  */
28
- _defaultOnEnter() {
28
+ defaultOnEnter() {
29
29
  const editorUI = this._editor.ui;
30
30
  const editorUIView = editorUI.view;
31
31
  // Code coverage is provided in the commercial package repository as integration unit tests.
@@ -22,5 +22,5 @@ export default class DecoupledEditorHandler extends AbstractEditorHandler {
22
22
  /**
23
23
  * A function that moves the editor UI elements to the fullscreen mode.
24
24
  */
25
- protected _defaultOnEnter(): HTMLElement;
25
+ defaultOnEnter(): HTMLElement;
26
26
  }
@@ -21,7 +21,7 @@ export default class DecoupledEditorHandler extends AbstractEditorHandler {
21
21
  /**
22
22
  * A function that moves the editor UI elements to the fullscreen mode.
23
23
  */
24
- _defaultOnEnter() {
24
+ defaultOnEnter() {
25
25
  // Code coverage is provided in the commercial package repository as integration unit tests.
26
26
  /* istanbul ignore next -- @preserve */
27
27
  if (this._editor.plugins.has('Pagination') && this._editor.plugins.get('Pagination').isEnabled) {
package/src/index.d.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  export { default as Fullscreen } from './fullscreen.js';
9
9
  export { default as FullscreenEditing } from './fullscreenediting.js';
10
10
  export { default as FullscreenUI } from './fullscreenui.js';
11
+ export { default as AbstractEditorHandler } from './handlers/abstracteditorhandler.js';
11
12
  export type { default as FullscreenConfig } from './fullscreenconfig.js';
12
13
  export type { default as FullscreenCommand } from './fullscreencommand.js';
13
14
  import './augmentation.js';
package/src/index.js CHANGED
@@ -8,4 +8,5 @@
8
8
  export { default as Fullscreen } from './fullscreen.js';
9
9
  export { default as FullscreenEditing } from './fullscreenediting.js';
10
10
  export { default as FullscreenUI } from './fullscreenui.js';
11
+ export { default as AbstractEditorHandler } from './handlers/abstracteditorhandler.js';
11
12
  import './augmentation.js';
@@ -102,7 +102,6 @@ Fullscreen layout:
102
102
 
103
103
  .ck-fullscreen__main-wrapper .ck-fullscreen__editable {
104
104
  margin-top: var(--ck-fullscreen-editor-top-margin);
105
- margin-bottom: 56px;
106
105
  height: 100%;
107
106
  margin-left: auto;
108
107
 
@@ -115,9 +114,11 @@ Fullscreen layout:
115
114
 
116
115
  .ck-fullscreen__main-wrapper .ck-fullscreen__editable .ck.ck-editor__editable:not(.ck-editor__nested-editable) {
117
116
  box-sizing: border-box;
118
- width: calc(210mm + 2px);
117
+ width: calc(210mm + 2px); /* Make sure the border is taken into account. */
118
+ max-width: calc(210mm + 2px); /* Make sure the border is taken into account. */
119
119
  min-height: 297mm;
120
120
  height: fit-content;
121
+ margin: 0; /* Reset margins that may be present on editable. We add them in other places. */
121
122
  padding: 20mm 12mm;
122
123
  border: 1px var(--ck-color-base-border) solid;
123
124
  background: hsl(0, 0%, 100%);