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:false, document, window */
  6. import ClassicEditor from '../../../../src/classiceditor';
  7. import Enter from '@ckeditor/ckeditor5-enter/src/enter';
  8. import Typing from '@ckeditor/ckeditor5-typing/src/typing';
  9. import Heading from '@ckeditor/ckeditor5-heading/src/heading';
  10. import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
  11. import Undo from '@ckeditor/ckeditor5-undo/src/undo';
  12. import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
  13. import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
  14. ClassicEditor.create( document.querySelector( '#editor' ), {
  15. plugins: [ Enter, Typing, Paragraph, Undo, Heading, Bold, Italic ],
  16. toolbar: {
  17. items: [ 'headings', 'bold', 'italic', 'undo', 'redo' ],
  18. verticalOffset: 100
  19. }
  20. } )
  21. .then( newEditor => {
  22. console.log( 'Editor was initialized', newEditor );
  23. console.log( 'You can now play with it using global `editor` and `editable` variables.' );
  24. window.editor = newEditor;
  25. } )
  26. .catch( err => {
  27. console.error( err.stack );
  28. } );