@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.
- package/build/fullscreen.js +2 -2
- package/build/translations/af.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/ast.js +1 -1
- package/build/translations/az.js +1 -1
- package/build/translations/be.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/bs.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de-ch.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/en-gb.js +1 -1
- package/build/translations/eo.js +1 -1
- package/build/translations/es-co.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/eu.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/gu.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/hy.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/jv.js +1 -1
- package/build/translations/kk.js +1 -1
- package/build/translations/km.js +1 -1
- package/build/translations/kn.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/ku.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nb.js +1 -1
- package/build/translations/ne.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/oc.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/si.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sl.js +1 -1
- package/build/translations/sq.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/ti.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/tt.js +1 -1
- package/build/translations/ug.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/uz.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/dist/index-editor.css +2 -1
- package/dist/index.css +3 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +111 -23
- package/dist/index.js.map +1 -1
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/lang/translations/af.po +8 -0
- package/lang/translations/ar.po +8 -0
- package/lang/translations/ast.po +8 -0
- package/lang/translations/az.po +8 -0
- package/lang/translations/be.po +8 -0
- package/lang/translations/bg.po +8 -0
- package/lang/translations/bn.po +8 -0
- package/lang/translations/bs.po +8 -0
- package/lang/translations/ca.po +8 -0
- package/lang/translations/cs.po +8 -0
- package/lang/translations/da.po +8 -0
- package/lang/translations/de-ch.po +8 -0
- package/lang/translations/de.po +8 -0
- package/lang/translations/el.po +8 -0
- package/lang/translations/en-au.po +8 -0
- package/lang/translations/en-gb.po +8 -0
- package/lang/translations/en.po +8 -0
- package/lang/translations/eo.po +8 -0
- package/lang/translations/es-co.po +8 -0
- package/lang/translations/es.po +8 -0
- package/lang/translations/et.po +8 -0
- package/lang/translations/eu.po +8 -0
- package/lang/translations/fa.po +8 -0
- package/lang/translations/fi.po +8 -0
- package/lang/translations/fr.po +8 -0
- package/lang/translations/gl.po +8 -0
- package/lang/translations/gu.po +8 -0
- package/lang/translations/he.po +8 -0
- package/lang/translations/hi.po +8 -0
- package/lang/translations/hr.po +8 -0
- package/lang/translations/hu.po +8 -0
- package/lang/translations/hy.po +8 -0
- package/lang/translations/id.po +8 -0
- package/lang/translations/it.po +8 -0
- package/lang/translations/ja.po +8 -0
- package/lang/translations/jv.po +8 -0
- package/lang/translations/kk.po +8 -0
- package/lang/translations/km.po +8 -0
- package/lang/translations/kn.po +8 -0
- package/lang/translations/ko.po +8 -0
- package/lang/translations/ku.po +8 -0
- package/lang/translations/lt.po +8 -0
- package/lang/translations/lv.po +8 -0
- package/lang/translations/ms.po +8 -0
- package/lang/translations/nb.po +8 -0
- package/lang/translations/ne.po +8 -0
- package/lang/translations/nl.po +8 -0
- package/lang/translations/no.po +8 -0
- package/lang/translations/oc.po +8 -0
- package/lang/translations/pl.po +8 -0
- package/lang/translations/pt-br.po +8 -0
- package/lang/translations/pt.po +8 -0
- package/lang/translations/ro.po +8 -0
- package/lang/translations/ru.po +8 -0
- package/lang/translations/si.po +8 -0
- package/lang/translations/sk.po +8 -0
- package/lang/translations/sl.po +8 -0
- package/lang/translations/sq.po +8 -0
- package/lang/translations/sr-latn.po +8 -0
- package/lang/translations/sr.po +8 -0
- package/lang/translations/sv.po +8 -0
- package/lang/translations/th.po +8 -0
- package/lang/translations/ti.po +8 -0
- package/lang/translations/tk.po +8 -0
- package/lang/translations/tr.po +8 -0
- package/lang/translations/tt.po +8 -0
- package/lang/translations/ug.po +8 -0
- package/lang/translations/uk.po +8 -0
- package/lang/translations/ur.po +8 -0
- package/lang/translations/uz.po +8 -0
- package/lang/translations/vi.po +8 -0
- package/lang/translations/zh-cn.po +8 -0
- package/lang/translations/zh.po +8 -0
- package/package.json +8 -13
- package/src/fullscreencommand.d.ts +15 -1
- package/src/fullscreencommand.js +35 -12
- package/src/handlers/abstracteditorhandler.d.ts +61 -5
- package/src/handlers/abstracteditorhandler.js +72 -9
- package/src/handlers/classiceditorhandler.d.ts +1 -1
- package/src/handlers/classiceditorhandler.js +1 -1
- package/src/handlers/decouplededitorhandler.d.ts +1 -1
- package/src/handlers/decouplededitorhandler.js +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- 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.
|
|
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-
|
|
17
|
-
"@ckeditor/ckeditor5-
|
|
18
|
-
"@ckeditor/ckeditor5-
|
|
19
|
-
"@ckeditor/ckeditor5-
|
|
20
|
-
"@ckeditor/ckeditor5-
|
|
21
|
-
"@ckeditor/ckeditor5-
|
|
22
|
-
"
|
|
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
|
-
|
|
37
|
+
fullscreenHandler: AbstractEditorHandler;
|
|
24
38
|
/**
|
|
25
39
|
* @inheritDoc
|
|
26
40
|
*/
|
package/src/fullscreencommand.js
CHANGED
|
@@ -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
|
-
|
|
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,
|
|
32
|
-
//
|
|
33
|
-
if (editor
|
|
34
|
-
this.
|
|
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
|
|
37
|
-
this.
|
|
47
|
+
else if (isDecoupledEditor(editor)) {
|
|
48
|
+
this.fullscreenHandler = new DecoupledEditorHandler(editor);
|
|
38
49
|
}
|
|
39
50
|
else {
|
|
40
|
-
this.
|
|
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.
|
|
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.
|
|
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.
|
|
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<
|
|
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?:
|
|
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
|
-
|
|
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.
|
|
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
|
|
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.
|
|
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
|
-
|
|
236
|
-
if
|
|
237
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
@@ -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
|
-
|
|
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.
|
|
@@ -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
|
-
|
|
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';
|
package/theme/fullscreen.css
CHANGED
|
@@ -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%);
|