imageresizeui.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /* global document, console, window */
  6. import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
  7. import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
  8. import ImageResizeUI from '../../src/imageresizeui';
  9. import Indent from '@ckeditor/ckeditor5-indent/src/indent';
  10. import IndentBlock from '@ckeditor/ckeditor5-indent/src/indentblock';
  11. import EasyImage from '@ckeditor/ckeditor5-easy-image/src/easyimage';
  12. import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';
  13. const commonConfig = {
  14. plugins: [
  15. ArticlePluginSet,
  16. ImageResizeUI,
  17. Indent,
  18. IndentBlock,
  19. EasyImage
  20. ],
  21. toolbar: [ 'heading', '|', 'bold', 'italic', 'link',
  22. 'bulletedList', 'numberedList', 'blockQuote', 'insertTable', 'undo', 'redo', 'outdent', 'indent' ],
  23. image: {
  24. imageResize: [
  25. {
  26. name: 'imageResize:50',
  27. label: 'Resize image of 50%',
  28. value: '50%'
  29. },
  30. {
  31. name: 'imageResize:75',
  32. label: 'Resize image of 75%',
  33. value: '75%'
  34. }
  35. ],
  36. toolbar: [ 'imageStyle:alignLeft', 'imageStyle:full', 'imageStyle:side', '|', 'imageResize' ],
  37. styles: [
  38. 'full',
  39. 'alignLeft',
  40. 'side' // Purposely using side image instead right aligned image to make sure it works well with both style types.
  41. ]
  42. },
  43. table: {
  44. contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ],
  45. tableToolbar: [ 'bold', 'italic' ]
  46. },
  47. cloudServices: CS_CONFIG
  48. };
  49. ClassicEditor
  50. .create( document.querySelector( '#editor' ), commonConfig )
  51. .then( editor => {
  52. window.editor = editor;
  53. } )
  54. .catch( err => {
  55. console.error( err.stack );
  56. } );