editor.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. * Represents a single editor instance.
  8. *
  9. * @class Editor
  10. */
  11. CKEDITOR.define( [ 'ckeditor', 'mvc/model', 'utils' ], function( CKEDITOR, Model ) {
  12. var Editor = Model.extend( {
  13. /**
  14. * Creates a new instance of the Editor class.
  15. *
  16. * This constructor should be rarely used. When creating new editor instance use instead the
  17. * {@link CKEDITOR#create CKEDITOR.create() method}.
  18. *
  19. * @param {HTMLElement} element The DOM element that will be the source for the created editor.
  20. * @constructor
  21. */
  22. constructor: function Editor( element ) {
  23. /**
  24. * The original host page element upon which the editor is created. It is only supposed to be provided on
  25. * editor creation and is not subject to be modified.
  26. *
  27. * @readonly
  28. * @property {HTMLElement}
  29. */
  30. this.element = element;
  31. },
  32. /**
  33. * Destroys the editor instance, releasing all resources used by it. If the editor replaced an element, the
  34. * element will be recovered.
  35. *
  36. * @fires destroy
  37. */
  38. destroy: function() {
  39. this.fire( 'destroy' );
  40. delete this.element;
  41. }
  42. } );
  43. return Editor;
  44. } );
  45. /**
  46. * Fired when this editor instance is destroyed. The editor at this point is not usable and this event should be used to
  47. * perform the clean-up in any plugin.
  48. *
  49. * @event destroy
  50. */