creator-inline.js 930 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* global console:false */
  6. 'use strict';
  7. import CKEDITOR from '/ckeditor.js';
  8. import InlineCreator from '/tests/core/creator/manual/_utils/creator/inlinecreator.js';
  9. let editor;
  10. function initEditor() {
  11. CKEDITOR.create( '#editor', {
  12. creator: InlineCreator
  13. } )
  14. .then( ( newEditor ) => {
  15. console.log( 'Editor was initialized', newEditor );
  16. console.log( 'You can now play with it using global `editor` variable.' );
  17. window.editor = editor = newEditor;
  18. } );
  19. }
  20. function destroyEditor() {
  21. editor.destroy()
  22. .then( () => {
  23. window.editor = null;
  24. editor = null;
  25. console.log( 'Editor was destroyed' );
  26. } );
  27. }
  28. document.getElementById( 'initEditor' ).addEventListener( 'click', initEditor );
  29. document.getElementById( 'destroyEditor' ).addEventListener( 'click', destroyEditor );