diff --git a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/PieceFormItem/arrayInput.tsx b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/PieceFormItem/arrayInput.tsx index 5b74fde1..be6b4510 100644 --- a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/PieceFormItem/arrayInput.tsx +++ b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/PieceFormItem/arrayInput.tsx @@ -125,7 +125,7 @@ const ArrayInput: React.FC = ({ return "DatetimeInput"; } else if ( subItemSchema?.type === "string" && - subItemSchema?.widget === "codeeditor" + subItemSchema?.widget.includes("codeeditor") ) { return "CodeEditorInput"; } else if (subItemSchema?.type === "object") { @@ -300,7 +300,14 @@ const ArrayInput: React.FC = ({ )} {!fromUpstream && elementType === "CodeEditorInput" && ( - + )} {!fromUpstream && elementType === "Unknown" && ( diff --git a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/PieceFormItem/index.tsx b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/PieceFormItem/index.tsx index dcd35dc6..75ed4e89 100644 --- a/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/PieceFormItem/index.tsx +++ b/frontend/src/features/workflowEditor/components/SidebarForm/PieceForm/PieceFormItem/index.tsx @@ -181,50 +181,21 @@ const PieceFormItem: React.FC = ({ ("type" in schema && "widget" in schema && schema.type === "string" && - (schema.widget === "codeeditor" || - schema.widget === "codeeditor-python")) || + schema.widget?.includes("codeeditor")) ?? ("widget" in schema && - (schema.widget === "codeeditor" || - schema.widget === "codeeditor-python") && - anyOfType === "string") - ) { - inputElement = ( - - name={`inputs.${itemKey}.value`} - language="python" - placeholder="Enter Python code." - /> - ); - } else if ( - ("type" in schema && - "widget" in schema && - schema.type === "string" && - schema.widget === "codeeditor-json") || - ("widget" in schema && - (schema.widget === "codeeditor" || schema.widget === "codeeditor-json") && - anyOfType === "string") - ) { - inputElement = ( - - name={`inputs.${itemKey}.value`} - language="json" - placeholder="Enter JSON code." - /> - ); - } else if ( - ("type" in schema && - "widget" in schema && - schema.type === "string" && - schema.widget === "codeeditor-sql") || - ("widget" in schema && - (schema.widget === "codeeditor" || schema.widget === "codeeditor-sql") && + schema.widget?.includes("codeeditor") && anyOfType === "string") ) { + const language = + schema.widget === "codeeditor" + ? "python" + : schema.widget.replace("codeeditor-", ""); + inputElement = ( name={`inputs.${itemKey}.value`} - language="sql" - placeholder="Enter SQL code." + language={language} + placeholder={`Enter yor ${language} code here.`} /> ); } else if (