image-resize-buttons.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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-buttons' ), {
  9. removePlugins: [ 'LinkImage', 'AutoImage' ],
  10. toolbar: {
  11. viewportTopOffset: window.getViewportTopOffsetConfig()
  12. },
  13. image: {
  14. resizeOptions: [
  15. {
  16. name: 'imageResize:original',
  17. label: 'Original',
  18. value: null,
  19. icon: 'original'
  20. },
  21. {
  22. name: 'imageResize:50',
  23. label: '50%',
  24. value: '50',
  25. icon: 'medium'
  26. },
  27. {
  28. name: 'imageResize:75',
  29. label: '75%',
  30. value: '75',
  31. icon: 'large'
  32. }
  33. ],
  34. styles: [
  35. 'alignLeft',
  36. 'alignCenter',
  37. 'alignRight'
  38. ],
  39. toolbar: [
  40. 'imageStyle:alignLeft',
  41. 'imageStyle:alignCenter',
  42. 'imageStyle:alignRight',
  43. '|',
  44. 'imageResize:50',
  45. 'imageResize:75',
  46. 'imageResize:original'
  47. ]
  48. },
  49. cloudServices: CS_CONFIG
  50. } )
  51. .then( editor => {
  52. window.editorResizeUI = editor;
  53. } )
  54. .catch( err => {
  55. console.error( err );
  56. } );