From 228a1f3ace351be3b63b7d8d462e6db68cb954f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Thu, 28 Mar 2024 22:39:21 +0100 Subject: [PATCH] Fix copy for code blocks in OpenAPI or AI answers --- src/components/DocumentView/CodeBlock/PlainCodeBlock.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/DocumentView/CodeBlock/PlainCodeBlock.tsx b/src/components/DocumentView/CodeBlock/PlainCodeBlock.tsx index 9979af84dd..2d6b81fc5b 100644 --- a/src/components/DocumentView/CodeBlock/PlainCodeBlock.tsx +++ b/src/components/DocumentView/CodeBlock/PlainCodeBlock.tsx @@ -1,4 +1,5 @@ import { DocumentBlockCode, JSONDocument } from '@gitbook/api'; +import { useId } from 'react'; import { CodeBlock } from './CodeBlock'; @@ -8,8 +9,10 @@ import { CodeBlock } from './CodeBlock'; */ export function PlainCodeBlock(props: { code: string; syntax: string }) { const { code, syntax } = props; + const id = useId(); const block: DocumentBlockCode = { + key: id, object: 'block', type: 'code', data: {