perf:textarea auto height (#2967)
* perf:textarea auto height * optimize editor height & fix variable label split
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import React, { useCallback, useEffect, useMemo } from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { Controller, UseFormReturn } from 'react-hook-form';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Card,
|
||||
Input,
|
||||
NumberDecrementStepper,
|
||||
NumberIncrementStepper,
|
||||
NumberInput,
|
||||
@@ -24,7 +23,7 @@ import { ChatBoxContext } from '../Provider';
|
||||
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
||||
import { useDeepCompareEffect } from 'ahooks';
|
||||
import { VariableItemType } from '@fastgpt/global/core/app/type';
|
||||
import PromptEditor from '@fastgpt/web/components/common/Textarea/PromptEditor';
|
||||
import MyTextarea from '@/components/common/Textarea/MyTextarea';
|
||||
|
||||
export const VariableInputItem = ({
|
||||
item,
|
||||
@@ -60,13 +59,13 @@ export const VariableInputItem = ({
|
||||
{item.description && <QuestionTip ml={1} label={item.description} />}
|
||||
</Box>
|
||||
{item.type === VariableInputEnum.input && (
|
||||
<PromptEditor
|
||||
value={item.defaultValue}
|
||||
onChange={(e) => setValue(item.key, e)}
|
||||
bg={'myGray.50'}
|
||||
<MyTextarea
|
||||
autoHeight
|
||||
minH={40}
|
||||
maxH={150}
|
||||
showOpenModal={false}
|
||||
maxH={160}
|
||||
bg={'myGray.50'}
|
||||
value={item.defaultValue}
|
||||
onChange={(e) => setValue(item.key, e.target.value)}
|
||||
/>
|
||||
)}
|
||||
{item.type === VariableInputEnum.textarea && (
|
||||
|
||||
@@ -38,7 +38,7 @@ import { FlowNodeInputTypeEnum } from '@fastgpt/global/core/workflow/node/consta
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import MySelect from '@fastgpt/web/components/common/MySelect';
|
||||
import PromptEditor from '@fastgpt/web/components/common/Textarea/PromptEditor';
|
||||
import MyTextarea from '@/components/common/Textarea/MyTextarea';
|
||||
|
||||
type props = {
|
||||
value: UserChatItemValueItemType | AIChatItemValueItemType;
|
||||
@@ -221,12 +221,15 @@ const RenderUserFormInteractive = React.memo(function RenderFormInput({
|
||||
{input.description && <QuestionTip ml={1} label={input.description} />}
|
||||
</Flex>
|
||||
{input.type === FlowNodeInputTypeEnum.input && (
|
||||
<PromptEditor
|
||||
value={input.value}
|
||||
onChange={(e) => setValue(input.label, e)}
|
||||
<MyTextarea
|
||||
isDisabled={interactive.params.submitted}
|
||||
{...register(input.label, {
|
||||
required: input.required
|
||||
})}
|
||||
bg={'white'}
|
||||
autoHeight
|
||||
minH={40}
|
||||
maxH={100}
|
||||
showOpenModal={false}
|
||||
/>
|
||||
)}
|
||||
{input.type === FlowNodeInputTypeEnum.textarea && (
|
||||
|
||||
Reference in New Issue
Block a user