Files
EasyFlow/easyflow-ui-admin/packages/tinyflow-ui/src/components/utils/NodeUtils.ts
陈子默 7e7c236c2a fix: 修复管理端前端 lint 与构建问题
- 收敛 easyflow-ui-admin 的 lint、格式和类型问题

- 修正 demo 页面与管理端前端构建失败点

- 验证 pnpm lint 与 pnpm build 均已通过
2026-04-05 21:39:13 +08:00

27 lines
709 B
TypeScript

import { getContext } from 'svelte';
import { useNodesData, useSvelteFlow } from '@xyflow/svelte';
import type { TinyflowOptions } from '#types';
export const getCurrentNodeId = () => {
return getContext<string>('svelteflow__node_id');
};
export const getOptions = () => {
return getContext<TinyflowOptions>('tinyflow_options');
};
export const useCurrentNodeData = () => {
const currentNodeId = getCurrentNodeId();
return useNodesData<any>(currentNodeId);
};
export const useUpdateNodeData = () => {
const { updateNodeData } = useSvelteFlow();
const currentNodeId = getCurrentNodeId();
return {
updateNodeData: (data: any) => {
updateNodeData(currentNodeId, data);
},
};
};