summaryrefslogtreecommitdiffhomepage
path: root/packages/web/src/components/CodeBlock.tsx
diff options
context:
space:
mode:
authorJay V <[email protected]>2025-06-03 17:20:24 -0400
committerJay V <[email protected]>2025-06-03 17:20:30 -0400
commit8206da4d9ef5871ebf1cf56f9231eba5b7036fc3 (patch)
treec6254891ed4534405f952fe9e7abfd7e3e7abf5a /packages/web/src/components/CodeBlock.tsx
parent0c6bda825518326cc5fc81ad379636fb1d79db40 (diff)
downloadopencode-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.tsx5
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?.()
}
})