| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- /**
- * @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 ImageResizeUI from '../../src/imageresize/ui/imageresizeui';
- 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 { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';
- const commonConfig = {
- plugins: [
- ArticlePluginSet,
- ImageResizeUI,
- Indent,
- IndentBlock,
- EasyImage
- ],
- toolbar: [ 'heading', '|', 'bold', 'italic', 'link',
- 'bulletedList', 'numberedList', 'blockQuote', 'insertTable', 'undo', 'redo', 'outdent', 'indent' ],
- image: {
- resizeUnit: '%',
- imageResizeOptions: [
- {
- name: 'imageResize:original',
- label: 'Original size',
- value: null
- },
- {
- name: 'imageResize:50',
- label: '50%',
- value: '50'
- },
- {
- name: 'imageResize:75',
- label: '75%',
- value: '75'
- }
- ],
- toolbar: [ 'imageStyle:alignLeft', 'imageStyle:full', 'imageStyle:side', '|', 'imageResize' ],
- styles: [
- 'full',
- 'alignLeft',
- 'side' // Purposely using side image instead right aligned image to make sure it works well with both style types.
- ]
- },
- table: {
- contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ],
- tableToolbar: [ 'bold', 'italic' ]
- },
- cloudServices: CS_CONFIG
- };
- const imageConfig1 = {
- resizeUnit: '%',
- imageResizeOptions: [
- {
- name: 'imageResize:original',
- label: 'Original size',
- value: null
- },
- {
- name: 'imageResize:50',
- label: '50%',
- value: '50'
- },
- {
- name: 'imageResize:75',
- label: '75%',
- value: '75'
- }
- ],
- toolbar: [ 'imageStyle:alignLeft', 'imageStyle:full', 'imageStyle:side', '|', 'imageResize' ],
- styles: [
- 'full',
- 'alignLeft',
- 'side' // Purposely using side image instead right aligned image to make sure it works well with both style types.
- ]
- };
- const config1 = {
- ...commonConfig,
- image: imageConfig1
- };
- ClassicEditor
- .create( document.querySelector( '#editor1' ), config1 )
- .then( editor => {
- window.editor = editor;
- } )
- .catch( err => {
- console.error( err.stack );
- } );
- const imageConfig2 = {
- resizeUnit: '%',
- imageResizeOptions: [
- {
- name: 'imageResize:original',
- label: 'Original size',
- value: null
- },
- {
- name: 'imageResize:50',
- label: '50%',
- value: '50'
- },
- {
- name: 'imageResize:75',
- label: '75%',
- value: '75'
- }
- ],
- toolbar: [
- 'imageStyle:alignLeft',
- 'imageStyle:full',
- 'imageStyle:side', '|',
- 'imageResize:original',
- 'imageResize:50',
- 'imageResize:75'
- ],
- 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.editor = editor;
- } )
- .catch( err => {
- console.error( err.stack );
- } );
|