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

445 lines
8.8 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.

.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: 16px 20px;
border-bottom: 1px solid var(--border-color);
display: flex;
flex-direction: column;
gap: 12px;
background: var(--header-bg);
}
.sider-header h2 {
margin: 0;
font-size: 16px;
font-weight: 600;
color: var(--text-color);
line-height: 1.5;
}
.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);
}
/* 修复Tree组件文档名过长的显示问题 */
.file-tree .ant-tree-title {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
}
.file-tree .ant-tree-node-content-wrapper {
overflow: hidden;
max-width: 100%;
}
.file-tree .ant-tree-treenode {
overflow: hidden;
}
/* 确保Tree节点标题区域不折行 */
.file-tree .ant-tree-node-content-wrapper .ant-tree-title {
display: inline-block;
max-width: calc(100% - 24px);
/* 预留图标空间 */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap !important;
vertical-align: middle;
}
/* 修复文档名过长的显示问题Menu组件已废弃但保留兼容 */
.file-tree .ant-menu-title-content {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
/* Ensure it allows children to fill width */
}
/* Increase hit area for context menu */
.tree-node-wrapper {
width: 100%;
height: 100%;
display: block;
user-select: none;
padding: 4px 8px;
margin: -4px -8px;
border-radius: 4px;
transition: all 0.2s;
color: var(--text-color);
}
/* 选中的文件夹样式 */
.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;
/* Ensure flex layout for item */
align-items: center;
}
.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;
justify-content: space-between;
align-items: center;
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;
}
/* Fix for bytemd-react wrapper div */
.bytemd-wrapper>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);
}
/* 编辑和预览区域容器 */
.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);
}
/* 编辑区域 - 固定50%宽度 */
.bytemd-editor {
width: 50% !important;
flex: 0 0 50% !important;
display: flex !important;
flex-direction: column !important;
overflow: hidden;
min-height: 0;
max-width: 50% !important;
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);
}
/* 预览区域 - 固定50%宽度 */
.bytemd-preview {
width: 50% !important;
flex: 0 0 50% !important;
overflow-y: auto !important;
overflow-x: hidden !important;
padding: 16px;
font-size: 14px;
line-height: 1.8;
max-width: 50% !important;
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 h3 {
margin: 0;
font-size: 16px;
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 600px;
color: var(--text-color);
}