feat(workflow): add node duplication
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* 画布内共享上下文。GenericNode / ConditionEdge 由 ReactFlow 渲染,拿不到外层
|
||||
* 回调,统一通过这些 context 取节点规格与编辑/删除动作。
|
||||
* 回调,统一通过这些 context 取节点规格与编辑/复制/删除动作。
|
||||
*/
|
||||
|
||||
import { createContext } from "react";
|
||||
@@ -17,9 +17,14 @@ export type ElementActions = {
|
||||
remove: (id: string) => void;
|
||||
};
|
||||
|
||||
const noop: ElementActions = { edit: () => {}, remove: () => {} };
|
||||
export type NodeActions = ElementActions & {
|
||||
duplicate: (id: string) => void;
|
||||
};
|
||||
|
||||
export const NodeActionContext = createContext<ElementActions>(noop);
|
||||
const noop: ElementActions = { edit: () => {}, remove: () => {} };
|
||||
const noopNodeActions: NodeActions = { ...noop, duplicate: () => {} };
|
||||
|
||||
export const NodeActionContext = createContext<NodeActions>(noopNodeActions);
|
||||
export const EdgeActionContext = createContext<ElementActions>(noop);
|
||||
|
||||
/** 调试通话中当前激活的节点 id(画布据此高亮),无激活为 null。 */
|
||||
|
||||
Reference in New Issue
Block a user