editor.tsx 872 B

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import {
  6. EditorRenderer,
  7. FlowNodeRegistry,
  8. FreeLayoutEditorProvider,
  9. WorkflowJSON,
  10. } from '@flowgram.ai/free-layout-editor';
  11. import { useEditorProps } from './hooks/use-editor-props';
  12. import '@flowgram.ai/free-layout-editor/index.css';
  13. import './index.css';
  14. interface EditorProps {
  15. registry: FlowNodeRegistry;
  16. initialData: WorkflowJSON;
  17. }
  18. export const Editor = ({ registry, initialData }: EditorProps) => {
  19. const editorProps = useEditorProps({ registries: [registry], initialData });
  20. return (
  21. <FreeLayoutEditorProvider {...editorProps}>
  22. <div className="demo-free-container">
  23. <div className="demo-free-layout">
  24. <EditorRenderer className="demo-free-editor" />
  25. </div>
  26. </div>
  27. </FreeLayoutEditorProvider>
  28. );
  29. };