Commit 2ec1930b authored by StyleZhang's avatar StyleZhang

fix: segment textarea

parent eb439528
...@@ -28,7 +28,7 @@ const AutoHeightTextarea = forwardRef<HTMLTextAreaElement, AutoHeightTextareaPro ...@@ -28,7 +28,7 @@ const AutoHeightTextarea = forwardRef<HTMLTextAreaElement, AutoHeightTextareaPro
ref.current?.focus() ref.current?.focus()
} }
} }
}, [autoFocus, disabled, ref, value]) }, [autoFocus, disabled, ref])
return ( return (
<div className={outerClassName}> <div className={outerClassName}>
<div className='relative'> <div className='relative'>
......
...@@ -30,6 +30,12 @@ const NewSegmentModal: FC<NewSegmentModalProps> = memo(({ ...@@ -30,6 +30,12 @@ const NewSegmentModal: FC<NewSegmentModalProps> = memo(({
const [answer, setAnswer] = useState('') const [answer, setAnswer] = useState('')
const { datasetId, documentId } = useParams() const { datasetId, documentId } = useParams()
const handleCancel = () => {
setQuestion('')
setAnswer('')
onCancel()
}
const handleSave = async () => { const handleSave = async () => {
const params: SegmentUpdator = { content: '' } const params: SegmentUpdator = { content: '' }
if (docForm === 'qa_model') { if (docForm === 'qa_model') {
...@@ -50,7 +56,7 @@ const NewSegmentModal: FC<NewSegmentModalProps> = memo(({ ...@@ -50,7 +56,7 @@ const NewSegmentModal: FC<NewSegmentModalProps> = memo(({
await addSegment({ datasetId, documentId, body: params }) await addSegment({ datasetId, documentId, body: params })
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
onCancel() handleCancel()
onSave() onSave()
} }
...@@ -94,7 +100,7 @@ const NewSegmentModal: FC<NewSegmentModalProps> = memo(({ ...@@ -94,7 +100,7 @@ const NewSegmentModal: FC<NewSegmentModalProps> = memo(({
<Modal isShow={isShow} onClose={() => {}} className='pt-8 px-8 pb-6 !max-w-[640px] !rounded-xl'> <Modal isShow={isShow} onClose={() => {}} className='pt-8 px-8 pb-6 !max-w-[640px] !rounded-xl'>
<div className={'flex flex-col relative'}> <div className={'flex flex-col relative'}>
<div className='absolute right-0 -top-0.5 flex items-center h-6'> <div className='absolute right-0 -top-0.5 flex items-center h-6'>
<div className='flex justify-center items-center w-6 h-6 cursor-pointer' onClick={onCancel}> <div className='flex justify-center items-center w-6 h-6 cursor-pointer' onClick={handleCancel}>
<XClose className='w-4 h-4 text-gray-500' /> <XClose className='w-4 h-4 text-gray-500' />
</div> </div>
</div> </div>
...@@ -116,7 +122,7 @@ const NewSegmentModal: FC<NewSegmentModalProps> = memo(({ ...@@ -116,7 +122,7 @@ const NewSegmentModal: FC<NewSegmentModalProps> = memo(({
<div className='flex justify-end'> <div className='flex justify-end'>
<Button <Button
className='mr-2 !h-9 !px-4 !py-2 text-sm font-medium text-gray-700 !rounded-lg' className='mr-2 !h-9 !px-4 !py-2 text-sm font-medium text-gray-700 !rounded-lg'
onClick={onCancel}> onClick={handleCancel}>
{t('common.operation.cancel')} {t('common.operation.cancel')}
</Button> </Button>
<Button <Button
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment