draftail.entry.js 839 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import * as Draftail from 'draftail';
  2. import draftail, {
  3. Link,
  4. Document,
  5. ImageBlock,
  6. EmbedBlock,
  7. } from '../../../../../client/src/components/Draftail/index';
  8. /**
  9. * Entry point loaded when the Draftail editor is in use.
  10. */
  11. // Expose Draftail package as a global.
  12. window.Draftail = Draftail;
  13. // Expose module as a global.
  14. window.draftail = draftail;
  15. // Plugins for the built-in entities.
  16. const plugins = [
  17. {
  18. type: 'DOCUMENT',
  19. source: draftail.ModalWorkflowSource,
  20. decorator: Document,
  21. },
  22. {
  23. type: 'LINK',
  24. source: draftail.ModalWorkflowSource,
  25. decorator: Link,
  26. },
  27. {
  28. type: 'IMAGE',
  29. source: draftail.ModalWorkflowSource,
  30. block: ImageBlock,
  31. },
  32. {
  33. type: 'EMBED',
  34. source: draftail.ModalWorkflowSource,
  35. block: EmbedBlock,
  36. },
  37. ];
  38. plugins.forEach(draftail.registerPlugin);