Skip to content

Commit 20f41d4

Browse files
committed
fix: Call highlightCodeBlocks after isLoading=false
The preview div only exists when isLoading is false (v-if/v-else-if). Moving the highlight call to finally block ensures the DOM element exists when we try to highlight code blocks.
1 parent 20db860 commit 20f41d4

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

docs/.vitepress/components/DjotPlayground.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ async function convert() {
118118
} else {
119119
htmlOutput.value = data.html || ''
120120
error.value = ''
121-
highlightCodeBlocks()
122121
}
123122
} catch (err) {
124123
if (err instanceof Error && err.name === 'AbortError') {
@@ -128,6 +127,10 @@ async function convert() {
128127
htmlOutput.value = ''
129128
} finally {
130129
isLoading.value = false
130+
// Must highlight after isLoading=false so preview div exists in DOM
131+
if (htmlOutput.value && !error.value) {
132+
highlightCodeBlocks()
133+
}
131134
}
132135
}
133136

0 commit comments

Comments
 (0)