chore(frontend): 同步工作区剪贴板处理
This commit is contained in:
parent
c532f830d9
commit
51f38226ac
|
|
@ -3,7 +3,6 @@ import { useCallback, useState, type ComponentProps } from "react";
|
|||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useI18n } from "@/core/i18n/hooks";
|
||||
import { copyToClipboard } from "@/lib/utils";
|
||||
|
||||
import { Tooltip } from "./tooltip";
|
||||
|
||||
|
|
@ -16,7 +15,7 @@ export function CopyButton({
|
|||
const { t } = useI18n();
|
||||
const [copied, setCopied] = useState(false);
|
||||
const handleCopy = useCallback(() => {
|
||||
void copyToClipboard(clipboardData);
|
||||
void navigator.clipboard.writeText(clipboardData);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
}, [clipboardData]);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ import {
|
|||
import type { AgentThread, AgentThreadState } from "@/core/threads/types";
|
||||
import { pathOfThread, titleOfThread } from "@/core/threads/utils";
|
||||
import { env } from "@/env";
|
||||
import { copyToClipboard } from "@/lib/utils";
|
||||
|
||||
export function RecentChatList() {
|
||||
const { t } = useI18n();
|
||||
|
|
@ -120,7 +119,7 @@ export function RecentChatList() {
|
|||
const baseUrl = isLocalhost ? VERCEL_URL : window.location.origin;
|
||||
const shareUrl = `${baseUrl}/workspace/chats/${threadId}`;
|
||||
try {
|
||||
await copyToClipboard(shareUrl);
|
||||
await navigator.clipboard.writeText(shareUrl);
|
||||
toast.success(t.clipboard.linkCopied);
|
||||
} catch {
|
||||
toast.error(t.clipboard.failedToCopyToClipboard);
|
||||
|
|
|
|||
Loading…
Reference in New Issue