blocktoolbar.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 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. 'outdent', 'indent',
  24. '|',
  25. 'blockQuote', 'imageUpload'
  26. ],
  27. cloudServices: CS_CONFIG
  28. } )
  29. .then( editor => {
  30. window.editorBasic = editor;
  31. } )
  32. .catch( err => {
  33. console.error( err );
  34. } );