Skip to content
Open
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
10 changes: 7 additions & 3 deletions src/components/MDX/TerminalBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ function TerminalBlock({level = 'info', children}: TerminalBlockProps) {
<div>
<button
className="w-full text-start text-primary-dark dark:text-primary-dark "
onClick={() => {
window.navigator.clipboard.writeText(message ?? '');
setCopied(true);
onClick={async () => {
try {
await window.navigator.clipboard.writeText(message ?? '');
setCopied(true);
} catch {
// Ignore clipboard errors (e.g. permission denied).
}
}}>
<IconCopy className="inline-flex me-2 self-center" />{' '}
{copied ? 'Copied' : 'Copy'}
Expand Down
Loading