| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- /**
- * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
- /* global document, console, window */
- import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
- import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
- import Indent from '@ckeditor/ckeditor5-indent/src/indent';
- import IndentBlock from '@ckeditor/ckeditor5-indent/src/indentblock';
- import EasyImage from '@ckeditor/ckeditor5-easy-image/src/easyimage';
- import ImageResizeEditing from '../../src/imageresize/imageresizeediting';
- import ImageResizeButtons from '../../src/imageresize/imageresizebuttons';
- import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';
- const commonConfig = {
- plugins: [
- ArticlePluginSet,
- Indent,
- IndentBlock,
- EasyImage,
- ImageResizeEditing,
- ImageResizeButtons
- ],
- toolbar: [ 'heading', '|', 'bold', 'italic', 'link',
- 'bulletedList', 'numberedList', 'blockQuote', 'insertTable', 'undo', 'redo', 'outdent', 'indent' ],
- table: {
- contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ],
- tableToolbar: [ 'bold', 'italic' ]
- },
- cloudServices: CS_CONFIG
- };
- // Editor 1
- const imageConfig1 = {
- resizeUnit: '%',
- resizeOptions: [
- {
- name: 'imageResize:original',
- value: null
- },
- {
- name: 'imageResize:50',
- value: '50'
- },
- {
- name: 'imageResize:75',
- value: '75'
- }
- ],
- toolbar: [ 'imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', 'imageResize' ],
- styles: [
- 'alignLeft',
- 'alignCenter',
- 'alignRight'
- ]
- };
- const config1 = {
- ...commonConfig,
- image: imageConfig1
- };
- ClassicEditor
- .create( document.querySelector( '#editor1' ), config1 )
- .then( editor => {
- window.editor1 = editor;
- } )
- .catch( err => {
- console.error( err.stack );
- } );
- // Editor 2
- const imageConfig2 = {
- resizeUnit: '%',
- resizeOptions: [
- {
- name: 'imageResize:original',
- value: null,
- icon: 'original'
- },
- {
- name: 'imageResize:50',
- value: '50',
- icon: 'medium'
- },
- {
- name: 'imageResize:75',
- value: '75',
- icon: 'large'
- }
- ],
- toolbar: [
- 'imageStyle:alignLeft',
- 'imageStyle:full',
- 'imageStyle:side', '|',
- 'imageResize:50',
- 'imageResize:75',
- 'imageResize:original'
- ],
- styles: [
- 'full',
- 'alignLeft',
- 'side' // Purposely using side image instead right aligned image to make sure it works well with both style types.
- ]
- };
- const config2 = {
- ...commonConfig,
- image: imageConfig2
- };
- ClassicEditor
- .create( document.querySelector( '#editor2' ), config2 )
- .then( editor => {
- window.editor2 = editor;
- } )
- .catch( err => {
- console.error( err.stack );
- } );
|