mirror of
https://github.com/aljazceru/pear-docs.git
synced 2025-12-17 22:44:21 +01:00
fix config link load
This commit is contained in:
@@ -103,14 +103,15 @@ customElements.define('docs-viewer', class extends HTMLElement {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const config = global[Symbol.for('pear.config')] || {}
|
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 () => {
|
window.addEventListener('load', async () => {
|
||||||
await this.load(config.link.slice(5))
|
await this.load(config.link.slice(12))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async load (page, opts = {}) {
|
async load (page, opts = {}) {
|
||||||
|
if (page.length === 0) return
|
||||||
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
|
this.panel.querySelector('slot').innerHTML = text
|
||||||
|
|||||||
Reference in New Issue
Block a user