This repository has been archived on 2026-06-21. You can view files and clone it, but cannot push or open issues or pull requests.
Files
MetaLab/templates/MetaLab-2026/static/css/posts.css
Victor_Jay 804fd50edf fix: 修复编辑器代码块换行滚动跳动 + 移除视频和网络图片功能
- 修复 wangeditor 选区同步 scrollIntoView 导致代码块换行大幅跳动的问题
  - 移除 getBoundingClientRect 替换 hack,改用元素自身真实位置计算滚动
  - 将 block 参数从 end 改为 nearest,behavior 从 smooth 改为 instant
- 修复 #editor-container 与 .w-e-scroll 双重滚动容器冲突
  - #editor-container 和 .w-e-text-container 设为 overflow:hidden
  - .w-e-scroll 作为唯一滚动容器设 overflow-y:auto
- updateCodeLabels 改为节流执行并保存/恢复滚动位置
- 新增 ensureCursorVisible 替代内置滚动保证光标可见
- 滚动同步函数统一引用 .w-e-scroll 容器
- 工具栏排除视频相关按钮和网络图片功能
- .gitignore 添加 .codebuddy
2026-05-28 01:44:46 +08:00

636 lines
13 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* ========== 帖子列表 ========== */
.posts-container {
max-width: 960px;
margin: 0 auto;
padding: 24px 16px;
}
.posts-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
}
.posts-header h1 {
font-size: 28px;
font-weight: 700;
color: #111;
margin: 0;
}
.post-card {
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 10px;
padding: 20px 24px;
margin-bottom: 16px;
transition: box-shadow 0.2s;
}
.post-card:hover {
box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.post-card-title a {
font-size: 20px;
font-weight: 600;
color: #111;
text-decoration: none;
}
.post-card-title a:hover {
color: #6366f1;
}
.post-card-meta {
display: flex;
gap: 16px;
margin-top: 8px;
font-size: 13px;
color: #6b7280;
}
.post-card-summary {
margin-top: 12px;
color: #4b5563;
font-size: 14px;
line-height: 1.6;
}
/* ========== 帖子详情 ========== */
.post-detail {
max-width: 800px;
margin: 24px auto 40px;
}
.post-article {
background: #fff;
border-radius: 12px;
box-shadow: 0 1px 3px rgba(0,0,0,0.08);
padding: 40px 48px;
}
.post-detail-header {
position: static !important;
z-index: auto !important;
box-shadow: none !important;
background: transparent !important;
margin-bottom: 32px;
padding-bottom: 20px;
border-bottom: 1px solid #e5e7eb;
}
.post-detail-title {
font-size: 32px;
font-weight: 700;
color: #111;
margin: 0 0 12px 0;
line-height: 1.3;
}
.post-detail-meta {
display: flex;
gap: 16px;
align-items: center;
font-size: 14px;
color: #6b7280;
}
.post-detail-body {
font-size: 16px;
line-height: 1.8;
color: #1f2937;
}
.post-detail-body h1,
.post-detail-body h2,
.post-detail-body h3 {
margin-top: 24px;
margin-bottom: 12px;
}
.post-detail-body p {
margin-bottom: 12px;
}
.post-detail-body a {
color: var(--color-accent);
text-decoration: underline;
text-underline-offset: 2px;
transition: color 0.2s;
}
.post-detail-body a:hover {
color: #2980b9;
}
/* 代码块基础样式(详情页预览 + 编辑器内通用) */
.post-detail-body pre,
#editor-container [data-slate-editor] pre {
position: relative;
background: #f3f4f6;
padding: 12px 16px;
padding-top: 36px;
border-radius: 8px;
overflow-x: auto;
font-size: 14px;
line-height: 1.5;
font-family: 'Menlo', 'Consolas', 'Monaco', 'Liberation Mono', monospace;
}
/* 通过 JS 动态注入语言标签,因为 CSS attr() 无法从 class 中提取 */
.code-lang-label {
position: absolute;
top: 0;
left: 0;
right: 0;
padding: 8px 16px !important;
background: #e5e7eb;
color: #6b7280;
font-size: 11px;
font-weight: 600;
border-radius: 8px 8px 0 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
.post-detail-body pre code,
#editor-container [data-slate-editor] pre code {
background: transparent !important;
border: none !important;
padding: 0 !important;
font-size: inherit !important;
}
.post-detail-body code {
background: #f3f4f6;
padding: 2px 6px;
border-radius: 4px;
font-size: 0.9em;
}
.post-detail-body img {
max-width: 100%;
height: auto;
border-radius: 8px;
}
.post-detail-body blockquote {
border-left: 4px solid #6366f1;
padding-left: 16px;
color: #6b7280;
margin: 16px 0;
}
.post-status {
padding: 2px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
}
.post-status-draft { background: #f3f4f6; color: #6b7280; }
.post-status-pending { background: #fef3c7; color: #d97706; }
.post-status-approved { background: #d1fae5; color: #059669; }
.post-status-rejected { background: #fef2f2; color: #dc2626; }
.post-status-locked { background: #fee2e2; color: #b91c1c; }
.post-reject-reason {
margin-top: 20px;
padding: 12px 16px;
background: #fef2f2;
border: 1px solid #fecaca;
border-radius: 8px;
color: #b91c1c;
font-size: 14px;
}
.post-actions {
margin-top: 24px;
display: flex;
gap: 12px;
}
/* ========== 编辑器布局(全宽) ========== */
.editor-layout {
height: calc(100vh - 56px);
display: flex;
flex-direction: column;
overflow: hidden;
}
.editor-form {
display: flex;
flex-direction: column;
height: 100%;
}
/* ---- 标题区域 ---- */
.editor-header {
padding: 16px 24px 12px;
border-bottom: 1px solid #e5e7eb;
background: #fff;
flex-shrink: 0;
}
.editor-title-input {
width: 100%;
padding: 6px 0;
border: none;
font-size: 26px;
font-weight: 700;
color: #111;
outline: none;
background: transparent;
line-height: 1.4;
}
.editor-title-input::placeholder {
color: #c4c4c4;
}
/* ---- 编辑器主体(编辑区 + 预览区) ---- */
.editor-main {
flex: 1;
display: flex;
overflow: hidden;
min-height: 0;
}
.editor-pane {
flex: 1;
overflow: hidden;
min-width: 0;
}
/* ================================================================
wangEditor 风格覆盖 — 匹配 MetaLab 靛蓝色系
================================================================ */
/* 编辑器整体容器 */
#editor-container {
background: #fff;
height: 100%;
overflow: hidden;
}
/* wangEditor 内部文本容器撑满 */
#editor-container .w-e-text-container {
height: 100% !important;
}
/* 编辑区域 */
#editor-container [data-slate-editor] {
padding: 16px 24px;
font-size: 15px;
line-height: 1.75;
color: #1f2937;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
min-height: 100%;
}
/* 工具栏容器 */
#toolbar-container .w-e-toolbar {
background: #fafafa !important;
border: none !important;
border-bottom: 1px solid #e5e7eb !important;
padding: 4px 12px !important;
flex-wrap: wrap;
}
/* 工具栏按钮 */
#toolbar-container .w-e-bar-item button {
color: #4b5563 !important;
padding: 4px 6px !important;
border-radius: 4px !important;
}
#toolbar-container .w-e-bar-item button:hover {
background: #e5e7eb !important;
color: #111 !important;
}
/* 工具栏按钮激活态 */
#toolbar-container .w-e-bar-item button.active {
background: #e0e7ff !important;
color: #6366f1 !important;
}
/* 工具栏分隔线 */
#toolbar-container .w-e-bar-divider {
background: #e5e7eb !important;
margin: 4px 6px !important;
}
/* 下拉菜单面板 */
.w-e-panel-container {
background: #fff !important;
border: 1px solid #d1d5db !important;
border-radius: 8px !important;
box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}
.w-e-panel-container .w-e-panel-content {
color: #374151 !important;
}
/* 下拉菜单项 */
.w-e-dropdown-item {
color: #374151 !important;
}
.w-e-dropdown-item:hover {
background: #f3f4f6 !important;
}
.w-e-dropdown-item.active {
background: #e0e7ff !important;
color: #6366f1 !important;
}
/* 下拉菜单 */
.w-e-bar-item .w-e-bar-item-menus-container {
background: #fff !important;
border: 1px solid #d1d5db !important;
border-radius: 8px !important;
box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}
/* 链接/图片输入弹窗 */
.w-e-modal {
background: #fff !important;
border: 1px solid #d1d5db !important;
border-radius: 8px !important;
box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}
.w-e-modal input,
.w-e-modal textarea {
border: 1px solid #d1d5db !important;
border-radius: 6px !important;
padding: 8px 12px !important;
font-size: 14px !important;
color: #374151 !important;
}
.w-e-modal input:focus,
.w-e-modal textarea:focus {
border-color: #6366f1 !important;
box-shadow: 0 0 0 3px rgba(99,102,241,0.1) !important;
outline: none !important;
}
.w-e-modal button {
border-radius: 6px !important;
font-size: 13px !important;
padding: 6px 16px !important;
}
.w-e-modal .w-e-modal-header {
border-bottom: 1px solid #e5e7eb !important;
}
.w-e-modal .w-e-modal-footer {
border-top: 1px solid #e5e7eb !important;
}
/* 确认按钮颜色覆盖为靛蓝 */
.w-e-modal .w-e-modal-footer button:last-child {
background: #6366f1 !important;
color: #fff !important;
border: none !important;
}
.w-e-modal .w-e-modal-footer button:last-child:hover {
background: #4f46e5 !important;
}
/* 表格创建选择器 */
.w-e-table-panel {
background: #fff !important;
border: 1px solid #d1d5db !important;
border-radius: 8px !important;
}
.w-e-table-panel .w-e-table-panel-item {
border-color: #e5e7eb !important;
background: #f9fafb !important;
}
.w-e-table-panel .w-e-table-panel-item.active {
background: #e0e7ff !important;
border-color: #6366f1 !important;
}
/* 选中文本背景色 */
#editor-container [data-slate-editor] ::selection {
background: #c7d2fe !important;
}
/* placeholder */
#editor-container [data-slate-editor] [data-slate-placeholder] {
color: #c4c4c4 !important;
font-style: normal !important;
}
/* 编辑器内代码块样式 — 以预览区样式为准 */
#editor-container [data-slate-editor] pre {
position: relative;
background: #f3f4f6 !important;
padding: 12px 16px !important;
padding-top: 36px !important;
border-radius: 8px !important;
font-family: 'Menlo', 'Consolas', 'Monaco', 'Liberation Mono', monospace !important;
font-size: 14px !important;
line-height: 1.5 !important;
overflow-x: auto !important;
margin: 12px 0 !important;
}
/* 语言标签由 JS 动态注入 .code-lang-label不再使用 ::before 伪元素 */
/* 若 wangEditor 的 pre 上有 data-language 属性,则作为降级方案 */
#editor-container [data-slate-editor] pre[data-language]::before {
content: attr(data-language);
position: absolute;
top: 0;
left: 0;
right: 0;
padding: 8px 16px;
background: #e5e7eb;
color: #6b7280;
font-size: 11px;
font-weight: 600;
border-radius: 8px 8px 0 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
#editor-container [data-slate-editor] pre code {
background: transparent !important;
border: none !important;
padding: 0 !important;
font-size: inherit !important;
}
/* 预览区 */
.preview-pane {
width: 0;
overflow: hidden;
border-left: 1px solid #e5e7eb;
background: #fff;
transition: width 0.2s ease;
}
.preview-pane.visible {
width: 50%;
min-width: 320px;
}
.preview-content {
height: 100%;
overflow-y: auto;
padding: 20px 28px;
}
/* ---- 状态栏 ---- */
.editor-statusbar {
display: flex;
align-items: center;
gap: 16px;
padding: 6px 20px;
background: #fafafa;
border-top: 1px solid #e5e7eb;
font-size: 12px;
color: #9ca3af;
flex-shrink: 0;
min-height: 34px;
}
.status-item {
white-space: nowrap;
}
.status-spacer {
flex: 1;
}
.status-draft {
color: #059669;
font-weight: 500;
}
.btn-submit {
padding: 5px 18px;
font-size: 13px;
border-radius: 6px;
}
/* ---- 全屏模式 ---- */
.editor-layout.fullscreen {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 9999;
height: 100vh;
background: #fff;
}
/* ========== 404 ========== */
.error-404 {
text-align: center;
padding: 80px 0;
}
.error-404 h1 {
font-size: 72px;
color: #d1d5db;
margin: 0;
}
.error-404 p {
font-size: 18px;
color: #6b7280;
margin: 12px 0 24px;
}
/* ========== 空状态 ========== */
.empty-state {
text-align: center;
padding: 60px 0;
color: #9ca3af;
font-size: 16px;
}
.search-hint {
margin-bottom: 16px;
color: #6b7280;
font-size: 14px;
}
/* ========== 按钮 ========== */
.btn {
display: inline-block;
padding: 10px 20px;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
text-decoration: none;
transition: background 0.2s;
}
.btn-primary {
background: #6366f1;
color: #fff;
}
.btn-primary:hover { background: #4f46e5; }
.btn-secondary {
background: #f3f4f6;
color: #374151;
}
.btn-secondary:hover { background: #e5e7eb; }
/* ========== 分页 ========== */
.pagination {
display: flex;
justify-content: center;
align-items: center;
gap: 16px;
margin-top: 32px;
padding-top: 20px;
border-top: 1px solid #e5e7eb;
}
.page-link {
padding: 8px 16px;
border: 1px solid #d1d5db;
border-radius: 8px;
color: #374151;
text-decoration: none;
font-size: 14px;
}
.page-link:hover { background: #f3f4f6; }
.page-info {
font-size: 14px;
color: #6b7280;
}
/* ========== 错误消息 ========== */
.error-message {
padding: 12px 16px;
background: #fef2f2;
border: 1px solid #fecaca;
border-radius: 8px;
color: #b91c1c;
margin-bottom: 16px;
}