plugin.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /**
  6. * @fileOverview The "divarea" plugin. It registers the "wysiwyg" editing
  7. * mode using a DIV element.
  8. */
  9. CKEDITOR.plugins.add( 'divarea', {
  10. afterInit: function( editor ) {
  11. // Add the "wysiwyg" mode.
  12. // Do that in the afterInit function, so it'll eventually overwrite
  13. // the mode defined by the wysiwygarea plugin.
  14. editor.addMode( 'wysiwyg', function( callback ) {
  15. var editingBlock = CKEDITOR.dom.element.createFromHtml(
  16. '<div class="cke_wysiwyg_div cke_reset cke_enable_context_menu" hidefocus="true"></div>'
  17. );
  18. var contentSpace = editor.ui.space( 'contents' );
  19. contentSpace.append( editingBlock );
  20. editingBlock = editor.editable( editingBlock );
  21. editingBlock.detach = CKEDITOR.tools.override( editingBlock.detach,
  22. function( org ) {
  23. return function() {
  24. org.apply( this, arguments );
  25. this.remove();
  26. };
  27. } );
  28. editor.setData( editor.getData( 1 ), callback );
  29. editor.fire( 'contentDom' );
  30. } );
  31. }
  32. } );