diff options
| author | Jay V <[email protected]> | 2025-06-03 17:20:24 -0400 |
|---|---|---|
| committer | Jay V <[email protected]> | 2025-06-03 17:20:30 -0400 |
| commit | 8206da4d9ef5871ebf1cf56f9231eba5b7036fc3 (patch) | |
| tree | c6254891ed4534405f952fe9e7abfd7e3e7abf5a /packages/web/src/components/CodeBlock.tsx | |
| parent | 0c6bda825518326cc5fc81ad379636fb1d79db40 (diff) | |
| download | opencode-8206da4d9ef5871ebf1cf56f9231eba5b7036fc3.tar.gz opencode-8206da4d9ef5871ebf1cf56f9231eba5b7036fc3.zip | |
share page bugs
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?.() } }) |
