From 4095473a7982c8147b0ce12a1fcdad375ad27548 Mon Sep 17 00:00:00 2001 From: anghunk Date: Tue, 27 Jan 2026 15:13:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=B9=E8=BF=9B=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86=E5=91=98=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E4=B8=8E=E6=A0=B7=E5=BC=8F=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 后端评论接口增加 isAdmin 字段,不再依赖前端邮箱比对 - 管理后台评论列表支持 Markdown 渲染并添加相应样式 - 前端组件移除 adminEmail 依赖,改用 comment.isAdmin 字段 - 添加 CSS 样式兼容其他框架导入的表情元素 - 更新文档说明部署流程 --- cwd-admin/src/assets/markdown.css | 127 ++++++++++++++++++++++ cwd-admin/src/views/CommentsView.vue | 15 ++- cwd-api/src/api/public/getComments.ts | 15 ++- docs/guide/update-version.md | 6 +- docs/public/cwd.js | 3 - docs/widget/src/components/CommentItem.js | 5 +- docs/widget/src/components/CommentList.js | 2 +- docs/widget/src/core/CWDComments.js | 2 +- docs/widget/src/styles/main.css | 7 ++ 9 files changed, 169 insertions(+), 13 deletions(-) create mode 100644 cwd-admin/src/assets/markdown.css delete mode 100644 docs/public/cwd.js diff --git a/cwd-admin/src/assets/markdown.css b/cwd-admin/src/assets/markdown.css new file mode 100644 index 0000000..7688ee9 --- /dev/null +++ b/cwd-admin/src/assets/markdown.css @@ -0,0 +1,127 @@ +.cell-content-text { + font-size: 14px; + line-height: 1.6; + color: var(--cwd-text, #24292f); + word-wrap: break-word; + white-space: pre-wrap; + margin-top: 10px; +} + +.cell-content-text p { + margin: 0 0 8px; +} + +.cell-content-text p:last-child { + margin-bottom: 0; +} + +.cell-content-text a { + color: var(--cwd-primary, #0969da); + text-decoration: none; +} + +.cell-content-text a:hover { + text-decoration: underline; +} + +.cell-content-text h1, +.cell-content-text h2, +.cell-content-text h3, +.cell-content-text h4, +.cell-content-text h5, +.cell-content-text h6 { + margin-top: 16px; + margin-bottom: 8px; + font-weight: 600; + line-height: 1.25; +} + +.cell-content-text h1 { + font-size: 1.5em; +} + +.cell-content-text h2 { + font-size: 1.3em; +} + +.cell-content-text h3 { + font-size: 1.1em; +} + +.cell-content-text ul, +.cell-content-text ol { + padding-left: 1.7em; + margin: 0 0 8px; +} + +.cell-content-text li+li { + margin-top: 4px; +} + +.cell-content-text code { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + font-size: 0.9em; + background: var(--cwd-bg-secondary, #f6f8fa); + padding: 0.2em 0.4em; + border-radius: 4px; +} + +.cell-content-text pre { + padding: 12px; + margin: 12px 0; + overflow-x: auto; + background: var(--cwd-bg-secondary, #f6f8fa); + border-radius: 6px; + font-size: 0.9em; +} + +.cell-content-text pre code { + padding: 0; + background: transparent; + border-radius: 0; + display: block; +} + +.cell-content-text blockquote { + margin: 8px 0; + padding: 0 12px; + border-left: 4px solid var(--cwd-border, #d0d7de); + color: var(--cwd-text-secondary, #6e7781); +} + +.cell-content-text hr { + border: 0; + border-top: 1px solid var(--cwd-border-light, #eaeef2); + margin: 16px 0; +} + +.cell-content-text table { + border-collapse: collapse; + border-spacing: 0; + width: 100%; + font-size: 13px; + margin: 12px 0; +} + +.cell-content-text th, +.cell-content-text td { + border: 1px solid var(--cwd-border, #d0d7de); + padding: 6px 12px; + text-align: left; +} + +.cell-content-text th { + background: var(--cwd-bg-secondary, #f6f8fa); +} + +.cell-content-text img { + max-width: 100%; + height: auto; +} + +/* 兼容其他框架导入的样式 */ +.cell-content-text .tk-owo-emotion { + display: inline-block; + vertical-align: bottom; + max-width: 40px; +} \ No newline at end of file diff --git a/cwd-admin/src/views/CommentsView.vue b/cwd-admin/src/views/CommentsView.vue index 8fab2d8..06bb538 100644 --- a/cwd-admin/src/views/CommentsView.vue +++ b/cwd-admin/src/views/CommentsView.vue @@ -58,7 +58,7 @@
-
{{ item.contentText }}
+
置顶 -