From 1ff64e4881e4e757808e287208890d9008ed0a0a Mon Sep 17 00:00:00 2001 From: dv Date: Thu, 28 May 2026 16:38:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B2=D1=8B=D1=84=D0=B2=D1=8B=D1=84=D0=B2?= =?UTF-8?q?=D1=84=D1=8B=D0=B2=D1=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/SnapshotDashboard.tsx | 36 ++++++++++++++++++------ 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/frontend/src/pages/SnapshotDashboard.tsx b/frontend/src/pages/SnapshotDashboard.tsx index 7e373b7..b98e1f7 100644 --- a/frontend/src/pages/SnapshotDashboard.tsx +++ b/frontend/src/pages/SnapshotDashboard.tsx @@ -48,6 +48,21 @@ import { dayjs.extend(relativeTime) dayjs.locale('ru') +function copyToClipboard(text: string) { + if (navigator.clipboard && window.isSecureContext) { + navigator.clipboard.writeText(text) + } else { + const textarea = document.createElement('textarea') + textarea.value = text + textarea.style.position = 'fixed' + textarea.style.left = '-9999px' + document.body.appendChild(textarea) + textarea.select() + document.execCommand('copy') + document.body.removeChild(textarea) + } +} + const UNGROUPED = '__none__' const CATEGORY_OPTIONS = [ @@ -566,7 +581,7 @@ function DevicesList({ const handleCopy = async (snapshotId: number) => { try { const content = await fetchSnapshotContent(snapshotId) - await navigator.clipboard.writeText(content) + copyToClipboard(content) message.success('Скопировано в буфер обмена') } catch { message.error('Ошибка при копировании') @@ -600,9 +615,9 @@ function DevicesList({ } } - const handleViewCopy = async () => { + const handleViewCopy = () => { if (viewContent) { - await navigator.clipboard.writeText(viewContent) + copyToClipboard(viewContent) message.success('Скопировано в буфер обмена') } } @@ -691,14 +706,17 @@ function DevicesList({ pagination={false} /> + {viewTitle} + + + } open={viewContent !== null} onCancel={() => setViewContent(null)} - footer={ - - } + footer={null} width={800} maskClosable destroyOnClose