8
0

contextualtoolbar.js 747 B

1234567891011121314151617181920212223242526
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* globals window, document, console:false */
  6. import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classic';
  7. import ArticlePresets from '@ckeditor/ckeditor5-presets/src/article';
  8. import ContextualToolbar from '../../../src/toolbar/contextualtoolbar';
  9. ClassicEditor.create( document.querySelector( '#editor' ), {
  10. plugins: [ ArticlePresets ],
  11. toolbar: [ 'bold', 'italic', 'undo', 'redo', 'link' ]
  12. } )
  13. .then( editor => {
  14. const toolbar = new ContextualToolbar( editor );
  15. toolbar.addComponents( [ 'bold', 'italic' ] );
  16. window.editor = editor;
  17. } )
  18. .catch( err => {
  19. console.error( err.stack );
  20. } );