From 5805c242552e40dde5dd06431050f72edd142506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Thu, 28 Mar 2024 21:46:29 +0000 Subject: [PATCH] Fix copy for code blocks in OpenAPI or AI answers (#2250) --- 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 9979af84d..2d6b81fc5 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: {