fix: add clipboard fallback for navigator.clipboard unavailable contexts (closes #696) (#699)

This commit is contained in:
Anurag Saxena authored and GitHub committed 2026-04-22 10:12:55 +07:00
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, 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) => {