diff --git a/core/src/node/macro-node.ts b/core/src/node/macro-node.ts index 90b71c626..3b67402aa 100644 --- a/core/src/node/macro-node.ts +++ b/core/src/node/macro-node.ts @@ -109,3 +109,21 @@ export type ConfigurableInputDynamic = { export type ConfigurableInput = | ConfigurableInputStatic | ConfigurableInputDynamic; + +export const isMacroNode = (p: any): p is MacroNode => { + return p && typeof (p as MacroNode).runFnBuilder === "object"; +}; + +export const isMacroNodeDefinition = ( + p: any +): p is MacroNodeDefinition => { + const { editorConfig } = (p ?? {}) as MacroNodeDefinition; + if (editorConfig?.type === "custom") { + return ( + typeof (editorConfig as MacroEditorConfigCustomDefinition) + .editorComponentBundleContent === "string" + ); + } else { + return editorConfig?.type === "structured"; + } +}; diff --git a/core/src/node/node.ts b/core/src/node/node.ts index 9e0a66fab..81ab386a7 100644 --- a/core/src/node/node.ts +++ b/core/src/node/node.ts @@ -19,7 +19,7 @@ import { nodeOutput, } from "./node-pins"; import { ImportedNode } from "../flow-schema"; -import { MacroNode, MacroNodeDefinition } from "./macro-node"; +import { MacroNodeDefinition } from "./macro-node"; export type NodesCollection = OMap; @@ -218,10 +218,6 @@ export const isCodeNode = (p: Node | NodeDefinition | any): p is CodeNode => { return isBaseNode(p) && typeof (p as CodeNode).run === "function"; }; -export const isMacroNode = (p: any): p is MacroNode => { - return p && typeof (p as MacroNode).runFnBuilder === "function"; -}; - export const extractMetadata: ( node: N ) => NodeMetadata = (node) => { @@ -243,12 +239,6 @@ export const extractMetadata: ( }; }; -export const isMacroNodeDefinition = ( - p: any -): p is MacroNodeDefinition => { - return p && typeof (p as MacroNode).definitionBuilder === "undefined"; -}; - export const isVisualNode = (p: Node | NodeDefinition): p is VisualNode => { return !!(p as VisualNode).instances; }; diff --git a/flow-editor/src/visual-node-editor/instance-view/InstanceView.tsx b/flow-editor/src/visual-node-editor/instance-view/InstanceView.tsx index a006adfe9..821949680 100644 --- a/flow-editor/src/visual-node-editor/instance-view/InstanceView.tsx +++ b/flow-editor/src/visual-node-editor/instance-view/InstanceView.tsx @@ -55,7 +55,7 @@ import { Dialog, Classes, } from "@blueprintjs/core"; -import ReactDOM from "react-dom"; + import { NodeStyleMenu } from "./NodeStyleMenu"; import { useDarkMode } from "../../flow-editor/DarkModeContext";