share page bugs

This commit is contained in:
Jay V
2025-06-03 17:20:24 -04:00
parent 0c6bda8255
commit 8206da4d9e
2 changed files with 7 additions and 9 deletions

View File

@@ -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?.()
}
})