plugin.js 680 B

12345678910111213141516171819202122232425262728293031
  1. import { definitions } from './plugins/plugin-definitions';
  2. export default class CrowiPlugin {
  3. /**
  4. * process plugin entry
  5. *
  6. * @param {Crowi} crowi Crowi context class
  7. * @param {CrowiRenderer} crowiRenderer CrowiRenderer
  8. *
  9. * @memberof CrowiPlugin
  10. */
  11. installAll(crowi, crowiRenderer) {
  12. definitions.forEach((definition) => {
  13. const meta = definition.meta;
  14. const entries = definition.entries;
  15. // v1 is deprecated
  16. // v2
  17. if (2 === meta.pluginSchemaVersion) {
  18. entries.forEach((entry) => {
  19. entry(crowi, crowiRenderer);
  20. });
  21. }
  22. });
  23. }
  24. }
  25. window.crowiPlugin = new CrowiPlugin(); // FIXME