|
|
@@ -10,6 +10,7 @@ import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articleplugi
|
|
|
import Table from '@ckeditor/ckeditor5-table/src/table';
|
|
|
|
|
|
import RestrictedEditingException from '../../src/restrictededitingexception';
|
|
|
+import RestrictedEditing from '../../src/restrictedediting';
|
|
|
|
|
|
const restrictedModeButton = document.getElementById( 'mode-restricted' );
|
|
|
const standardModeButton = document.getElementById( 'mode-standard' );
|
|
|
@@ -31,7 +32,24 @@ async function startStandardMode() {
|
|
|
standardModeButton.removeEventListener( 'click', startStandardMode );
|
|
|
standardModeButton.setAttribute( 'disabled', 'disabled' );
|
|
|
|
|
|
- window.editor = await getEditor( [ ArticlePluginSet, Table, RestrictedEditingException ] );
|
|
|
+ await reloadEditor( {
|
|
|
+ plugins: [ ArticlePluginSet, Table, RestrictedEditingException ],
|
|
|
+ toolbar: [
|
|
|
+ 'heading', '|', 'bold', 'italic', 'link', '|',
|
|
|
+ 'bulletedList', 'numberedList', 'blockQuote', 'insertTable', '|',
|
|
|
+ 'restrictedEditingException', '|', 'undo', 'redo'
|
|
|
+ ],
|
|
|
+ image: {
|
|
|
+ toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative' ]
|
|
|
+ },
|
|
|
+ table: {
|
|
|
+ contentToolbar: [
|
|
|
+ 'tableColumn',
|
|
|
+ 'tableRow',
|
|
|
+ 'mergeTableCells'
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ } );
|
|
|
|
|
|
enableSwitchToRestrictedMode();
|
|
|
}
|
|
|
@@ -40,35 +58,18 @@ async function startRestrictedMode() {
|
|
|
restrictedModeButton.removeEventListener( 'click', startRestrictedMode );
|
|
|
restrictedModeButton.setAttribute( 'disabled', 'disabled' );
|
|
|
|
|
|
- window.editor = await getEditor( [ ArticlePluginSet, Table, RestrictedEditingException ] );
|
|
|
+ await reloadEditor( {
|
|
|
+ plugins: [ ArticlePluginSet, Table, RestrictedEditing ],
|
|
|
+ toolbar: [ 'bold', 'italic', 'link', 'underline', '|', 'restrictedEditing', '|', 'undo', 'redo' ]
|
|
|
+ } );
|
|
|
|
|
|
enableSwitchToStandardMode();
|
|
|
}
|
|
|
|
|
|
-async function getEditor( plugins ) {
|
|
|
+async function reloadEditor( config ) {
|
|
|
if ( window.editor ) {
|
|
|
await window.editor.destroy();
|
|
|
}
|
|
|
|
|
|
- // await new Promise( resolve => setTimeout( resolve, 1000 ) );
|
|
|
-
|
|
|
- return await ClassicEditor
|
|
|
- .create( document.querySelector( '#editor' ), {
|
|
|
- plugins,
|
|
|
- toolbar: [ 'heading', '|',
|
|
|
- 'bold', 'italic', 'link', '|',
|
|
|
- 'bulletedList', 'numberedList', 'blockQuote', 'insertTable', '|',
|
|
|
- 'restrictedEditingException', '|', 'undo', 'redo'
|
|
|
- ],
|
|
|
- image: {
|
|
|
- toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative' ]
|
|
|
- },
|
|
|
- table: {
|
|
|
- contentToolbar: [
|
|
|
- 'tableColumn',
|
|
|
- 'tableRow',
|
|
|
- 'mergeTableCells'
|
|
|
- ]
|
|
|
- }
|
|
|
- } );
|
|
|
+ window.editor = await ClassicEditor.create( document.querySelector( '#editor' ), config );
|
|
|
}
|