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

605 lines
14 KiB
CSS
Raw Normal View History

2026-06-16 13:09:15 +00:00
@import '@/components/LargeMarkdownViewer/LargeMarkdownViewer.css';
2025-12-25 04:22:35 +00:00
.document-editor-page {
2026-01-01 14:41:10 +00:00
height: calc(100vh - 64px);
2025-12-31 07:12:56 +00:00
/* width: calc(100% + 32px); */
2025-12-25 04:22:35 +00:00
display: flex;
2026-04-08 17:03:57 +00:00
margin: -16px;
padding: 8px;
box-sizing: border-box;
2026-01-31 03:41:20 +00:00
background: var(--bg-color);
2025-12-25 04:22:35 +00:00
}
.document-editor-container {
height: 100%;
width: 100%;
display: flex;
flex: 1;
}
.document-sider {
2026-01-31 03:41:20 +00:00
border-right: 1px solid var(--border-color);
2026-01-01 14:41:10 +00:00
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
2025-12-25 04:22:35 +00:00
flex-shrink: 0;
2026-01-31 03:41:20 +00:00
background: var(--sider-bg);
2025-12-25 04:22:35 +00:00
}
2026-04-01 01:14:02 +00:00
/* 修复 Sider 内部 flex 布局 */
.document-sider .ant-layout-sider-children {
display: flex;
flex-direction: column;
height: 100%;
}
2025-12-25 04:22:35 +00:00
.sider-header {
2026-05-09 02:45:30 +00:00
padding: 12px 10px 12px;
2026-01-31 03:41:20 +00:00
border-bottom: 1px solid var(--border-color);
2025-12-25 04:22:35 +00:00
display: flex;
flex-direction: column;
2026-05-09 02:45:30 +00:00
gap: 10px;
2026-01-31 03:41:20 +00:00
background: var(--header-bg);
2025-12-25 04:22:35 +00:00
}
2026-01-01 14:41:10 +00:00
.sider-header h2 {
2025-12-25 04:22:35 +00:00
margin: 0;
2026-05-09 02:45:30 +00:00
font-size: 20px;
font-weight: 700;
letter-spacing: 0;
2026-01-31 03:41:20 +00:00
color: var(--text-color);
2026-05-09 02:45:30 +00:00
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;
2026-08-05 14:18:25 +00:00
color: var(--text-color-secondary);
2026-05-09 02:45:30 +00:00
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 {
2026-08-05 14:18:25 +00:00
background: var(--item-hover-bg);
color: var(--text-color);
2026-05-09 02:45:30 +00:00
transform: translateX(-1px);
}
.project-back-button:focus-visible {
outline: 2px solid rgba(22, 119, 255, 0.35);
outline-offset: 2px;
2025-12-25 04:22:35 +00:00
}
.sider-actions {
display: flex;
2026-01-01 14:41:10 +00:00
align-items: center;
}
2026-03-11 07:27:52 +00:00
.mode-actions-row {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
2026-01-01 14:41:10 +00:00
}
2026-03-11 07:27:52 +00:00
.mode-actions-group {
display: inline-flex;
align-items: center;
2025-12-25 04:22:35 +00:00
}
2026-03-11 07:27:52 +00:00
.sider-actions .mode-actions-group .ant-btn {
2026-01-01 14:41:10 +00:00
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
2026-01-31 03:41:20 +00:00
color: var(--text-color-secondary);
2025-12-25 04:22:35 +00:00
}
2026-03-11 07:27:52 +00:00
.sider-actions .mode-actions-group .ant-btn:hover {
2026-01-31 03:41:20 +00:00
background: var(--item-hover-bg);
border-color: var(--border-color);
color: var(--link-color);
2025-12-25 04:22:35 +00:00
}
.document-content {
height: 100%;
width: 100%;
2026-01-31 03:41:20 +00:00
background: var(--bg-color);
2025-12-25 04:22:35 +00:00
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;
2026-03-11 07:27:52 +00:00
min-height: 57px;
2026-01-31 03:41:20 +00:00
border-bottom: 1px solid var(--border-color);
2025-12-25 04:22:35 +00:00
display: flex;
align-items: center;
2026-05-15 11:59:49 +00:00
justify-content: space-between;
2026-08-25 02:17:40 +00:00
gap: 16px;
2026-01-31 03:41:20 +00:00
background: var(--header-bg);
2025-12-25 04:22:35 +00:00
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;
2026-01-01 14:41:10 +00:00
flex-direction: column;
/* Changed to column to force child stretch width */
2025-12-25 04:22:35 +00:00
min-height: 0;
min-width: 0;
overflow: hidden;
width: 100%;
height: 100%;
padding: 5px 10px;
}
2026-06-16 13:09:15 +00:00
.bytemd-wrapper.large-file-editor {
position: relative;
2026-06-22 06:05:10 +00:00
display: flex;
flex-direction: column;
2026-06-16 13:09:15 +00:00
}
2026-06-22 06:05:10 +00:00
/* Fix for bytemd-react wrapper div(仅普通编辑器,超大着色编辑器不受此约束) */
.bytemd-wrapper:not(.large-file-editor)>div {
2025-12-25 04:22:35 +00:00
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;
2026-01-31 03:41:20 +00:00
color: var(--text-color-secondary);
2025-12-25 04:22:35 +00:00
}
2026-08-25 02:17:40 +00:00
/* 文件夹视图滚动容器(复用浏览模式 docs-folder-* 布局,仅新增滚动) */
.editor-folder-scroll {
flex: 1;
min-height: 0;
min-width: 0;
overflow-y: auto;
width: 100%;
}
/* 编辑模式里的文件夹视图:与浏览模式用同一套居中和行长,
否则首次直接进入编辑模式(浏览模式样式尚未加载)时内容会一路铺到边。 */
.docs-content-wrapper {
max-width: var(--content-max-width);
margin: 0 auto;
padding: var(--space-lg);
min-height: 100%;
}
2026-08-25 02:17:40 +00:00
/* PDF 只读预览(编辑模式下内置,与浏览模式一致) */
.pdf-editor-container {
flex: 1;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
overflow: hidden;
width: 100%;
height: 100%;
background: var(--bg-color);
}
.pdf-header-toolbar {
min-width: 0;
overflow-x: auto;
overflow-y: hidden;
}
.pdf-header-toolbar .pdf-toolbar {
white-space: nowrap;
}
2025-12-25 04:22:35 +00:00
/* ByteMD 编辑器样式覆盖 */
.bytemd {
width: 100% !important;
height: 100% !important;
display: flex !important;
flex-direction: column !important;
2026-01-31 03:41:20 +00:00
border: 1px solid var(--border-color);
2025-12-25 04:22:35 +00:00
border-radius: 2px;
overflow: hidden;
2026-01-01 14:41:10 +00:00
max-width: none !important;
/* Ensure no max-width constraint */
2025-12-25 04:22:35 +00:00
box-sizing: border-box;
2026-01-31 03:41:20 +00:00
background-color: var(--bg-color);
color: var(--text-color);
2025-12-25 04:22:35 +00:00
}
/* 工具栏样式 */
.bytemd-toolbar {
flex-shrink: 0;
2026-01-31 03:41:20 +00:00
border-bottom: 1px solid var(--border-color);
background-color: var(--toolbar-bg);
2026-01-01 14:41:10 +00:00
box-sizing: border-box;
2026-01-31 03:41:20 +00:00
color: var(--text-color);
}
.bytemd-toolbar-icon {
color: var(--text-color);
}
.bytemd-toolbar-icon:hover {
background-color: var(--item-hover-bg);
2025-12-25 04:22:35 +00:00
}
2026-10-03 18:09:28 +00:00
/* ByteMD 内置的右侧按钮:1=目录 2=帮助 3=仅编辑 4=仅预览 5=全屏 6=源代码。
1/2 依赖预览区渲染,3/4 与页面自身的「编辑 / 分栏 / 预览」分段控件重复,统一隐藏;
5 由页面自绘、并入同一分段控件的「全屏」取代(DOM 仍保留,靠它驱动 ByteMD 的全屏状态);
6「源代码」是 ByteMD 指向项目主页的外链,不属于文档编辑操作,编辑模式下统一去掉。
隐藏后右侧只剩页面 Portal 注入的统一视图控件。
2026-10-01 07:21:38 +00:00
注意:页面用 Portal 把分段控件插到 .bytemd-toolbar-right 的最后一个子节点,
上面的序号才不会被错位,改动插入位置时记得同步这里的 nth-child。 */
2026-10-03 18:09:28 +00:00
.bytemd-toolbar-right .bytemd-toolbar-icon:nth-child(-n+6) {
2026-10-01 07:21:38 +00:00
display: none;
}
/* 工具栏右侧改成 flex,让「编辑 / 分栏 / 预览」和内置图标同一行居中对齐 */
.bytemd-toolbar-right {
display: flex;
align-items: center;
}
2026-10-03 18:09:28 +00:00
/* 视图模式切换(Portal 注入):编辑 / 分栏 / 预览 / 全屏 合成同一分段控件,
ByteMD 自带图标已全部隐藏,它成为工具栏右侧唯一的控件 */
2026-10-01 07:21:38 +00:00
.bytemd-toolbar-right .view-mode-switch {
order: -1;
line-height: 1;
}
/* 让单个选项与右侧 24px 图标按钮同高,整条控件不会把工具栏撑高 */
.bytemd-toolbar-right .view-mode-switch .ant-segmented-item-label {
display: flex;
align-items: center;
justify-content: center;
min-height: 20px;
padding-inline: 7px;
}
.bytemd-toolbar-right .view-mode-switch .view-mode-option {
display: inline-flex;
align-items: center;
font-size: 14px;
}
2026-10-03 18:09:28 +00:00
/* 全屏是开关动作而非视图选项:用主色区分「已进入全屏」,图标同时切换为退出样式 */
.bytemd-toolbar-right .view-mode-switch .view-mode-option.is-active {
color: var(--color-primary);
}
2026-10-01 07:21:38 +00:00
/* 预览模式是只读视图:隐藏会改动源码的 Markdown 工具栏,以及失效的同步滚动开关 */
.bytemd-wrapper[data-view-mode="preview"] .bytemd-toolbar-left {
display: none;
}
.bytemd-wrapper:not([data-view-mode="split"]) .bytemd-status-right label {
display: none;
}
/* 视图模式:编辑器始终以 split 渲染(保证 Markdown 工具栏可用),
通过显隐控制编辑区/预览区,覆盖 ByteMD 写死的 width:50% 内联样式。 */
.bytemd-wrapper[data-view-mode="edit"] .bytemd-editor,
.bytemd-wrapper[data-view-mode="preview"] .bytemd-preview {
width: 100% !important;
}
.bytemd-wrapper[data-view-mode="edit"] .bytemd-preview,
.bytemd-wrapper[data-view-mode="preview"] .bytemd-editor {
display: none !important;
}
/* 头部右侧操作区(视图模式切换已移入编辑器工具栏) */
.content-header-actions {
align-items: center;
flex-wrap: wrap;
justify-content: flex-end;
}
2026-11-11 11:07:22 +00:00
/* 保存分体按钮的标签:图标与文字对齐 */
.save-button-label {
2026-10-03 18:09:28 +00:00
display: inline-flex;
align-items: center;
gap: 6px;
}
2026-10-01 07:21:38 +00:00
/* 编辑器工具栏里的视图模式图标(文案放在 Tooltip 中) */
.view-mode-option {
display: inline-flex;
align-items: center;
line-height: 1;
}
.editor-floating-toc {
z-index: 20;
}
/* ByteMD 全屏:position: fixed 但没写 z-index,会被 ModeSwitch(z-index:1) 等浮层压住,
导致左侧项目树的操作按钮浮现在全屏编辑器上;这里显式抬到悬浮层。 */
.bytemd-fullscreen.bytemd {
z-index: var(--z-float);
}
/* 全屏时文档索引浮标要跟着抬一层,保证仍在全屏编辑器之上可点 */
.bytemd-wrapper:has(.bytemd-fullscreen) .editor-floating-toc {
z-index: calc(var(--z-float) + 1);
}
2025-12-25 04:22:35 +00:00
/* 编辑和预览区域容器 */
.bytemd-body {
flex: 1 !important;
display: flex !important;
overflow: hidden;
min-height: 0;
width: 100% !important;
2026-01-01 14:41:10 +00:00
box-sizing: border-box;
/* Added for consistent box model */
min-width: 0;
/* Prevent flex item from overflowing */
2026-01-31 03:41:20 +00:00
background-color: var(--bg-color);
2025-12-25 04:22:35 +00:00
}
/* 编辑区域 - 默认分栏,保留 Bytemd 内联样式对仅编辑/仅预览的控制 */
2025-12-25 04:22:35 +00:00
.bytemd-editor {
overflow: hidden;
min-height: 0;
2026-01-01 14:41:10 +00:00
box-sizing: border-box;
/* Added for consistent box model */
min-width: 0;
/* Prevent flex item from overflowing */
2026-01-31 03:41:20 +00:00
background-color: var(--bg-color);
2026-10-01 07:21:38 +00:00
}
.bytemd-wrapper[data-view-mode="split"] .bytemd-editor {
2026-01-31 03:41:20 +00:00
border-right: 1px solid var(--border-color);
2025-12-25 04:22:35 +00:00
}
/* 预览区域 - 默认分栏,保留 Bytemd 内联样式对仅编辑/仅预览的控制 */
2025-12-25 04:22:35 +00:00
.bytemd-preview {
overflow-y: auto !important;
overflow-x: hidden !important;
padding: 16px;
font-size: 14px;
line-height: 1.8;
2026-01-01 14:41:10 +00:00
box-sizing: border-box;
/* Added for consistent box model */
min-width: 0;
/* Prevent flex item from overflowing */
2026-01-31 03:41:20 +00:00
background-color: var(--bg-color);
color: var(--text-color);
2025-12-25 04:22:35 +00:00
}
/* CodeMirror 容器 */
.bytemd-editor .CodeMirror {
flex: 1;
min-height: 0;
font-size: 14px;
line-height: 1.8;
width: 100%;
height: 100%;
2026-01-31 03:41:20 +00:00
background-color: var(--bg-color);
color: var(--text-color);
2025-12-25 04:22:35 +00:00
}
/* ByteMD 把编辑区正文锁成 800px 居中(.CodeMirror-lines { max-width: 800px; margin: 0 auto }),
「仅编辑区」在宽屏显示器上左右各空出一大片,看起来像页面没铺满、字数也浪费。
源码编辑器按可用宽度铺满更符合直觉(和 VS Code 一致),行号与光标位置由 CodeMirror 自己测量,不受影响。 */
.bytemd-wrapper .bytemd-editor .CodeMirror .CodeMirror-lines {
max-width: none;
margin: 0;
padding: var(--space-md) 0;
}
/* 原本左右 4% 的内缩是给 800px 窄栏配的,铺满后按比例越拉越宽,改成固定留白 */
.bytemd-wrapper .bytemd-editor .CodeMirror pre.CodeMirror-line,
.bytemd-wrapper .bytemd-editor .CodeMirror pre.CodeMirror-line-like {
padding: 0 var(--space-md);
}
2025-12-25 04:22:35 +00:00
/* CodeMirror 滚动容器 */
.bytemd-editor .CodeMirror-scroll {
overflow-y: scroll !important;
overflow-x: auto !important;
min-height: 100% !important;
height: 100% !important;
}
/* 预览区继续保留「可读行长」,但跟着视口放宽:ByteMD 固定在 800px,
宽屏分栏/仅预览时同样会留出大片空白,这里放到 1100px 并保证不留横向死边。 */
.bytemd-wrapper .bytemd-preview .markdown-body {
max-width: min(100%, var(--content-max-width));
margin: 0 auto;
padding: var(--space-md) var(--space-lg);
}
2025-12-25 04:22:35 +00:00
/* 预览区域的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;
2026-01-31 03:41:20 +00:00
color: var(--text-color);
2025-12-25 04:22:35 +00:00
}
.bytemd-preview h1 {
font-size: 2em;
2026-01-31 03:41:20 +00:00
border-bottom: 1px solid var(--border-color);
2025-12-25 04:22:35 +00:00
padding-bottom: 0.3em;
}
.bytemd-preview h2 {
font-size: 1.5em;
2026-01-31 03:41:20 +00:00
border-bottom: 1px solid var(--border-color);
2025-12-25 04:22:35 +00:00
padding-bottom: 0.3em;
}
.bytemd-preview p {
margin-bottom: 16px;
2026-01-31 03:41:20 +00:00
color: var(--text-color);
2025-12-25 04:22:35 +00:00
}
.bytemd-preview code {
padding: 0.2em 0.4em;
margin: 0;
font-size: 85%;
2026-01-31 03:41:20 +00:00
background-color: var(--code-bg);
2025-12-25 04:22:35 +00:00
border-radius: 3px;
2026-01-31 03:41:20 +00:00
color: var(--text-color);
2025-12-25 04:22:35 +00:00
}
.bytemd-preview pre {
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
2026-01-31 03:41:20 +00:00
background-color: var(--code-bg);
2025-12-25 04:22:35 +00:00
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;
2026-01-31 03:41:20 +00:00
color: inherit;
2025-12-25 04:22:35 +00:00
}
.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;
2026-01-31 03:41:20 +00:00
border: 1px solid var(--table-border-color);
color: var(--text-color);
2025-12-25 04:22:35 +00:00
}
.bytemd-preview table th {
font-weight: 600;
2026-01-31 03:41:20 +00:00
background-color: var(--table-header-bg);
2025-12-25 04:22:35 +00:00
}
.bytemd-preview blockquote {
margin: 0 0 16px;
padding: 0 1em;
2026-01-31 03:41:20 +00:00
color: var(--blockquote-text-color);
border-left: 0.25em solid var(--blockquote-border-color);
2025-12-25 04:22:35 +00:00
}
.bytemd-preview ul,
.bytemd-preview ol {
padding-left: 2em;
margin-bottom: 16px;
2026-01-31 03:41:20 +00:00
color: var(--text-color);
2025-12-25 04:22:35 +00:00
}
.bytemd-preview li {
margin-bottom: 0.25em;
}
2026-05-15 11:59:49 +00:00
.content-header .preview-header-title {
flex: 1;
min-width: 0;
max-width: none;
2026-01-31 03:41:20 +00:00
}
2026-04-08 17:03:57 +00:00
@media (max-width: 768px) {
.document-editor-page {
padding: 8px;
}
}
2026-10-01 07:21:38 +00:00
/* 弹窗里的补充说明:只在新建文件时用一次,解释省略后缀的默认行为 */
.modal-field-hint {
margin-top: var(--space-xs);
font-size: 12px;
line-height: 1.6;
color: var(--text-color-secondary);
}
2026-10-01 07:21:38 +00:00
/* 未保存改动标记:与保存按钮同处内容区右上角,弱化但可辨识 */
.content-header-actions .unsaved-badge {
display: inline-flex;
align-items: center;
height: 22px;
padding: 0 var(--space-xs);
font-size: 12px;
line-height: 1;
color: var(--color-warning);
background: var(--color-warning-bg);
border: 1px solid var(--color-warning);
border-radius: var(--radius-pill);
}