1.js 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  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
  15. .create( document.querySelector( '#editor' ), {
  16. plugins: [ Enter, Typing, Paragraph, Undo, Heading, Bold, Italic ],
  17. toolbar: {
  18. items: [ 'heading', '|', 'bold', 'italic', 'undo', 'redo' ],
  19. viewportTopOffset: 100
  20. }
  21. } )
  22. .then( newEditor => {
  23. console.log( 'Editor was initialized', newEditor );
  24. console.log( 'You can now play with it using global `editor` and `editable` variables.' );
  25. window.editor = newEditor;
  26. } )
  27. .catch( err => {
  28. console.error( err.stack );
  29. } );