feat(posts): plain bold titles; reserve View-original to the post card; provenance links to the posts feed
- Post titles arrived as stored HTML (e.g. <strong>…</strong>) rendering as literal markup. New toPlainText() strips tags; titles render plain + bold (ProvenancePanel and PostCard). - Removed "View original post" from the provenance panel (modal) — the open-original button lives on the PostCard (the post view). - Provenance "View post" now navigates to the /posts feed (post_id query), not the gallery image grid. (Feed in-context landing lands next.) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,17 @@ export function sanitizeHtml (html) {
|
||||
return doc.body.innerHTML
|
||||
}
|
||||
|
||||
// Strip all tags + decode entities to plain text. Used for titles that
|
||||
// arrive as stored HTML (e.g. "<strong>Edelgard at the Sex-Arcade</strong>")
|
||||
// which must render as text, not literal markup. DOMParser yields an inert
|
||||
// document (no script execution, no resource loads), so reading textContent
|
||||
// is safe.
|
||||
export function toPlainText (html) {
|
||||
if (typeof html !== 'string' || !html) return ''
|
||||
const doc = new DOMParser().parseFromString(html, 'text/html')
|
||||
return (doc.body.textContent || '').trim()
|
||||
}
|
||||
|
||||
function _scrubNode (node) {
|
||||
const children = Array.from(node.children)
|
||||
for (const child of children) {
|
||||
|
||||
Reference in New Issue
Block a user