Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/components/smartLink.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import * as Sentry from '@sentry/nextjs';
import Link from 'next/link';
import {useCallback} from 'react';

Expand Down Expand Up @@ -30,10 +31,17 @@ export function SmartLink({
}: Props) {
const realTo = to || href || '';

const handleAutolinkClick = useCallback((e: React.MouseEvent) => {
const handleAutolinkClick = useCallback(async (e: React.MouseEvent) => {
const link = e.currentTarget as HTMLAnchorElement;
if (link.classList.contains('autolink-heading')) {
navigator.clipboard.writeText(link.href);
try {
await navigator.clipboard.writeText(link.href);
} catch {
Sentry.logger.warn('clipboard.writeText permission denied', {
url: link.href,
userAgent: navigator.userAgent,
});
}
}
}, []);

Expand Down
Loading