-
Notifications
You must be signed in to change notification settings - Fork 4
/
FullScreen.js
47 lines (42 loc) · 1.64 KB
/
FullScreen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import ImageFullBig from './icons/fullscreen-big.svg';
import ImageFullCancel from './icons/fullscreen-cancel.svg';
import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
import './css/style.css';
export default class FullScreen extends Plugin {
init() {
const editor = this.editor;
editor.ui.componentFactory.add( 'fullScreen', locale => {
const view = new ButtonView( locale );
let etat = 0; //si 0 position normale
view.set( {
label: 'Plein écran',
icon: ImageFullBig,
tooltip: true
} );
// Callback executed once the image is clicked.
view.on( 'execute', () => {
if(etat==1){
editor.sourceElement.nextElementSibling.removeAttribute('id');
document.body.removeAttribute('id');
view.set( {
label: 'Plein écran',
icon: ImageFullBig,
tooltip: true
} );
etat=0;
}else{
editor.sourceElement.nextElementSibling.setAttribute("id", 'fullscreeneditor');
document.body.setAttribute("id", "fullscreenoverlay");
view.set( {
label: 'Mode Normal',
icon: ImageFullCancel,
tooltip: true
} );
etat=1;
}
} );
return view;
} );
}
}