| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
- /* globals console, window, document */
- import InlineEditor from '@ckeditor/ckeditor5-build-inline/src/ckeditor';
- import { TOKEN_URL } from '@ckeditor/ckeditor5-cloudservices/tests/_utils/cloudservices-config';
- const inlineInjectElements = document.querySelectorAll( '#snippet-inline-editor [data-inline-inject]' );
- Array.from( inlineInjectElements ).forEach( inlineElement => {
- const config = {
- image: {
- toolbar: [ 'imageTextAlternative', '|', 'imageStyleAlignLeft', 'imageStyleFull', 'imageStyleAlignRight' ],
- styles: [ 'imageStyleFull', 'imageStyleAlignLeft', 'imageStyleAlignRight' ]
- },
- toolbar: {
- viewportTopOffset: 60
- },
- cloudServices: {
- tokenUrl: TOKEN_URL
- }
- };
- if ( inlineElement.tagName.toLowerCase() == 'header' ) {
- config.removePlugins = [
- 'Blockquote',
- 'Image',
- 'ImageCaption',
- 'ImageStyle',
- 'ImageToolbar',
- 'ImageUpload',
- 'List',
- 'EasyImage',
- 'CKFinderUploadAdapter'
- ];
- config.toolbar.items = [ 'headings', 'bold', 'italic', 'link' ];
- }
- InlineEditor
- .create( inlineElement, config )
- .then( editor => {
- window.editor = editor;
- } )
- .catch( err => {
- console.error( err );
- } );
- } );
|