- 引入 CodeMirror 6 (MIT) 替代 contenteditable WYSIWYG 编辑器,消除 execCommand 废弃 API 风险 - 全新全宽三栏布局:标题栏、工具栏、编辑区+可切换预览、状态栏 - 工具栏新增删除线/H1/H4/任务列表/表格/预览切换/全屏按钮 - 支持粘贴图片自动上传 (Ctrl+V)、拖拽上传、上传进度反馈 - 代码块语言下拉选择器替代 prompt() 弹窗,支持搜索和键盘导航 - 自动保存草稿 (30s 防抖,localStorage + 后端静默保存) - 分屏实时预览 (Ctrl+Shift+P),编辑器与预览区双向滚动同步 - 字数/行数/阅读时间统计、全屏编辑 (F11) - 快捷键:Ctrl+B/I/K/`/Shift+I/S/Shift+P + Tab/Shift+Tab - 删除旧的 htmlToMarkdown、syncMarkdownToWysiwyg、mode-tab 等废弃代码 - 后端 API 零改动,仅移除控制器中不再需要的 ExtraJS 字段
515 lines
8.6 KiB
CSS
515 lines
8.6 KiB
CSS
/* ========== 帖子列表 ========== */
|
|
.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: 0 auto;
|
|
padding: 32px 16px;
|
|
}
|
|
|
|
.post-detail-header {
|
|
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 pre {
|
|
background: #f3f4f6;
|
|
padding: 16px;
|
|
border-radius: 8px;
|
|
overflow-x: auto;
|
|
font-size: 14px;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.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-toolbar {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 2px;
|
|
padding: 5px 16px;
|
|
background: #fafafa;
|
|
border-bottom: 1px solid #e5e7eb;
|
|
min-height: 38px;
|
|
flex-shrink: 0;
|
|
overflow-x: auto;
|
|
}
|
|
|
|
.tb-group {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1px;
|
|
}
|
|
|
|
.tb-btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 30px;
|
|
height: 28px;
|
|
border: none;
|
|
border-radius: 4px;
|
|
background: transparent;
|
|
color: #4b5563;
|
|
cursor: pointer;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
transition: background 0.12s, color 0.12s;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.tb-btn:hover {
|
|
background: #e5e7eb;
|
|
color: #111;
|
|
}
|
|
|
|
.tb-btn:active {
|
|
background: #d1d5db;
|
|
}
|
|
|
|
.tb-btn svg {
|
|
width: 16px;
|
|
height: 16px;
|
|
}
|
|
|
|
.tb-sep {
|
|
width: 1px;
|
|
height: 20px;
|
|
background: #e5e7eb;
|
|
margin: 0 6px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.tb-spacer {
|
|
flex: 1;
|
|
}
|
|
|
|
.tb-right {
|
|
margin-left: auto;
|
|
}
|
|
|
|
.tb-toggle.active {
|
|
background: #e0e7ff;
|
|
color: #6366f1;
|
|
}
|
|
|
|
/* ---- 代码块语言选择器 ---- */
|
|
.lang-picker {
|
|
position: absolute;
|
|
top: 38px;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
width: 220px;
|
|
background: #fff;
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 8px;
|
|
box-shadow: 0 8px 24px rgba(0,0,0,0.12);
|
|
z-index: 100;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.lang-picker-search input {
|
|
width: 100%;
|
|
padding: 10px 12px;
|
|
border: none;
|
|
border-bottom: 1px solid #e5e7eb;
|
|
font-size: 13px;
|
|
outline: none;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.lang-picker-list {
|
|
max-height: 240px;
|
|
overflow-y: auto;
|
|
padding: 4px 0;
|
|
}
|
|
|
|
.lang-picker-item {
|
|
padding: 6px 12px;
|
|
font-size: 13px;
|
|
color: #374151;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.lang-picker-item:hover {
|
|
background: #f3f4f6;
|
|
}
|
|
|
|
.lang-picker-item.selected {
|
|
background: #e0e7ff;
|
|
color: #6366f1;
|
|
}
|
|
|
|
/* ---- 编辑器主体(编辑区 + 预览区) ---- */
|
|
.editor-main {
|
|
flex: 1;
|
|
display: flex;
|
|
overflow: hidden;
|
|
min-height: 0;
|
|
}
|
|
|
|
.editor-pane {
|
|
flex: 1;
|
|
overflow: hidden;
|
|
min-width: 0;
|
|
}
|
|
|
|
.editor-pane .cm-editor {
|
|
height: 100%;
|
|
}
|
|
|
|
.editor-pane .cm-editor .cm-scroller {
|
|
font-family: 'Menlo', 'Consolas', 'Monaco', 'Liberation Mono', monospace;
|
|
font-size: 14px;
|
|
line-height: 1.65;
|
|
}
|
|
|
|
.editor-pane .cm-editor .cm-content {
|
|
padding: 16px 20px;
|
|
}
|
|
|
|
.editor-pane .cm-editor .cm-gutters {
|
|
border-right: 1px solid #e5e7eb;
|
|
background: #fafafa;
|
|
color: #9ca3af;
|
|
}
|
|
|
|
/* 预览区 */
|
|
.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;
|
|
}
|