Wiki Phase 2: TipTap rich-text editor + inline image uploads
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>
This commit is contained in:
@@ -312,6 +312,75 @@ button[disabled] {
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
|
||||
/* ===== Rich text editor (TipTap) ===== */
|
||||
.rte {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: var(--bg);
|
||||
overflow: hidden;
|
||||
}
|
||||
.rte:focus-within {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
.rte-toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
background: var(--panel-flat);
|
||||
}
|
||||
.rte-btn {
|
||||
min-width: 30px;
|
||||
height: 30px;
|
||||
padding: 0 8px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
font-family: var(--sans);
|
||||
font-size: 0.85rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
transition: background 0.12s, color 0.12s, border-color 0.12s;
|
||||
}
|
||||
.rte-btn:hover:not([disabled]) {
|
||||
background: var(--blue);
|
||||
color: var(--ink);
|
||||
}
|
||||
.rte-btn.is-active {
|
||||
background: var(--blue);
|
||||
border-color: var(--accent);
|
||||
color: var(--accent-bright);
|
||||
}
|
||||
.rte-btn[disabled] {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.rte-sep {
|
||||
width: 1px;
|
||||
align-self: stretch;
|
||||
margin: 2px 4px;
|
||||
background: var(--line);
|
||||
}
|
||||
.rte-content {
|
||||
padding: 14px 16px;
|
||||
max-height: 460px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.rte-content .ProseMirror {
|
||||
min-height: 220px;
|
||||
outline: none;
|
||||
}
|
||||
.rte-content .ProseMirror p.is-editor-empty:first-child::before {
|
||||
content: attr(data-placeholder);
|
||||
float: left;
|
||||
height: 0;
|
||||
color: var(--dim);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* ===== Admin tables ===== */
|
||||
.adm-table {
|
||||
width: 100%;
|
||||
|
||||
Reference in New Issue
Block a user