1.js 774 B

1234567891011121314151617181920212223242526
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* globals console, window, document */
  6. import ClassicEditor from '/ckeditor5/editor-classic/classic.js';
  7. ClassicEditor.create( document.querySelector( '#editor' ), {
  8. features: [ 'enter', 'typing', 'paragraph', 'heading', 'basic-styles/bold', 'basic-styles/italic' ],
  9. toolbar: [ 'headings', 'bold', 'italic' ]
  10. } )
  11. .then( editor => {
  12. window.editor = editor;
  13. const sel = editor.document.selection;
  14. sel.on( 'change', ( evt, data ) => {
  15. const date = new Date();
  16. console.log( `${ date.getSeconds() }s${ String( date.getMilliseconds() ).slice( 0, 2 ) }ms`, evt.name, data );
  17. } );
  18. } )
  19. .catch( err => {
  20. console.error( err.stack );
  21. } );