diff --git a/web/app/components/workflow/nodes/_base/components/editor/code-editor.tsx b/web/app/components/workflow/nodes/_base/components/editor/code-editor.tsx index dcc20c8975..d8e819c118 100644 --- a/web/app/components/workflow/nodes/_base/components/editor/code-editor.tsx +++ b/web/app/components/workflow/nodes/_base/components/editor/code-editor.tsx @@ -7,6 +7,7 @@ type Props = { value: string onChange: (value: string) => void title: JSX.Element + language?: string headerRight?: JSX.Element } diff --git a/web/app/components/workflow/nodes/_base/components/editor/text-editor.tsx b/web/app/components/workflow/nodes/_base/components/editor/text-editor.tsx new file mode 100644 index 0000000000..2e0d9f1049 --- /dev/null +++ b/web/app/components/workflow/nodes/_base/components/editor/text-editor.tsx @@ -0,0 +1,54 @@ +'use client' +import type { FC } from 'react' +import React, { useCallback } from 'react' +import { useBoolean } from 'ahooks' +import Base from './base' + +type Props = { + value: string + onChange: (value: string) => void + title: JSX.Element + headerRight?: JSX.Element + minHeight?: number + onBlur?: () => void +} + +const TextEditor: FC = ({ + value, + onChange, + title, + headerRight, + minHeight, + onBlur, +}) => { + const [isFocus, { + setTrue: setIsFocus, + setFalse: setIsNotFocus, + }] = useBoolean(false) + + const handleBlur = useCallback(() => { + setIsNotFocus() + onBlur?.() + }, [setIsNotFocus, onBlur]) + + return ( +
+ +