editoruiview.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. import View from '../view.js';
  7. /**
  8. * Base class for the editor main views.
  9. *
  10. * @memberOf ui.editorUI
  11. * @extends ui.View
  12. */
  13. export default class EditorUIView extends View {
  14. constructor( model, locale ) {
  15. super( model, locale );
  16. this._createBodyRegion();
  17. /**
  18. * The element holding elements of the 'body' region.
  19. *
  20. * @private
  21. * @member {HTMLElement} ui.editorUI.EditorUIView#_bodyRegionContainer
  22. */
  23. }
  24. destroy() {
  25. this._bodyRegionContainer.remove();
  26. this._bodyRegionContainer = null;
  27. }
  28. /**
  29. * Creates and appends to `<body>` the 'body' region container.
  30. *
  31. * @private
  32. */
  33. _createBodyRegion() {
  34. const bodyElement = document.createElement( 'div' );
  35. document.body.appendChild( bodyElement );
  36. this.applyTemplateToElement( bodyElement, {
  37. attributes: {
  38. class: 'ck-body ck-reset-all'
  39. }
  40. } );
  41. this._bodyRegionContainer = bodyElement;
  42. this.register( 'body', () => bodyElement );
  43. }
  44. }