fix: 修复编辑器代码块样式不一致 + 提交 HTML 保留格式 + 详情页布局优化

- 编辑器 pre code 移除 wangEditor 内置 border,与预览区样式统一
- 代码块语言标签 padding 加大并用 !important 对抗 wangEditor 全局重置
- 编辑器 ::before 伪元素仅作降级方案,避免与 JS 注入的 .code-lang-label 冲突
- 编辑器 pre padding-top 统一为 36px,font-size/line-height 对齐预览区
- 提交改用 editor.getHtml(),后端 sanitizeHTML 替代 renderMarkdown,保留富文本格式
- 详情页 post-detail-header 覆盖 common.css sticky,固定在文章卡片内
- 详情页增加白色卡片背景、圆角、阴影和内边距
- 详情页添加代码块语言标签 JS 注入
- 详情页用户名移除括号 UID 显示,移除管理按钮
This commit is contained in:
2026-05-28 00:53:02 +08:00
parent ec8fa3eb56
commit 2917562bf0
4 changed files with 52 additions and 46 deletions

View File

@ -372,10 +372,11 @@ form.addEventListener('submit', e => {
e.preventDefault();
const title = titleEl.value.trim();
const body = getEditorText();
const body = getEditorHtml();
const bodyText = getEditorText();
if (!title) { alert('请输入标题'); return; }
if (!body) { alert('请输入正文'); return; }
if (!bodyText) { alert('请输入正文'); return; }
let url = '/api/posts';
let method = 'POST';