| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- /**
- * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
- /* globals console, window, document */
- import InlineEditor from '@ckeditor/ckeditor5-build-inline/src/ckeditor';
- import ImageResize from '@ckeditor/ckeditor5-image/src/imageresize';
- import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';
- const inlineInjectElements = document.querySelectorAll( '#snippet-inline-editor [data-inline-inject]' );
- Array.from( inlineInjectElements ).forEach( inlineElement => {
- const config = {
- toolbar: {
- viewportTopOffset: window.getViewportTopOffsetConfig()
- },
- cloudServices: CS_CONFIG
- };
- if ( inlineElement.tagName.toLowerCase() == 'header' ) {
- config.removePlugins = [
- 'Blockquote',
- 'Image',
- 'ImageCaption',
- 'ImageStyle',
- 'ImageToolbar',
- 'ImageUpload',
- 'List',
- 'EasyImage',
- 'CKFinder',
- 'CKFinderUploadAdapter'
- ];
- config.toolbar.items = [ 'heading', '|', 'bold', 'italic', 'link' ];
- } else {
- config.extraPlugins = [ ImageResize ];
- config.image = {
- resizeOptions: [
- {
- name: 'imageResize:original',
- label: 'Original',
- value: null
- },
- {
- name: 'imageResize:50',
- label: '50%',
- value: '50'
- },
- {
- name: 'imageResize:75',
- label: '75%',
- value: '75'
- }
- ],
- styles: [ 'full', 'alignLeft', 'alignRight' ],
- toolbar: [
- 'imageStyle:alignLeft',
- 'imageStyle:full',
- 'imageStyle:alignRight',
- '|',
- 'imageResize',
- '|',
- 'imageTextAlternative'
- ]
- };
- }
- InlineEditor
- .create( inlineElement, config )
- .then( editor => {
- window.editor = editor;
- } )
- .catch( err => {
- console.error( err );
- } );
- } );
|