diff options
Diffstat (limited to 'packages/web/src/components/CodeBlock.tsx')
| -rw-r--r-- | packages/web/src/components/CodeBlock.tsx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/web/src/components/CodeBlock.tsx b/packages/web/src/components/CodeBlock.tsx index b3a0d3f2e..a9bfae8be 100644 --- a/packages/web/src/components/CodeBlock.tsx +++ b/packages/web/src/components/CodeBlock.tsx @@ -12,9 +12,10 @@ import { transformerNotationDiff } from "@shikijs/transformers" interface CodeBlockProps extends JSX.HTMLAttributes<HTMLDivElement> { code: string lang?: string + onRendered?: () => void } function CodeBlock(props: CodeBlockProps) { - const [local, rest] = splitProps(props, ["code", "lang"]) + const [local, rest] = splitProps(props, ["code", "lang", "onRendered"]) let containerRef!: HTMLDivElement const [html] = createResource(async () => { @@ -35,6 +36,8 @@ function CodeBlock(props: CodeBlockProps) { createEffect(() => { if (html() && containerRef) { containerRef.innerHTML = html() as string + + local.onRendered?.() } }) |
