281 lines
4.9 KiB
CSS
281 lines
4.9 KiB
CSS
/* Markdown Editor Component */
|
|
.markdown-editor-wrapper {
|
|
margin-top: 0.5rem;
|
|
}
|
|
|
|
.editor-toolbar {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.25rem;
|
|
padding: 0.5rem;
|
|
background: #f8fafc;
|
|
border: 2px solid #e2e8f0;
|
|
border-radius: 8px 8px 0 0;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.toolbar-btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-width: 32px;
|
|
height: 32px;
|
|
padding: 0.25rem 0.5rem;
|
|
background: white;
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 4px;
|
|
font-size: 0.875rem;
|
|
font-weight: 500;
|
|
color: #374155;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.toolbar-btn:hover {
|
|
background: #f0f4ff;
|
|
border-color: #667eea;
|
|
color: #667eea;
|
|
}
|
|
|
|
.toolbar-btn.active {
|
|
background: #667eea;
|
|
border-color: #667eea;
|
|
color: white;
|
|
}
|
|
|
|
.toolbar-btn.active:hover {
|
|
background: #5a67d8;
|
|
border-color: #5a67d8;
|
|
}
|
|
|
|
.toolbar-btn strong,
|
|
.toolbar-btn em {
|
|
font-style: normal;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.toolbar-divider {
|
|
width: 1px;
|
|
height: 24px;
|
|
background: #d1d5db;
|
|
margin: 0 0.25rem;
|
|
}
|
|
|
|
/* 标题下拉菜单 */
|
|
.toolbar-dropdown {
|
|
position: relative;
|
|
}
|
|
|
|
.dropdown-menu {
|
|
position: absolute;
|
|
top: 100%;
|
|
left: 0;
|
|
margin-top: 0.25rem;
|
|
background: white;
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 8px;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
z-index: 100;
|
|
min-width: 160px;
|
|
overflow: visible;
|
|
}
|
|
|
|
.dropdown-menu button {
|
|
display: block;
|
|
width: 100%;
|
|
padding: 0.75rem 1rem;
|
|
border: none;
|
|
background: white;
|
|
text-align: left;
|
|
cursor: pointer;
|
|
transition: background 0.2s ease;
|
|
font-family: inherit;
|
|
color: #374155;
|
|
}
|
|
|
|
.dropdown-menu button:hover {
|
|
background: #f0f4ff;
|
|
color: #667eea;
|
|
}
|
|
|
|
.dropdown-menu button h1,
|
|
.dropdown-menu button h2,
|
|
.dropdown-menu button h3,
|
|
.dropdown-menu button h4,
|
|
.dropdown-menu button h5,
|
|
.dropdown-menu button h6 {
|
|
font-weight: 600;
|
|
color: inherit;
|
|
}
|
|
|
|
/* CodeMirror 样式覆盖 */
|
|
.markdown-editor-wrapper .cm-editor {
|
|
border-top: none !important;
|
|
border-radius: 0 0 8px 8px !important;
|
|
}
|
|
|
|
/* 预览区域 */
|
|
.markdown-preview {
|
|
border: 2px solid #e2e8f0;
|
|
border-top: none;
|
|
border-radius: 0 0 8px 8px;
|
|
padding: 2rem;
|
|
background: white;
|
|
min-height: 400px;
|
|
font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
|
}
|
|
|
|
.markdown-preview h1,
|
|
.markdown-preview h2,
|
|
.markdown-preview h3,
|
|
.markdown-preview h4,
|
|
.markdown-preview h5,
|
|
.markdown-preview h6 {
|
|
margin: 1.5rem 0 0.75rem 0;
|
|
font-weight: 600;
|
|
color: #1e293b;
|
|
line-height: 1.3;
|
|
}
|
|
|
|
.markdown-preview h1:first-child,
|
|
.markdown-preview h2:first-child,
|
|
.markdown-preview h3:first-child,
|
|
.markdown-preview h4:first-child,
|
|
.markdown-preview h5:first-child,
|
|
.markdown-preview h6:first-child {
|
|
margin-top: 0;
|
|
}
|
|
|
|
.markdown-preview h1 { font-size: 1.875rem; }
|
|
.markdown-preview h2 { font-size: 1.5rem; }
|
|
.markdown-preview h3 { font-size: 1.25rem; }
|
|
.markdown-preview h4 { font-size: 1.125rem; }
|
|
.markdown-preview h5 { font-size: 1rem; }
|
|
.markdown-preview h6 { font-size: 0.875rem; }
|
|
|
|
.markdown-preview p {
|
|
margin: 0.75rem 0;
|
|
line-height: 1.7;
|
|
color: #475569;
|
|
}
|
|
|
|
.markdown-preview ul,
|
|
.markdown-preview ol {
|
|
margin: 1rem 0;
|
|
padding-left: 2rem;
|
|
}
|
|
|
|
.markdown-preview li {
|
|
margin: 0.5rem 0;
|
|
line-height: 1.6;
|
|
color: #475569;
|
|
}
|
|
|
|
.markdown-preview strong {
|
|
font-weight: 600;
|
|
color: #1e293b;
|
|
}
|
|
|
|
.markdown-preview em {
|
|
font-style: italic;
|
|
}
|
|
|
|
.markdown-preview code {
|
|
background: #f1f5f9;
|
|
padding: 0.2rem 0.4rem;
|
|
border-radius: 4px;
|
|
font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
|
|
font-size: 0.875rem;
|
|
color: #dc2626;
|
|
}
|
|
|
|
.markdown-preview pre {
|
|
background: #f8fafc;
|
|
padding: 1rem;
|
|
border-radius: 8px;
|
|
overflow-x: auto;
|
|
border: 1px solid #e2e8f0;
|
|
margin: 1rem 0;
|
|
}
|
|
|
|
.markdown-preview pre code {
|
|
background: none;
|
|
padding: 0;
|
|
color: #334155;
|
|
}
|
|
|
|
.markdown-preview blockquote {
|
|
border-left: 4px solid #667eea;
|
|
padding-left: 1rem;
|
|
margin: 1rem 0;
|
|
font-style: italic;
|
|
color: #64748b;
|
|
background: #f8fafc;
|
|
padding: 1rem;
|
|
border-radius: 0 8px 8px 0;
|
|
}
|
|
|
|
.markdown-preview table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin: 1.5rem 0;
|
|
border: 1px solid #e2e8f0;
|
|
}
|
|
|
|
.markdown-preview th,
|
|
.markdown-preview td {
|
|
border: 1px solid #e2e8f0;
|
|
padding: 0.75rem;
|
|
text-align: left;
|
|
}
|
|
|
|
.markdown-preview th {
|
|
background: #f8fafc;
|
|
font-weight: 600;
|
|
color: #334155;
|
|
}
|
|
|
|
.markdown-preview hr {
|
|
border: none;
|
|
height: 1px;
|
|
background: #e2e8f0;
|
|
margin: 2rem 0;
|
|
}
|
|
|
|
.markdown-preview img {
|
|
max-width: 100%;
|
|
height: auto;
|
|
border-radius: 8px;
|
|
margin: 1rem 0;
|
|
}
|
|
|
|
.markdown-preview a {
|
|
color: #667eea;
|
|
text-decoration: none;
|
|
border-bottom: 1px solid transparent;
|
|
transition: border-color 0.2s ease;
|
|
}
|
|
|
|
.markdown-preview a:hover {
|
|
border-bottom-color: #667eea;
|
|
}
|
|
|
|
/* 响应式 */
|
|
@media (max-width: 768px) {
|
|
.editor-toolbar {
|
|
gap: 0.125rem;
|
|
padding: 0.375rem;
|
|
}
|
|
|
|
.toolbar-btn {
|
|
min-width: 28px;
|
|
height: 28px;
|
|
font-size: 0.75rem;
|
|
}
|
|
|
|
.markdown-preview {
|
|
padding: 1rem;
|
|
}
|
|
}
|