nex_docus/frontend/src/pages/Document/DocumentEditor.css

467 lines
9.1 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

@import '@/components/LargeMarkdownViewer/LargeMarkdownViewer.css';
.document-editor-page {
height: calc(100vh - 64px);
/* width: calc(100% + 32px); */
display: flex;
background: var(--bg-color);
}
.document-editor-container {
height: 100%;
width: 100%;
display: flex;
flex: 1;
}
.document-sider {
border-right: 1px solid var(--border-color);
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
flex-shrink: 0;
background: var(--sider-bg);
}
/* 修复 Sider 内部 flex 布局 */
.document-sider .ant-layout-sider-children {
display: flex;
flex-direction: column;
height: 100%;
}
.sider-header {
padding: 12px 10px 12px;
border-bottom: 1px solid var(--border-color);
display: flex;
flex-direction: column;
gap: 10px;
background: var(--header-bg);
}
.sider-header h2 {
margin: 0;
font-size: 20px;
font-weight: 700;
letter-spacing: 0;
color: var(--text-color);
line-height: 1.1;
}
.sider-title-row {
display: flex;
align-items: center;
gap: 14px;
min-width: 0;
}
.sider-title-row h2 {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.project-back-button {
width: 28px;
height: 28px;
border: none;
border-radius: 999px;
display: inline-flex;
align-items: center;
justify-content: center;
background: transparent;
color: #707480;
font-size: 16px;
cursor: pointer;
flex-shrink: 0;
transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.project-back-button:hover {
background: rgba(17, 24, 39, 0.06);
color: #2f3440;
transform: translateX(-1px);
}
.project-back-button:focus-visible {
outline: 2px solid rgba(22, 119, 255, 0.35);
outline-offset: 2px;
}
.sider-actions {
display: flex;
align-items: center;
}
.mode-actions-row {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.mode-actions-group {
display: inline-flex;
align-items: center;
}
.sider-actions .mode-actions-group .ant-btn {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
color: var(--text-color-secondary);
}
.sider-actions .mode-actions-group .ant-btn:hover {
background: var(--item-hover-bg);
border-color: var(--border-color);
color: var(--link-color);
}
.file-tree {
padding: 8px;
flex: 1;
overflow-y: auto;
overflow-x: hidden;
background: var(--sider-bg);
color: var(--text-color);
}
.file-tree .ant-menu-title-content {
display: flex;
align-items: center;
min-width: 0;
overflow: hidden;
}
/* Increase hit area for context menu */
.tree-node-wrapper {
width: 100%;
height: 100%;
display: flex;
align-items: center;
min-width: 0;
user-select: none;
padding: 4px 8px;
margin: -4px -8px;
border-radius: 4px;
transition: all 0.2s;
color: var(--text-color);
}
.tree-node-text {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 选中的文件夹样式 */
.file-tree .folder-selected>.ant-menu-submenu-title {
background-color: var(--item-hover-bg) !important;
color: var(--link-color) !important;
}
.file-tree .folder-selected>.ant-menu-submenu-title:hover {
background-color: var(--item-hover-bg) !important;
}
.file-tree .ant-menu-item,
.file-tree .ant-menu-submenu-title {
overflow: hidden;
display: flex !important;
align-items: center;
min-width: 0;
}
.document-content {
height: 100%;
width: 100%;
background: var(--bg-color);
display: flex;
flex-direction: column;
flex: 1;
min-width: 0;
}
/* 强制覆盖 Ant Design Content 的默认样式 */
.document-editor-container .ant-layout-content {
display: flex !important;
flex-direction: column !important;
flex: 1 !important;
min-width: 0 !important;
width: 100% !important;
}
.content-header {
padding: 16px 24px;
min-height: 57px;
border-bottom: 1px solid var(--border-color);
display: flex;
align-items: center;
justify-content: space-between;
background: var(--header-bg);
flex-shrink: 0;
}
.editor-container {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
min-width: 0;
overflow: hidden;
width: 100%;
}
.bytemd-wrapper {
flex: 1;
display: flex;
flex-direction: column;
/* Changed to column to force child stretch width */
min-height: 0;
min-width: 0;
overflow: hidden;
width: 100%;
height: 100%;
padding: 5px 10px;
}
.bytemd-wrapper.large-file-editor {
position: relative;
display: flex;
flex-direction: column;
}
/* Fix for bytemd-react wrapper div仅普通编辑器超大着色编辑器不受此约束 */
.bytemd-wrapper:not(.large-file-editor)>div {
flex: 1;
display: flex;
flex-direction: column;
width: 100% !important;
height: 100% !important;
min-width: 0;
}
.empty-editor {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: var(--text-color-secondary);
}
/* ByteMD 编辑器样式覆盖 */
.bytemd {
width: 100% !important;
height: 100% !important;
display: flex !important;
flex-direction: column !important;
border: 1px solid var(--border-color);
border-radius: 2px;
overflow: hidden;
max-width: none !important;
/* Ensure no max-width constraint */
box-sizing: border-box;
background-color: var(--bg-color);
color: var(--text-color);
}
/* 工具栏样式 */
.bytemd-toolbar {
flex-shrink: 0;
border-bottom: 1px solid var(--border-color);
background-color: var(--toolbar-bg);
box-sizing: border-box;
color: var(--text-color);
}
.bytemd-toolbar-icon {
color: var(--text-color);
}
.bytemd-toolbar-icon:hover {
background-color: var(--item-hover-bg);
}
/* Keep the TOC entry visible; hide the help sidebar button. */
.bytemd-toolbar-right .bytemd-toolbar-icon:nth-child(2) {
display: none;
}
/* 编辑和预览区域容器 */
.bytemd-body {
flex: 1 !important;
display: flex !important;
overflow: hidden;
min-height: 0;
width: 100% !important;
box-sizing: border-box;
/* Added for consistent box model */
min-width: 0;
/* Prevent flex item from overflowing */
background-color: var(--bg-color);
}
/* 编辑区域 - 默认分栏,保留 Bytemd 内联样式对仅编辑/仅预览的控制 */
.bytemd-editor {
overflow: hidden;
min-height: 0;
box-sizing: border-box;
/* Added for consistent box model */
min-width: 0;
/* Prevent flex item from overflowing */
background-color: var(--bg-color);
border-right: 1px solid var(--border-color);
}
/* 预览区域 - 默认分栏,保留 Bytemd 内联样式对仅编辑/仅预览的控制 */
.bytemd-preview {
overflow-y: auto !important;
overflow-x: hidden !important;
padding: 16px;
font-size: 14px;
line-height: 1.8;
box-sizing: border-box;
/* Added for consistent box model */
min-width: 0;
/* Prevent flex item from overflowing */
background-color: var(--bg-color);
color: var(--text-color);
}
/* CodeMirror 容器 */
.bytemd-editor .CodeMirror {
flex: 1;
min-height: 0;
font-size: 14px;
line-height: 1.8;
width: 100%;
height: 100%;
background-color: var(--bg-color);
color: var(--text-color);
}
/* CodeMirror 滚动容器 */
.bytemd-editor .CodeMirror-scroll {
overflow-y: scroll !important;
overflow-x: auto !important;
min-height: 100% !important;
height: 100% !important;
}
/* 预览区域的markdown样式 */
.bytemd-preview h1,
.bytemd-preview h2,
.bytemd-preview h3,
.bytemd-preview h4,
.bytemd-preview h5,
.bytemd-preview h6 {
margin-top: 24px;
margin-bottom: 16px;
font-weight: 600;
line-height: 1.25;
color: var(--text-color);
}
.bytemd-preview h1 {
font-size: 2em;
border-bottom: 1px solid var(--border-color);
padding-bottom: 0.3em;
}
.bytemd-preview h2 {
font-size: 1.5em;
border-bottom: 1px solid var(--border-color);
padding-bottom: 0.3em;
}
.bytemd-preview p {
margin-bottom: 16px;
color: var(--text-color);
}
.bytemd-preview code {
padding: 0.2em 0.4em;
margin: 0;
font-size: 85%;
background-color: var(--code-bg);
border-radius: 3px;
color: var(--text-color);
}
.bytemd-preview pre {
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
background-color: var(--code-bg);
border-radius: 3px;
margin-bottom: 16px;
}
.bytemd-preview pre code {
display: inline;
padding: 0;
margin: 0;
overflow: visible;
line-height: inherit;
background-color: transparent;
border: 0;
color: inherit;
}
.bytemd-preview img {
max-width: 100%;
box-sizing: content-box;
}
.bytemd-preview table {
border-collapse: collapse;
border-spacing: 0;
margin-bottom: 16px;
}
.bytemd-preview table th,
.bytemd-preview table td {
padding: 6px 13px;
border: 1px solid var(--table-border-color);
color: var(--text-color);
}
.bytemd-preview table th {
font-weight: 600;
background-color: var(--table-header-bg);
}
.bytemd-preview blockquote {
margin: 0 0 16px;
padding: 0 1em;
color: var(--blockquote-text-color);
border-left: 0.25em solid var(--blockquote-border-color);
}
.bytemd-preview ul,
.bytemd-preview ol {
padding-left: 2em;
margin-bottom: 16px;
color: var(--text-color);
}
.bytemd-preview li {
margin-bottom: 0.25em;
}
.content-header .preview-header-title {
flex: 1;
min-width: 0;
max-width: none;
}