diff --git a/packages/ui/src/editor/renderers/code-block.tsx b/packages/ui/src/editor/renderers/code-block.tsx index 2979eeeb..2e47f8f5 100644 --- a/packages/ui/src/editor/renderers/code-block.tsx +++ b/packages/ui/src/editor/renderers/code-block.tsx @@ -14,11 +14,11 @@ export const CodeBlockRenderer = ({ node, keyPrefix, }: CodeBlockRendererProps) => { - const language = node.attributes.language; + const language = node.attrs?.language; const [copied, setCopied] = useState(false); - const code = node.attributes.content?.[0].text ?? ''; + const code = node.content?.[0]?.text ?? ''; if (!code) { return null; } @@ -43,11 +43,13 @@ export const CodeBlockRenderer = ({
{copied ? 'Copied' : 'Copy code'}
- {highlight ? ( + {highlight && highlight.language && highlight.nodes?.length > 0 ? (
- {highlight.nodes.map((node, index) => (
+ {highlight?.nodes.map((node, index) => (