Merge pull request #21 from holepunchto/fix-config-link

fix config link load
This commit is contained in:
David Mark Clements
2024-01-24 16:24:07 +01:00
committed by GitHub

View File

@@ -103,14 +103,15 @@ customElements.define('docs-viewer', class extends HTMLElement {
})
const config = global[Symbol.for('pear.config')] || {}
if (config.link && config.link !== 'pear:dev') {
if (config.link.indexOf('pear://pulse') === 0) {
window.addEventListener('load', async () => {
await this.load(config.link.slice(5))
await this.load(config.link.slice(12))
})
}
}
async load (page, opts = {}) {
if (page.length === 0) return
const html = await fetch(page)
const text = await marked.parse(await html.text())
this.panel.querySelector('slot').innerHTML = text