diff --git a/packages/sanity/package.json b/packages/sanity/package.json index bba29baeec4..11b1bf2ef6c 100644 --- a/packages/sanity/package.json +++ b/packages/sanity/package.json @@ -183,7 +183,6 @@ "@sentry/react": "^8.33.0", "@tanstack/react-table": "^8.16.0", "@tanstack/react-virtual": "3.0.0-beta.54", - "@types/react-copy-to-clipboard": "^5.0.2", "@types/react-is": "^18.3.0", "@types/shallow-equals": "^1.0.0", "@types/speakingurl": "^13.0.3", @@ -238,7 +237,6 @@ "quick-lru": "^5.1.1", "raf": "^3.4.1", "react-compiler-runtime": "19.0.0-beta-37ed2a7-20241206", - "react-copy-to-clipboard": "^5.0.4", "react-fast-compare": "^3.2.0", "react-focus-lock": "^2.8.1", "react-i18next": "14.0.2", diff --git a/packages/sanity/src/structure/components/confirmDeleteDialog/ConfirmDeleteDialogBody.tsx b/packages/sanity/src/structure/components/confirmDeleteDialog/ConfirmDeleteDialogBody.tsx index 8dab14b816c..bb323030731 100644 --- a/packages/sanity/src/structure/components/confirmDeleteDialog/ConfirmDeleteDialogBody.tsx +++ b/packages/sanity/src/structure/components/confirmDeleteDialog/ConfirmDeleteDialogBody.tsx @@ -7,7 +7,6 @@ import { } from '@sanity/icons' import {Box, Card, Flex, Stack, Text, useToast} from '@sanity/ui' import {useCallback} from 'react' -import CopyToClipboard from 'react-copy-to-clipboard' import {SanityDefaultPreview, Translate, useSchema, useTranslation} from 'sanity' import {Button} from '../../../ui-components' @@ -232,28 +231,36 @@ export function ConfirmDeleteDialogBody({ {documentId || 'unavailable'} {documentId && ( - { - toast.push({ - title: t( - 'confirm-delete-dialog.cdr-table.id-copied-toast.title', - ), - status: 'success', - }) + onClick={() => { + navigator.clipboard + .writeText(documentId) + .then(() => { + toast.push({ + status: 'success', + title: t( + 'confirm-delete-dialog.cdr-table.id-copied-toast.title', + ), + }) + }) + .catch(() => { + toast.push({ + status: 'error', + title: t( + 'confirm-delete-dialog.cdr-table.id-copied-toast.title-failed', + ), + }) + }) }} - > -