8
0

plugin.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 './observablemixin.js';
  7. import utils from './utils.js';
  8. /**
  9. * The base class for CKEditor plugin classes.
  10. *
  11. * @class core.Plugin
  12. * @mixins core.ObservableMixin
  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. * @type {core.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. * @type {Function[]}
  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 );