Skip to content

Commit b052132

Browse files
author
Jaap-Hein Wester
committed
Test if <BrowserOnly> code blocks fix CSP issues
1 parent 589450f commit b052132

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/theme/CodeBlock/index.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, {type ReactNode} from 'react';
2+
import CodeBlock from '@theme-original/CodeBlock';
3+
import type CodeBlockType from '@theme/CodeBlock';
4+
import type {WrapperProps} from '@docusaurus/types';
5+
import BrowserOnly from '@docusaurus/BrowserOnly';
6+
7+
type Props = WrapperProps<typeof CodeBlockType>;
8+
9+
export default function CodeBlockWrapper(props: Props): ReactNode {
10+
return (
11+
<BrowserOnly>
12+
{() => (
13+
<CodeBlock {...props} />
14+
)}
15+
</BrowserOnly>
16+
);
17+
}

0 commit comments

Comments
 (0)