image-resize-px.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. /* globals ClassicEditor, console, window, document */
  6. import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config.js';
  7. ClassicEditor
  8. .create( document.querySelector( '#snippet-image-resize-px' ), {
  9. removePlugins: [ 'LinkImage', 'AutoImage' ],
  10. image: {
  11. resizeUnit: 'px',
  12. resizeOptions: [
  13. {
  14. name: 'imageResize:original',
  15. label: 'Original',
  16. value: null
  17. },
  18. {
  19. name: 'imageResize:250',
  20. label: '250px',
  21. value: '250'
  22. },
  23. {
  24. name: 'imageResize:400',
  25. label: '400px',
  26. value: '400'
  27. }
  28. ],
  29. styles: [
  30. 'alignLeft',
  31. 'alignCenter',
  32. 'alignRight'
  33. ],
  34. toolbar: [
  35. 'imageStyle:alignLeft',
  36. 'imageStyle:alignCenter',
  37. 'imageStyle:alignRight',
  38. '|',
  39. 'imageResize'
  40. ]
  41. },
  42. toolbar: {
  43. viewportTopOffset: window.getViewportTopOffsetConfig()
  44. },
  45. cloudServices: CS_CONFIG
  46. } )
  47. .then( editor => {
  48. window.editorResizePX = editor;
  49. } )
  50. .catch( err => {
  51. console.error( err );
  52. } );