blocktoolbar.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* globals console, window, document */
  6. import BalloonEditor from '@ckeditor/ckeditor5-build-balloon/src/ckeditor';
  7. import BlockToolbar from '@ckeditor/ckeditor5-ui/src/toolbar/block/blocktoolbar';
  8. import HeadingButtonsUI from '@ckeditor/ckeditor5-heading/src/headingbuttonsui';
  9. import ParagraphButtonUI from '@ckeditor/ckeditor5-paragraph/src/paragraphbuttonui';
  10. import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';
  11. BalloonEditor
  12. .create( document.querySelector( '#snippet-block-toolbar' ), {
  13. plugins: BalloonEditor.builtinPlugins.concat( [ BlockToolbar, ParagraphButtonUI, HeadingButtonsUI ] ),
  14. toolbar: {
  15. items: [ 'bold', 'italic', 'link', 'undo', 'redo' ],
  16. viewportTopOffset: window.getViewportTopOffsetConfig()
  17. },
  18. blockToolbar: [
  19. 'paragraph', 'heading1', 'heading2', 'heading3',
  20. '|',
  21. 'bulletedList', 'numberedList',
  22. '|',
  23. 'blockQuote', 'imageUpload'
  24. ],
  25. cloudServices: CS_CONFIG
  26. } )
  27. .then( editor => {
  28. window.editorBasic = editor;
  29. } )
  30. .catch( err => {
  31. console.error( err );
  32. } );