Wiki upgrade: rich-text editing, categories, drafts, links/backlinks, tags, search, revisions #3
Reference in New Issue
Block a user
No description provided.
Delete Branch "wiki-upgrade"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Wiki CMS upgrade
Upgrades the CMS wiki from a flat single-table page store into a feature-complete wiki, delivered in four independently shippable phases. Design + process live in
WIKI_UPGRADE.md.Staff-only (admin/editor) — no public editing. All schema changes are additive and idempotent (applied by
ensureSchema()on boot), so existing databases upgrade with no data loss; existing pages backfill topublished = 1.Phase 1 — Foundation & safety
wiki_categoriestable;wiki_pagesgainscategory_id,excerpt,published/published_at,sort_order, and aFULLTEXT(title, body)index.sanitize-htmlallowlist) + client DOMPurify on render — closes a stored-XSS gap (bodies were previously rendered raw viadangerouslySetInnerHTML).Phase 2 — Authoring UX
POST /admin/uploadsfor inline images (reuses the screenshot multer config).Phase 3 — Connectivity
/wiki/<slug>via an in-editor page picker;wiki_linksindex rebuilt on every save.wiki_tags/wiki_page_tags), auto-pruned when orphaned; tag + category filtering (chips + flat index view).Phase 4 — Discovery & trust
MATCH … AGAINST) over title + body; public search box + admin filter.wiki_revisions): every save snapshots the page; the admin History modal shows a word-level diff (jsdiff) of any revision against current, with one-click restore (history stays append-only).New tables
wiki_categories,wiki_tags,wiki_page_tags,wiki_links,wiki_revisions(plus new columns onwiki_pages).New dependencies
sanitize-html@tiptap/react(+ starter-kit / link / image),dompurify,diffTesting
Verified end-to-end against MariaDB 11 via the local dev setup: migration runs clean on boot; XSS payloads neutralized; drafts hidden from the public API; rich content (headings/lists/link/inline image) round-trips sanitized; backlinks + red-link detection; tag filtering + orphan pruning; FULLTEXT search matches on body and title; revision diff + restore. Client builds clean; server boots with no errors. Each phase's exit-check is recorded in
WIKI_UPGRADE.md.Notes
activity_log(wiki.create/update/publish/delete,wiki.category.*,wiki.revision.restore,upload).🤖 Generated with Claude Code
Replaces the raw-HTML textarea in the wiki editor with a TipTap (ProseMirror) WYSIWYG editor. - new RichTextEditor component: bold/italic/strike, H2/H3, bullet+ordered lists, blockquote, code block, divider, link, inline image, undo/redo - generalized POST /admin/uploads (reuses the screenshot multer config) → { url }; the editor uploads inline images through it - editor output still passes through the Phase 1 server-side sanitizer on save and DOMPurify on render - lazy-loaded as its own chunk so the public bundle doesn't ship TipTap (public ~82kB gzip; editor chunk ~106kB gzip loaded only in admin) - RTE styling added to theme.css (toolbar, active states, prose content) Verified: uploads serve as images; H2/H3 + lists + link + inline image round-trip through the WYSIWYG and render sanitized on the public page. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>