1.js 816 B

123456789101112131415161718192021222324252627
  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 EssentialsPreset from '@ckeditor/ckeditor5-presets/src/essentials';
  8. import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
  9. import { getData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
  10. window.setInterval( function() {
  11. console.log( getData( window.editor.document ) );
  12. }, 3000 );
  13. ClassicEditor
  14. .create( document.querySelector( '#editor' ), {
  15. plugins: [ EssentialsPreset, Paragraph ],
  16. toolbar: [ 'undo', 'redo' ]
  17. } )
  18. .then( editor => {
  19. window.editor = editor;
  20. } )
  21. .catch( err => {
  22. console.error( err.stack );
  23. } );