standard fixes

This commit is contained in:
rafapaezbas
2024-01-24 15:58:25 +01:00
parent fda84dcd39
commit 235168ab18

View File

@@ -77,7 +77,6 @@ customElements.define('docs-viewer', class extends HTMLElement {
this.load(evt.target.pathname)
})
window.addEventListener('click', async (evt) => {
evt.preventDefault()
if (evt.target?.tagName !== 'A') return
@@ -101,7 +100,6 @@ customElements.define('docs-viewer', class extends HTMLElement {
}
const docsViewer = document.querySelector('docs-viewer')
await docsViewer.load(evt.state.page, { back: true })
return
})
const config = global[Symbol.for('pear.config')] || {}
@@ -115,7 +113,7 @@ customElements.define('docs-viewer', class extends HTMLElement {
async load (page, opts = {}) {
const html = await fetch(page)
const text = await marked.parse(await html.text())
this.panel.querySelector('slot').innerHTML = text, { headerIds: false, mangle: false }
this.panel.querySelector('slot').innerHTML = text
this.panel.style.display = ''
this.status.style.display = 'none'
if (!opts.back) history.pushState({ page }, null)