mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-29 05:34:19 +01:00
share page bugs
This commit is contained in:
@@ -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?.()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user