feat(comments): 评论区按 Zibll 1:1 全量复刻
- 评论项/表单/工具栏/筛选/分页/空状态 DOM 全部替换为 zibll 原始类名 (li.comment、comt-main、comt-meta、list-inline、dropup 工具栏、 theme-pagination/pagenav、post_ajax_loader 骨架等) - 移植 zibll main.css L9412–9751 桌面 + 移动端评论样式, 缺失基础组件(title-theme/dropdown-menu/line-form/tab-nav-theme 等) 以 #comments 作用域补齐 - 删除全部 aksrt-comment__* 旧类名与旧样式,无兼容层 - JS 选择器对齐 zibll DOM:片段整块替换 #postcomments、骨架加载、 跳页输入、prepend 插入、addComment onclick 剥离, 移除 WP comment-reply enqueue 避免双 moveForm - 表情资源替换为 zibll 全套 gif(内容逐字节一致,git 无差异) - REST 后端 (CommentActions) 不变 验证:php -l 全部通过;5 个改动 JS 语法校验通过; node --test tests/widget-system/post-visual-contract.test.cjs 12/12 通过
This commit is contained in:
@@ -1,140 +1,10 @@
|
||||
/**
|
||||
* AKSRT Comment Tools
|
||||
*
|
||||
* 评论工具栏样式:表情、代码、图片上传、快捷回复。
|
||||
* 所有选择器均带 .comment- 或 .aksrt-comment- 命名空间。
|
||||
* 评论内容中的代码块样式。工具栏(表情/代码/图片/快捷回复)的 UI
|
||||
* 由 assets/css/frontend/comments/shell.css 按 zibll 选择器提供。
|
||||
*/
|
||||
|
||||
/* ========== 评论工具栏 ========== */
|
||||
.comment-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 6px 8px;
|
||||
margin-bottom: 8px;
|
||||
background: var(--surface-secondary, #f8f9fa);
|
||||
border: 1px solid var(--color-line, #e8e8e8);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.comment-toolbar__btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
color: var(--text-secondary, #666);
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease, color 0.15s ease;
|
||||
}
|
||||
|
||||
.comment-toolbar__btn:hover {
|
||||
background: var(--color-primary-soft, rgba(240, 68, 148, 0.08));
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.comment-toolbar__btn:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.comment-toolbar__separator {
|
||||
width: 1px;
|
||||
height: 20px;
|
||||
margin: 0 4px;
|
||||
background: var(--color-line, #e8e8e8);
|
||||
}
|
||||
|
||||
/* Server-side toolbar gating (comment_smilie / comment_code / comment_img):
|
||||
the .comment-toolbar__btn display rule outranks the UA [hidden] rule, so an
|
||||
attribute-qualified selector is needed to honor the rendered hidden state. */
|
||||
.comment-toolbar__btn[hidden],
|
||||
.comment-toolbar__separator[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ========== 表情选择器 ========== */
|
||||
.comment-emoji-picker {
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
width: 320px;
|
||||
max-height: 240px;
|
||||
padding: 12px;
|
||||
background: var(--surface-page, #fff);
|
||||
border: 1px solid var(--color-line, #e8e8e8);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.comment-emoji-picker__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(8, 1fr);
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.comment-emoji-picker__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
font-size: 18px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.1s ease;
|
||||
}
|
||||
|
||||
.comment-emoji-picker__item:hover {
|
||||
background: var(--color-primary-soft, rgba(240, 68, 148, 0.08));
|
||||
}
|
||||
|
||||
/* ========== 快捷回复 ========== */
|
||||
.comment-quick-reply {
|
||||
padding: 8px 12px;
|
||||
margin-top: 8px;
|
||||
background: var(--surface-secondary, #f8f9fa);
|
||||
border: 1px solid var(--color-line, #e8e8e8);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.comment-quick-reply__title {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary, #666);
|
||||
}
|
||||
|
||||
.comment-quick-reply__templates {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.comment-quick-reply__template {
|
||||
padding: 4px 10px;
|
||||
border: 1px solid var(--color-line, #e8e8e8);
|
||||
border-radius: 16px;
|
||||
background: var(--surface-page, #fff);
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary, #666);
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s ease, color 0.15s ease;
|
||||
}
|
||||
|
||||
.comment-quick-reply__template:hover {
|
||||
border-color: var(--color-primary);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
/* ========== 评论代码块 ========== */
|
||||
.comment-form textarea code,
|
||||
.comment-content code {
|
||||
|
||||
@@ -1,112 +1,175 @@
|
||||
/* Zibll 1:1 FixedInput / virtual-input / item chrome */
|
||||
.virtual-input { display: none; }
|
||||
@media (max-width: 767.98px) {
|
||||
.virtual-input {
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
padding: 10px 12px; margin-bottom: 12px; border-radius: 999px;
|
||||
background: var(--surface-1, #fff);
|
||||
box-shadow: var(--shadow-sm, 0 1px 4px rgba(0,0,0,.06));
|
||||
cursor: pointer;
|
||||
}
|
||||
.virtual-input .avatar-img { width: 32px; height: 32px; border-radius: 50%; }
|
||||
.virtual-input .simulation { flex: 1; color: var(--color-ink-4, #999); font-size: 13px; }
|
||||
#respond.mobile-fixed {
|
||||
position: fixed; left: 0; right: 0; bottom: 0; z-index: 1050;
|
||||
background: var(--surface-1, #fff);
|
||||
border-radius: 12px 12px 0 0;
|
||||
box-shadow: 0 -8px 28px rgba(0,0,0,.12);
|
||||
padding: 12px 14px max(12px, env(safe-area-inset-bottom));
|
||||
transform: translateY(110%); transition: transform .25s ease;
|
||||
max-height: 85vh; overflow: auto;
|
||||
}
|
||||
#respond.mobile-fixed.show { transform: translateY(0); }
|
||||
#respond.mobile-fixed .fixed-body {
|
||||
position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: -1;
|
||||
opacity: 0; pointer-events: none; transition: opacity .2s ease;
|
||||
}
|
||||
#respond.mobile-fixed.show .fixed-body { opacity: 1; pointer-events: auto; }
|
||||
#respond.mobile-fixed .comt-title { display: none; }
|
||||
}
|
||||
.comment-header .author-box { display: flex; align-items: center; gap: 8px; width: 100%; }
|
||||
.comment-header .author-box name,
|
||||
.comment-header .author-box .flex1 { flex: 1; min-width: 0; }
|
||||
/* Keep name + level badge on one line; clamp the name so the badge never wraps. */
|
||||
.comment-header .author-box name { flex-wrap: nowrap; }
|
||||
.comment-header .author-box .aksrt-comment__author { max-width: 14em; }
|
||||
.comment-header .aksrt-comment__like,
|
||||
.comment-header .action-comment-like {
|
||||
margin-left: auto; display: inline-flex; align-items: center; gap: 4px;
|
||||
color: var(--color-ink-3, #888); text-decoration: none; font-size: 13px;
|
||||
}
|
||||
.comment-header .aksrt-comment__like.is-active { color: var(--color-primary, #2060ef); }
|
||||
.comt-meta {
|
||||
display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
|
||||
font-size: 12px; margin-top: 6px;
|
||||
}
|
||||
.comt-meta .reply-link a, .comt-meta .comment-reply-link { color: var(--color-ink-3, #777); }
|
||||
.comment-action-dropdown .dropdown-menu { min-width: 140px; padding: 6px 0; }
|
||||
.comment-action-dropdown .dropdown-menu a {
|
||||
display: block; padding: 6px 14px; color: var(--color-ink, #333);
|
||||
text-decoration: none; font-size: 13px;
|
||||
}
|
||||
.comment-action-dropdown .dropdown-menu a:hover { background: var(--surface-2, #f5f5f5); }
|
||||
.smilie-icon { width: 30px; height: 30px; vertical-align: -8px; display: inline-block; }
|
||||
.comment-inline-img, .comment-content .box-img {
|
||||
max-width: 260px; max-height: 350px; border-radius: 6px; display: block; margin: 6px 0;
|
||||
}
|
||||
.comment-code {
|
||||
background: var(--surface-2, #f6f8fa); padding: 10px 12px; border-radius: 6px;
|
||||
overflow: auto; font-size: 12px;
|
||||
}
|
||||
.commentlist .children { margin-left: 86px; padding-left: 0; list-style: none; }
|
||||
.commentlist .children .children { margin-left: 23px; }
|
||||
.commentlist .children .comt-avatar,
|
||||
.commentlist .children .avatar-img.comt-avatar { width: 26px !important; height: 26px !important; }
|
||||
.input-expand-wrap { display: inline-block; position: relative; }
|
||||
.input-expand-wrap .dropdown-menu,
|
||||
.input-expand-wrap .dropdown-smilie {
|
||||
display: none; position: absolute; bottom: 100%; left: 0; z-index: 20;
|
||||
background: var(--surface-1, #fff); box-shadow: 0 6px 24px rgba(0,0,0,.12);
|
||||
border-radius: 8px; padding: 8px;
|
||||
}
|
||||
.input-expand-wrap.open > .dropdown-menu,
|
||||
.input-expand-wrap.open .dropdown-smilie,
|
||||
.dropup.open > .dropdown-menu { display: block; }
|
||||
.dropdown-smilie {
|
||||
display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
|
||||
max-width: 280px; max-height: 200px; overflow: auto;
|
||||
}
|
||||
.dropdown-smilie a img { width: 28px; height: 28px; }
|
||||
.quick-reply-item {
|
||||
display: block; padding: 6px 10px; color: var(--color-ink, #333);
|
||||
text-decoration: none; font-size: 13px;
|
||||
}
|
||||
.quick-reply-item:hover { background: var(--surface-2, #f5f5f5); }
|
||||
.comt-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
|
||||
.comt-tips-left { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; flex: 1; }
|
||||
.comt-tips-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
|
||||
#comments .comt-title { width: 90px; }
|
||||
#comments .comt-title .comt-avatar img,
|
||||
#comments .comt-avatar .avatar-img { width: 60px; height: 60px; border-radius: 50%; }
|
||||
#comments .comt-box #comment { min-height: 88px; resize: vertical; }
|
||||
@media (min-width: 768px) { .hide-pc { display: none !important; } }
|
||||
/* ============================================================
|
||||
* AKSRT Comments — Zibll 1:1 移动端 + FixedInput / virtual-input
|
||||
*
|
||||
* 移动端规则来源:zibll/css/main.css 移动端媒体查询中的评论段。
|
||||
* ============================================================ */
|
||||
|
||||
/* IP geo badges */
|
||||
.comt-meta .comment-city-badge,
|
||||
.comt-meta .aksrt-ip-geo-badge {
|
||||
margin-left: 0.35em;
|
||||
vertical-align: middle;
|
||||
.virtual-input {
|
||||
display: none;
|
||||
}
|
||||
.aksrt-author-hero__identity .aksrt-ip-geo-badge,
|
||||
.uc-header__meta .aksrt-ip-geo-badge,
|
||||
.article-avatar .aksrt-ip-geo-badge {
|
||||
margin: 2px 0;
|
||||
vertical-align: middle;
|
||||
|
||||
/* 移动端虚拟输入条 + 吸底表单(FixedInput) */
|
||||
@media (max-width: 767.98px) {
|
||||
.virtual-input {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 12px;
|
||||
border-radius: 999px;
|
||||
background: var(--surface-1, #fff);
|
||||
box-shadow: var(--shadow-sm, 0 1px 4px rgba(0, 0, 0, .06));
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.virtual-input .avatar,
|
||||
.virtual-input .avatar-img {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.virtual-input .simulation {
|
||||
flex: 1;
|
||||
color: var(--color-ink-4, #999);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
#respond.mobile-fixed {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1050;
|
||||
background: var(--surface-1, #fff);
|
||||
border-radius: 12px 12px 0 0;
|
||||
box-shadow: 0 -8px 28px rgba(0, 0, 0, .12);
|
||||
padding: 12px 14px max(12px, env(safe-area-inset-bottom));
|
||||
transform: translateY(110%);
|
||||
transition: transform .25s ease;
|
||||
max-height: 85vh;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#respond.mobile-fixed.show {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
#respond.mobile-fixed .fixed-body {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, .35);
|
||||
z-index: -1;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity .2s ease;
|
||||
}
|
||||
|
||||
#respond.mobile-fixed.show .fixed-body {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
#respond.mobile-fixed .comt-title {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ---- zibll 移动端评论规则 ---- */
|
||||
#comments .comt-title {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#comments .comt-box {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#comments .list-inline {
|
||||
padding: 15px 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#comments .comment-signarea h3 {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
#comments .comt-tips-left .but svg,
|
||||
#comments .comt-tips-left .but .fa {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#comments .hide-sm {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#comments .btn-input-expand {
|
||||
width: 31px;
|
||||
padding: 0;
|
||||
height: 31px;
|
||||
line-height: 31px;
|
||||
}
|
||||
|
||||
#postcomments .comment-header {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#postcomments .comt-meta {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#postcomments .comment .list-inline > li {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#postcomments .comment .list-inline > li + li {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
#postcomments .avatar-img {
|
||||
--this-size: 36px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#postcomments .commentlist > .comment > .list-inline .comment-footer {
|
||||
margin-left: 45px;
|
||||
margin-top: -15px;
|
||||
}
|
||||
|
||||
#postcomments .children {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
#postcomments .children .children {
|
||||
margin-left: 13px;
|
||||
}
|
||||
|
||||
#postcomments .children .list-inline {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
#comments .pagenav a,
|
||||
#comments .pagination ul > li {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#comments .pagenav a.next,
|
||||
#comments .pagenav a.prev {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#comments .pagenav .page-numbers {
|
||||
font-size: 12px;
|
||||
margin: 2px;
|
||||
min-width: 28px;
|
||||
}
|
||||
|
||||
#postcomments .post_ajax_loader .ml20 {
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
.aksrt-author-hero__identity {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
margin-top: 0.35rem;
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.hide-pc {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -56,29 +56,6 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* 评论空状态 */
|
||||
.comments-empty {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
}
|
||||
|
||||
.comments-empty__icon {
|
||||
font-size: 48px;
|
||||
color: var(--surface-3, #e8e8e8);
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.comments-empty__text {
|
||||
font-size: 14px;
|
||||
color: var(--color-ink-3, #777);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.comments-empty__hint {
|
||||
font-size: 12px;
|
||||
color: var(--color-ink-4, #999);
|
||||
}
|
||||
|
||||
/* 搜索空状态 */
|
||||
.search-empty {
|
||||
text-align: center;
|
||||
|
||||
Reference in New Issue
Block a user