This commit is contained in:
1 parent
850766d54f
commit
f825a523ab
4 files changed
+19
-17
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { Card, ModelSelectModal } from "@/shared/components";
|
||||
import { useCopyToClipboard } from "@/shared/hooks/useCopyToClipboard";
|
||||
import Image from "next/image";
|
||||
|
||||
export default function DefaultToolCard({ toolId, tool, isExpanded, onToggle, baseUrl, apiKeys, activeProviders = [], cloudEnabled = false, tunnelEnabled = false }) {
|
||||
@@ -31,8 +32,10 @@ export default function DefaultToolCard({ toolId, tool, isExpanded, onToggle, ba
|
||||
.replace(/\{\{model\}\}/g, modelValue || "provider/model-id");
|
||||
};
|
||||
|
||||
const { copy: copyToClipboard } = useCopyToClipboard();
|
||||
|
||||
const handleCopy = async (text, field) => {
|
||||
await navigator.clipboard.writeText(replaceVars(text));
|
||||
await copyToClipboard(replaceVars(text), `toolcard-${field}`);
|
||||
setCopiedField(field);
|
||||
setTimeout(() => setCopiedField(null), 2000);
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { Card, Button } from "@/shared/components";
|
||||
import { useCopyToClipboard } from "@/shared/hooks/useCopyToClipboard";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
const Editor = dynamic(() => import("@monaco-editor/react"), { ssr: false });
|
||||
@@ -187,9 +188,11 @@ export default function TranslatorPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const { copy } = useCopyToClipboard();
|
||||
|
||||
const handleCopy = async (id) => {
|
||||
if (!contents[id]) return;
|
||||
await navigator.clipboard.writeText(contents[id]);
|
||||
copy(contents[id], `translator-step-${id}`);
|
||||
};
|
||||
|
||||
const handleFormat = (id) => {
|
||||
|
||||
Reference in new issue
Block a user