Merge pull request #52 from FungYuu/docs-free

docs: Modify the FixedLayoutProps in a free layout
This commit is contained in:
xiamidaxia 2025-03-18 15:21:02 +08:00 committed by GitHub
commit 6c13bffbf3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -40,7 +40,7 @@ Canvas configuration is declarative, providing data, rendering, event, and plugi
```tsx pure title="use-editor-props.tsx" ```tsx pure title="use-editor-props.tsx"
import { useMemo } from 'react'; import { useMemo } from 'react';
import { type FixedLayoutProps } from '@flowgram.ai/free-layout-editor'; import { type FreeLayoutProps } from '@flowgram.ai/free-layout-editor';
import { createMinimapPlugin } from '@flowgram.ai/minimap-plugin'; import { createMinimapPlugin } from '@flowgram.ai/minimap-plugin';
import { intialData } from './initial-data' // 初始化数据 import { intialData } from './initial-data' // 初始化数据
@ -48,8 +48,8 @@ import { nodeRegistries } from './node-registries' // 节点声明配置
import { BaseNode } from './base-node' // 节点渲染 import { BaseNode } from './base-node' // 节点渲染
export function useEditorProps( export function useEditorProps(
): FixedLayoutProps { ): FreeLayoutProps {
return useMemo<FixedLayoutProps>( return useMemo<FreeLayoutProps>(
() => ({ () => ({
/** /**
* Initialize data * Initialize data
@ -271,7 +271,7 @@ export const BaseNode = () => {
*/ */
const { form } = useNodeRender() const { form } = useNodeRender()
/** /**
* WorkflowNodeRenderer will add node drag events and port rendering, for deep customization, * WorkflowNodeRenderer will add node drag events and port rendering, for deep customization,
* you can check the component source code at: * you can check the component source code at:
* https://github.com/bytedance/flowgram.ai/blob/main/packages/client/free-layout-editor/src/components/workflow-node-renderer.tsx * https://github.com/bytedance/flowgram.ai/blob/main/packages/client/free-layout-editor/src/components/workflow-node-renderer.tsx
*/ */

View File

@ -42,7 +42,7 @@ function App() {
```tsx pure title="use-editor-props.tsx" ```tsx pure title="use-editor-props.tsx"
import { useMemo } from 'react'; import { useMemo } from 'react';
import { type FixedLayoutProps } from '@flowgram.ai/free-layout-editor'; import { type FreeLayoutProps } from '@flowgram.ai/free-layout-editor';
import { createMinimapPlugin } from '@flowgram.ai/minimap-plugin'; import { createMinimapPlugin } from '@flowgram.ai/minimap-plugin';
import { intialData } from './initial-data' // 初始化数据 import { intialData } from './initial-data' // 初始化数据
@ -50,8 +50,8 @@ import { nodeRegistries } from './node-registries' // 节点声明配置
import { BaseNode } from './base-node' // 节点渲染 import { BaseNode } from './base-node' // 节点渲染
export function useEditorProps( export function useEditorProps(
): FixedLayoutProps { ): FreeLayoutProps {
return useMemo<FixedLayoutProps>( return useMemo<FreeLayoutProps>(
() => ({ () => ({
/** /**
* 初始化数据 * 初始化数据