plugin.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 ObservableMixin from '../utils/observablemixin.js';
  7. import utils from '../utils/utils.js';
  8. /**
  9. * The base class for CKEditor plugin classes.
  10. *
  11. * @memberOf core
  12. * @mixes utils.ObservaleMixin
  13. */
  14. export default class Plugin {
  15. /**
  16. * Creates a new Plugin instance.
  17. *
  18. * @param {core.Editor} editor
  19. */
  20. constructor( editor ) {
  21. /**
  22. * @readonly
  23. * @member {core.Editor} core.Plugin#editor
  24. */
  25. this.editor = editor;
  26. }
  27. /**
  28. * An array of plugins required by this plugin.
  29. *
  30. * To keep a plugin class definition tight it's recommended to define this property as a static getter:
  31. *
  32. * import Image from './image.js';
  33. *
  34. * export default class ImageCaption extends Feature {
  35. * static get requires() {
  36. * return [ Image ];
  37. * }
  38. * }
  39. *
  40. * @static
  41. * @member {Function[]} core.Plugin.requires
  42. */
  43. /**
  44. * @returns {null|Promise}
  45. */
  46. init() {}
  47. /**
  48. * Destroys the plugin.
  49. *
  50. * TODO waits to be implemented (#186).
  51. */
  52. destroy() {}
  53. }
  54. utils.mix( Plugin, ObservableMixin );