index.js 816 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import Editor from '@components/Base/Editor';
  2. import {
  3. KONI_CONTAINER,
  4. KONI_CLASS_NAME,
  5. EVENT_BEFORE_ADD_PAGE,
  6. EVENT_AFTER_ADD_PAGE,
  7. } from '@common/constants';
  8. import Page from '@components/Page';
  9. import withGGEditorContext from '@common/context/GGEditorContext/withGGEditorContext';
  10. class Koni extends Page {
  11. static defaultProps = {
  12. data: {
  13. nodes: [],
  14. edges: [],
  15. },
  16. };
  17. get pageId() {
  18. const { editor } = this.props;
  19. return `${KONI_CONTAINER}_${editor.id}`;
  20. }
  21. initPage() {
  22. const { editor } = this.props;
  23. editor.emit(EVENT_BEFORE_ADD_PAGE, { className: KONI_CLASS_NAME });
  24. this.page = new Editor.Koni(this.config);
  25. editor.add(this.page);
  26. editor.emit(EVENT_AFTER_ADD_PAGE, { page: this.page });
  27. }
  28. }
  29. export default withGGEditorContext(Koni);