8
0

region.js 919 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. /**
  7. * Basic Region class.
  8. *
  9. * @class Region
  10. * @extends Model
  11. */
  12. CKEDITOR.define( [ 'collection', 'model' ], function( Collection, Model ) {
  13. class Region extends Model {
  14. /**
  15. * Creates an instance of the {@link Region} class.
  16. *
  17. * @param {String} name The name of the Region.
  18. * @param {HTMLElement} [el] The element used for this region.
  19. * @constructor
  20. */
  21. constructor( name, el ) {
  22. super();
  23. /**
  24. * The name of the region.
  25. */
  26. this.name = name;
  27. /**
  28. * The element of the region.
  29. */
  30. this.el = el;
  31. /**
  32. * Views which belong to the region.
  33. */
  34. this.views = new Collection();
  35. this.views.on( 'add', ( evt, view ) => this.el && this.el.appendChild( view.el ) );
  36. }
  37. destroy() {}
  38. }
  39. return Region;
  40. } );