Bottom-anchor banner artwork, instant navigation via in-memory page cache, seed/stars/structure tweaks
- Fix banner artwork sizing: explicit 100% grid track so children stretch instead of resolving height:100% against a content-sized row (SVG intrinsic ratio bloated the row, cropping the artwork's bottom). Bottom-anchor via object-position, transform-origin and YMax slice. - pagerite.js: in-memory page cache — preload every visible internal link once, serve navigation from memory without fetching; editors' loadPlain keeps the cache in sync (pagerite:page-fetched). - Structure editor: delete pages directly, no two-step confirmation. - New 'stars' banner design (drifting starfield) alongside 'eyes'. - Rewrite seed content: welcome page, three-level docs section covering all Markdown features (source + rendered), showcase hierarchy with image positioning and a simple leaf-page banner example.
This commit is contained in:
@@ -100,18 +100,22 @@ function swapRegions(doc) {
|
||||
export async function loadPlain(p) {
|
||||
let doc
|
||||
let finalUrl = `/${p}`
|
||||
let html
|
||||
try {
|
||||
const res = await fetch(finalUrl)
|
||||
const type = res.headers.get('content-type') || ''
|
||||
if (!type.includes('text/html')) return null
|
||||
if (res.redirected) finalUrl = res.url
|
||||
doc = new DOMParser().parseFromString(await res.text(), 'text/html')
|
||||
html = await res.text()
|
||||
doc = new DOMParser().parseFromString(html, 'text/html')
|
||||
} catch { return null }
|
||||
if (!doc.getElementById('main')) return null
|
||||
swapRegions(doc)
|
||||
history.replaceState(null, '', finalUrl)
|
||||
runScripts(document.getElementById('page-banner'))
|
||||
runScripts(document.getElementById('main'))
|
||||
// Keep pagerite.js's in-memory page cache in sync with the fresh copy.
|
||||
dispatchEvent(new CustomEvent('pagerite:page-fetched', { detail: { url: finalUrl, html } }))
|
||||
dispatchEvent(new CustomEvent('pagerite:preview')) // re-inject + re-tuck the edit pens
|
||||
return finalUrl
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user