Merge branch 'johnfactotum:main' into main

This commit is contained in:
2026-05-24 19:55:25 -04:00
committed by GitHub
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -351,6 +351,7 @@ export const makeFB2 = async blob => {
}
book.splitTOCHref = href => href?.split('#')?.map(x => Number(x)) ?? []
book.getTOCFragment = (doc, id) => doc.querySelector(`[${dataID}="${id}"]`)
book.isExternal = uri => /^\w+:/i.test(uri)
book.destroy = () => {
for (const url of urls) URL.revokeObjectURL(url)
+2 -2
View File
@@ -357,8 +357,8 @@ export class View extends HTMLElement {
const href_ = a.getAttribute('href')
const href = section?.resolveHref?.(href_) ?? href_
if (book?.isExternal?.(href))
Promise.resolve(this.#emit('external-link', { a, href }, true))
.then(x => x ? globalThis.open(href, '_blank') : null)
Promise.resolve(this.#emit('external-link', { a, href_ }, true))
.then(x => x ? globalThis.open(href_, '_blank') : null)
.catch(e => console.error(e))
else Promise.resolve(this.#emit('link', { a, href }, true))
.then(x => x ? this.goTo(href) : null)