diff --git a/components/TextInputArea.tsx b/components/TextInputArea.tsx index f0b32e3..a41c188 100644 --- a/components/TextInputArea.tsx +++ b/components/TextInputArea.tsx @@ -1,8 +1,9 @@ import React, { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react'; -import { Copy, X } from 'lucide-react'; +import { X } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { cn } from '@/lib/utils'; import { toast } from 'sonner'; // 推荐使用 shadcn 的默认 Toast +import { CopyButton } from '@/components/CopyButton'; export type ValidateRule = { validator: (value: string) => boolean; @@ -187,16 +188,6 @@ const TextInputArea = forwardRef((props onClear?.(); }, [isControlled, onChange, onClear, t]); - const handleCopy = useCallback(async () => { - try { - await navigator.clipboard.writeText(value); - toast.success(t('messages.copySuccess')); - } catch { - setError(t('messages.copyError')); - toast.error(t('messages.copyError')); - } - }, [value, t]); - const handleAction = useCallback( (action: ToolbarAction) => { const isDisabled = @@ -284,14 +275,12 @@ const TextInputArea = forwardRef((props {/* 右侧系统按钮组 */}
{allowCopy && value && ( - + )} {showClear && value && !disabled && !readOnly && (