|
|
@@ -5,52 +5,33 @@
|
|
|
|
|
|
/* globals console, window, document */
|
|
|
|
|
|
-import InlineEditor from '@ckeditor/ckeditor5-editor-inline/src/inlineeditor';
|
|
|
-import fullSizeIcon from '@ckeditor/ckeditor5-core/theme/icons/object-center.svg';
|
|
|
-import alignLeftIcon from '@ckeditor/ckeditor5-core/theme/icons/object-left.svg';
|
|
|
-import alignRightIcon from '@ckeditor/ckeditor5-core/theme/icons/object-right.svg';
|
|
|
-
|
|
|
-import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
|
|
|
+import InlineEditor from '@ckeditor/ckeditor5-build-inline/src/ckeditor';
|
|
|
+import getToken from '@ckeditor/ckeditor5-easy-image/tests/_utils/gettoken';
|
|
|
|
|
|
const inlineInjectElements = document.querySelectorAll( '#snippet-inline-editor [data-inline-inject]' );
|
|
|
|
|
|
-Array.prototype.map.call( inlineInjectElements, inlineElement => {
|
|
|
+Array.from( inlineInjectElements ).forEach( inlineElement => {
|
|
|
const config = {
|
|
|
- plugins: [ ArticlePluginSet ],
|
|
|
- toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],
|
|
|
image: {
|
|
|
- toolbar: [ 'imageTextAlternative', '|', 'imageStyleLeft', 'imageStyleFull', 'imageStyleRight' ],
|
|
|
- styles: [
|
|
|
- {
|
|
|
- name: 'imageStyleFull',
|
|
|
- title: 'Full size image',
|
|
|
- icon: fullSizeIcon,
|
|
|
- isDefault: true
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'imageStyleLeft',
|
|
|
- title: 'Left aligned image',
|
|
|
- icon: alignLeftIcon,
|
|
|
- className: 'image-style-left'
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'imageStyleRight',
|
|
|
- title: 'Right aligned image',
|
|
|
- icon: alignRightIcon,
|
|
|
- className: 'image-style-right'
|
|
|
- }
|
|
|
- ]
|
|
|
+ toolbar: [ 'imageTextAlternative', '|', 'imageStyleAlignLeft', 'imageStyleFull', 'imageStyleAlignRight' ],
|
|
|
+ styles: [ 'imageStyleFull', 'imageStyleAlignLeft', 'imageStyleAlignRight' ]
|
|
|
}
|
|
|
};
|
|
|
|
|
|
if ( inlineElement.tagName.toLowerCase() == 'header' ) {
|
|
|
- config.removePlugins = [ 'Blockquote', 'Image', 'ImageToolbar', 'List' ];
|
|
|
+ config.removePlugins = [ 'Blockquote', 'Image', 'ImageToolbar', 'List', 'EasyImage', 'ImageUpload', 'CKFinderUploadAdapter' ];
|
|
|
config.toolbar = [ 'headings', 'bold', 'italic', 'link' ];
|
|
|
}
|
|
|
|
|
|
- InlineEditor.create( inlineElement, config )
|
|
|
- .then( editor => {
|
|
|
- window.editor = editor;
|
|
|
+ getToken()
|
|
|
+ .then( token => {
|
|
|
+ config.cloudServices = { token };
|
|
|
+
|
|
|
+ return InlineEditor
|
|
|
+ .create( inlineElement, config )
|
|
|
+ .then( editor => {
|
|
|
+ window.editor = editor;
|
|
|
+ } );
|
|
|
} )
|
|
|
.catch( err => {
|
|
|
console.error( err );
|