custom-heading-elements.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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';
  7. ClassicEditor
  8. .create( document.querySelector( '#snippet-custom-heading-elements' ), {
  9. cloudServices: CS_CONFIG,
  10. heading: {
  11. options: [
  12. { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
  13. { model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
  14. { model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
  15. {
  16. model: 'headingFancy',
  17. view: {
  18. name: 'h2',
  19. classes: 'fancy'
  20. },
  21. title: 'Heading 2 (fancy)',
  22. class: 'ck-heading_heading2_fancy',
  23. converterPriority: 'high'
  24. }
  25. ]
  26. },
  27. toolbar: {
  28. viewportTopOffset: window.getViewportTopOffsetConfig()
  29. }
  30. } )
  31. .then( editor => {
  32. window.editor = editor;
  33. } )
  34. .catch( err => {
  35. console.error( err.stack );
  36. } );