feat: Markdown 工具栏编辑器与服务端预览

共用 md_editor 于发帖/改帖/评论,扩展 ComposeBodyToHTML,并提供 /compose/preview。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-30 04:50:07 +08:00
parent 7f048bd9b5
commit 1f777eebb1
17 changed files with 1056 additions and 232 deletions

View File

@@ -524,6 +524,55 @@ body.j13-body {
}
.j13-filebtn { display: inline-block; margin: 0; cursor: pointer; }
.j13-compose { max-width: 720px; margin: 0 auto; padding: 1rem; }
.j13-md-editor { margin: 0.35rem 0 0.75rem; }
.j13-md-editor__toolbar {
display: flex;
flex-wrap: wrap;
gap: 0.35rem;
align-items: center;
margin-bottom: 0.45rem;
}
.j13-md-editor__btn {
appearance: none;
border: 1px solid var(--j13-border);
background: var(--j13-surface, #fff);
color: inherit;
border-radius: 4px;
padding: 0.25rem 0.5rem;
font: inherit;
font-size: 0.8rem;
line-height: 1.3;
cursor: pointer;
}
.j13-md-editor__btn:hover { border-color: var(--j13-accent, #3366cc); }
.j13-md-editor__btn.is-active {
border-color: var(--j13-accent, #3366cc);
color: var(--j13-accent, #3366cc);
}
.j13-md-editor__filebtn { margin: 0; cursor: pointer; }
.j13-md-editor__sep {
width: 1px;
height: 1.1rem;
background: var(--j13-border);
margin: 0 0.15rem;
}
.j13-md-editor__input {
width: 100%;
min-height: 8rem;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 0.9rem;
line-height: 1.5;
}
.j13-md-editor__preview {
min-height: 8rem;
padding: 0.75rem 0.85rem;
border: 1px solid var(--j13-border);
border-radius: 4px;
background: var(--j13-surface, #fff);
}
.j13-md-editor__status { min-height: 1.2em; margin: 0.35rem 0 0; }
.j13-poll-fields {
margin: 0.75rem 0 1rem;
padding: 0.75rem 1rem;