1.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 ArticlePresets from '@ckeditor/ckeditor5-presets/src/article';
  8. ClassicEditor
  9. .create( document.querySelector( '#editor' ), {
  10. plugins: [ ArticlePresets ],
  11. toolbar: [ 'headings', 'undo', 'redo' ],
  12. image: {
  13. toolbar: [ 'imageTextAlternative' ]
  14. }
  15. } )
  16. .then( editor => {
  17. window.editor = editor;
  18. const schema = editor.document.schema;
  19. schema.disallow( { name: '$text', attributes: [ 'linkHref', 'italic' ], inside: 'heading1' } );
  20. schema.disallow( { name: '$text', attributes: [ 'italic' ], inside: 'heading2' } );
  21. schema.disallow( { name: '$text', attributes: [ 'linkHref' ], inside: 'blockQuote listItem' } );
  22. schema.disallow( { name: '$text', attributes: [ 'bold' ], inside: 'paragraph' } );
  23. schema.disallow( { name: 'heading3', inside: '$root' } );
  24. } )
  25. .catch( err => {
  26. console.error( err.stack );
  27. } );