mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-02 02:02:18 +00:00
feat(copy-logs): simplify clipboard copy functionality using copy-to-clipboard library
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import copy from "copy-to-clipboard";
|
||||
import {
|
||||
Download as DownloadIcon,
|
||||
Check,
|
||||
Copy,
|
||||
Download as DownloadIcon,
|
||||
Loader2,
|
||||
Pause,
|
||||
Play,
|
||||
@@ -261,17 +262,8 @@ export const DockerLogsId: React.FC<Props> = ({
|
||||
)
|
||||
.join("\n");
|
||||
|
||||
try {
|
||||
await navigator.clipboard.writeText(logContent);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
} catch {
|
||||
const textarea = document.createElement("textarea");
|
||||
textarea.value = logContent;
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(textarea);
|
||||
const success = copy(logContent);
|
||||
if (success) {
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user