功能修复

This commit is contained in:
2026-07-07 21:18:21 +08:00
parent 13a0e56a38
commit 67dab593ca
5 changed files with 39 additions and 443 deletions

View File

@@ -15,16 +15,10 @@ const props = withDefaults(
entries: DirEntry[];
content?: string;
currentFilePath?: string | null;
isFullWidth?: boolean;
displayMode?: "split" | "wysiwyg";
isMarkdownFile?: boolean;
}>(),
{
content: "",
currentFilePath: null,
isFullWidth: false,
displayMode: "split",
isMarkdownFile: false,
},
);
@@ -35,8 +29,6 @@ const emit = defineEmits<{
openFile: [path: string];
createFile: [];
createFolder: [];
toggleFullWidth: [value: boolean];
toggleDisplayMode: [value: "split" | "wysiwyg"];
}>();
// Wrap the workspace root as a top-level tree node
@@ -254,57 +246,6 @@ const showSettings = ref(false);
</button>
</div>
<div class="px-4 py-6 space-y-5">
<!-- Display mode toggle (only for .md files) -->
<div v-if="props.isMarkdownFile" class="flex items-center justify-between">
<div class="flex-1 mr-3">
<p class="text-sm text-[#38342e] font-medium">编辑模式</p>
<p class="text-xs text-[#8c877d] mt-0.5 leading-relaxed">
{{ props.displayMode === "wysiwyg" ? "单栏所见即所得预览区直接编辑" : "双栏左侧编辑源码右侧预览效果" }}
</p>
</div>
<button
type="button"
role="switch"
:aria-checked="props.displayMode === 'wysiwyg'"
:class="[
'relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none',
props.displayMode === 'wysiwyg' ? 'bg-[#bf6a3b]' : 'bg-[#d4cfc4]',
]"
@click="emit('toggleDisplayMode', props.displayMode === 'wysiwyg' ? 'split' : 'wysiwyg')"
>
<span
:class="[
'pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-sm ring-0 transition-transform duration-200 ease-in-out',
props.displayMode === 'wysiwyg' ? 'translate-x-4' : 'translate-x-0',
]"
/>
</button>
</div>
<!-- Full-width mode toggle -->
<div class="flex items-center justify-between">
<div class="flex-1 mr-3">
<p class="text-sm text-[#38342e] font-medium">全宽模式</p>
<p class="text-xs text-[#8c877d] mt-0.5 leading-relaxed">关闭后编辑器居中显示,适合专注书写</p>
</div>
<button
type="button"
role="switch"
:aria-checked="props.isFullWidth"
:class="[
'relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none',
props.isFullWidth ? 'bg-[#bf6a3b]' : 'bg-[#d4cfc4]',
]"
@click="emit('toggleFullWidth', !props.isFullWidth)"
>
<span
:class="[
'pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-sm ring-0 transition-transform duration-200 ease-in-out',
props.isFullWidth ? 'translate-x-4' : 'translate-x-0',
]"
/>
</button>
</div>
</div>
</div>
</div>