mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Rename uri to href
This commit is contained in:
@@ -109,14 +109,14 @@ export class View {
|
|||||||
for (const a of doc.querySelectorAll('a[href]'))
|
for (const a of doc.querySelectorAll('a[href]'))
|
||||||
a.addEventListener('click', e => {
|
a.addEventListener('click', e => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const href = a.getAttribute('href')
|
const href_ = a.getAttribute('href')
|
||||||
const uri = section?.resolveHref?.(href) ?? href
|
const href = section?.resolveHref?.(href_) ?? href_
|
||||||
if (book?.isExternal?.(uri))
|
if (book?.isExternal?.(href))
|
||||||
Promise.resolve(emit?.({ type: 'external-link', a, uri }))
|
Promise.resolve(emit?.({ type: 'external-link', a, href }))
|
||||||
.then(x => x ? null : window.open(uri, '_blank'))
|
.then(x => x ? null : window.open(href, '_blank'))
|
||||||
.catch(e => console.error(e))
|
.catch(e => console.error(e))
|
||||||
else Promise.resolve(emit?.({ type: 'link', a, uri }))
|
else Promise.resolve(emit?.({ type: 'link', a, href }))
|
||||||
.then(x => x ? null : this.goTo(uri))
|
.then(x => x ? null : this.goTo(href))
|
||||||
.catch(e => console.error(e))
|
.catch(e => console.error(e))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user