mirror of
https://github.com/aljazceru/pear-docs.git
synced 2025-12-17 22:44:21 +01:00
standard fixes
This commit is contained in:
@@ -77,7 +77,6 @@ customElements.define('docs-viewer', class extends HTMLElement {
|
|||||||
this.load(evt.target.pathname)
|
this.load(evt.target.pathname)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
window.addEventListener('click', async (evt) => {
|
window.addEventListener('click', async (evt) => {
|
||||||
evt.preventDefault()
|
evt.preventDefault()
|
||||||
if (evt.target?.tagName !== 'A') return
|
if (evt.target?.tagName !== 'A') return
|
||||||
@@ -101,7 +100,6 @@ customElements.define('docs-viewer', class extends HTMLElement {
|
|||||||
}
|
}
|
||||||
const docsViewer = document.querySelector('docs-viewer')
|
const docsViewer = document.querySelector('docs-viewer')
|
||||||
await docsViewer.load(evt.state.page, { back: true })
|
await docsViewer.load(evt.state.page, { back: true })
|
||||||
return
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const config = global[Symbol.for('pear.config')] || {}
|
const config = global[Symbol.for('pear.config')] || {}
|
||||||
@@ -115,7 +113,7 @@ customElements.define('docs-viewer', class extends HTMLElement {
|
|||||||
async load (page, opts = {}) {
|
async load (page, opts = {}) {
|
||||||
const html = await fetch(page)
|
const html = await fetch(page)
|
||||||
const text = await marked.parse(await html.text())
|
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.panel.style.display = ''
|
||||||
this.status.style.display = 'none'
|
this.status.style.display = 'none'
|
||||||
if (!opts.back) history.pushState({ page }, null)
|
if (!opts.back) history.pushState({ page }, null)
|
||||||
|
|||||||
Reference in New Issue
Block a user