custom-heading-levels.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* globals console, window, document */
  6. import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
  7. import ArticlePreset from '@ckeditor/ckeditor5-presets/src/article';
  8. ClassicEditor
  9. .create( document.querySelector( '#snippet-custom-heading-levels' ), {
  10. plugins: [ ArticlePreset ],
  11. toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],
  12. image: {
  13. toolbar: [ 'imageStyleFull', 'imageStyleSide', '|', 'imageTextAlternative' ]
  14. },
  15. heading: {
  16. options: [
  17. { modelElement: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
  18. { modelElement: 'heading1', viewElement: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
  19. { modelElement: 'heading2', viewElement: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' }
  20. ]
  21. }
  22. } )
  23. .then( editor => {
  24. window.editor = editor;
  25. } )
  26. .catch( err => {
  27. console.error( err.stack );
  28. } );