imageresizepx.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 ImageResize from '../../src/imageresize';
  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. ImageResize,
  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. resizeUnit: 'px',
  25. toolbar: [ 'imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', 'imageResize' ],
  26. styles: [
  27. 'alignLeft',
  28. 'alignCenter',
  29. 'alignRight'
  30. ]
  31. },
  32. cloudServices: CS_CONFIG
  33. };
  34. ClassicEditor
  35. .create( document.querySelector( '#editor' ), commonConfig )
  36. .then( editor => {
  37. window.editor = editor;
  38. } )
  39. .catch( err => {
  40. console.error( err.stack );
  41. } );
  42. ClassicEditor
  43. .create( document.querySelector( '#fancy-editor' ), commonConfig )
  44. .then( editor => {
  45. window.fancyEditor = editor;
  46. } )
  47. .catch( err => {
  48. console.error( err.stack );
  49. } );
  50. ClassicEditor
  51. .create( document.querySelector( '#editor-other-units' ), commonConfig )
  52. .then( editor => {
  53. window.editorOtherUnits = editor;
  54. } )
  55. .catch( err => {
  56. console.error( err.stack );
  57. } );