xfy 956b2d7374 修复编辑器暗色主题和列表样式
- CSS 暗色主题选择器从 [data-theme="dark"] 改为 .dark
- 恢复无序列表圆点(覆盖 Tailwind preflight 重置)
- placeholder 改用 :has() 选择器适配 Tiptap v3

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 18:02:52 +08:00

226 lines
3.7 KiB
CSS

/* Tiptap Editor - Typora-inspired, theme-aware */
.tiptap-editor {
position: relative;
width: 100%;
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-size: 16px;
line-height: 1.75;
color: #2c2c2c;
outline: none;
}
.tiptap-editor .ProseMirror {
width: 100%;
height: 100%;
padding: 24px 32px;
outline: none;
overflow-y: auto;
}
.tiptap-editor .ProseMirror-focused {
outline: none;
}
/* Placeholder - shown when document has only one empty paragraph */
.tiptap-editor .ProseMirror p:first-child:last-child:has(br.ProseMirror-trailingBreak:only-child)::before {
content: '在此输入内容...';
float: left;
color: #999;
pointer-events: none;
height: 0;
}
/* Typography */
.tiptap-editor h1 {
font-size: 2em;
font-weight: 700;
margin: 1.2em 0 0.6em;
line-height: 1.3;
color: #1a1a1a;
}
.tiptap-editor h2 {
font-size: 1.5em;
font-weight: 600;
margin: 1em 0 0.5em;
line-height: 1.35;
color: #1a1a1a;
}
.tiptap-editor h3 {
font-size: 1.25em;
font-weight: 600;
margin: 0.8em 0 0.4em;
color: #1a1a1a;
}
.tiptap-editor p {
margin: 0.6em 0;
}
.tiptap-editor p:first-child {
margin-top: 0;
}
.tiptap-editor strong {
font-weight: 700;
color: #1a1a1a;
}
.tiptap-editor em {
font-style: italic;
}
.tiptap-editor s {
text-decoration: line-through;
opacity: 0.7;
}
.tiptap-editor code {
font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
font-size: 0.875em;
background: #f3f3f3;
padding: 0.15em 0.4em;
border-radius: 3px;
color: #d73a49;
}
.tiptap-editor pre {
background: #f6f8fa;
border-radius: 6px;
padding: 16px;
overflow-x: auto;
margin: 1em 0;
}
.tiptap-editor pre code {
background: none;
padding: 0;
color: #24292e;
font-size: 0.85em;
line-height: 1.6;
}
.tiptap-editor blockquote {
border-left: 4px solid #dfe2e5;
padding-left: 16px;
margin: 1em 0;
color: #6a737d;
font-style: italic;
}
.tiptap-editor ul {
list-style-type: disc;
margin: 0.6em 0;
padding-left: 2em;
}
.tiptap-editor ol {
list-style-type: decimal;
margin: 0.6em 0;
padding-left: 2em;
}
.tiptap-editor li {
margin: 0.2em 0;
}
.tiptap-editor li > p {
margin: 0.2em 0;
}
.tiptap-editor hr {
border: none;
border-top: 1px solid #e1e4e8;
margin: 1.5em 0;
}
.tiptap-editor a {
color: #0366d6;
text-decoration: none;
}
.tiptap-editor a:hover {
text-decoration: underline;
}
/* Task list */
.tiptap-editor ul[data-type="taskList"] {
list-style: none;
padding-left: 0;
}
.tiptap-editor ul[data-type="taskList"] li {
display: flex;
align-items: flex-start;
gap: 0.5em;
}
.tiptap-editor ul[data-type="taskList"] li > label {
flex-shrink: 0;
margin-top: 0.3em;
}
.tiptap-editor ul[data-type="taskList"] li > div {
flex: 1;
}
/* Selection */
.tiptap-editor .ProseMirror ::selection {
background: #b4d7ff;
}
/* Cursor */
.tiptap-editor .ProseMirror-focused .ProseMirror-gapcursor {
display: none;
}
/* ========== Dark Theme ========== */
.dark .tiptap-editor {
color: #dadadb;
}
.dark .tiptap-editor h1,
.dark .tiptap-editor h2,
.dark .tiptap-editor h3,
.dark .tiptap-editor strong {
color: #f0f0f0;
}
.dark .tiptap-editor .ProseMirror p.is-editor-empty:first-child::before {
color: #666;
}
.dark .tiptap-editor code {
background: #2e2e33;
color: #ff7b72;
}
.dark .tiptap-editor pre {
background: #2e2e33;
}
.dark .tiptap-editor pre code {
color: #dadadb;
}
.dark .tiptap-editor blockquote {
border-left-color: #444;
color: #9b9c9d;
}
.dark .tiptap-editor hr {
border-top-color: #333;
}
.dark .tiptap-editor a {
color: #58a6ff;
}
.dark .tiptap-editor .ProseMirror ::selection {
background: #1c4e80;
}