autoformat.js 770 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* globals console, window, document */
  6. import ClassicEditor from '@ckeditor/ckeditor5-build-classic/src/ckeditor';
  7. import Code from '@ckeditor/ckeditor5-basic-styles/src/code';
  8. ClassicEditor
  9. .create( document.querySelector( '#snippet-autoformat' ), {
  10. plugins: ClassicEditor.build.plugins.concat( [ Code ] ),
  11. toolbar: {
  12. items: [
  13. 'headings',
  14. '|',
  15. 'bold',
  16. 'italic',
  17. 'code',
  18. 'link',
  19. 'bulletedList',
  20. 'numberedList',
  21. 'blockQuote',
  22. 'undo',
  23. 'redo'
  24. ],
  25. viewportTopOffset: 60
  26. }
  27. } )
  28. .then( editor => {
  29. window.editorBasic = editor;
  30. } )
  31. .catch( err => {
  32. console.error( err );
  33. } );