Skip to content

Commit

Permalink
fix img onerror looping
Browse files Browse the repository at this point in the history
  • Loading branch information
arily committed Aug 6, 2023
1 parent 323c387 commit adadd4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/content/render.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ async function hl() {
if (!language) {
return
}
cb.innerHTML = hljs.highlight(language, (cb as HTMLElement).innerText).value
const result = hljs.highlight((cb as HTMLElement).innerText, { language }).value
cb.innerHTML = result
})
html.value = el.value.innerHTML
}
Expand Down
3 changes: 2 additions & 1 deletion src/utils/lazyImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export function loadImage(src: string) {
})
}

export function placeholder(e: Event & { target: HTMLImageElement }) {
export function placeholder(e: ErrorEvent & { target: HTMLImageElement }) {
e.target.onerror = null
e.target.src = '/images/image-placeholder.svg'
}

0 comments on commit adadd4d

Please sign in to comment.