From 77fb49fedcabf082330d9f27214028891552011c Mon Sep 17 00:00:00 2001 From: cirry <812852553@qq.com> Date: Wed, 8 Jul 2026 09:51:23 +0800 Subject: [PATCH] =?UTF-8?q?=20=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 85 +++++- src/components/MarkdownEditor.vue | 446 ++++++++++++++++++++++++++++-- 2 files changed, 497 insertions(+), 34 deletions(-) diff --git a/src/App.vue b/src/App.vue index b97bc77..6842469 100644 --- a/src/App.vue +++ b/src/App.vue @@ -9,6 +9,8 @@ const content = ref(""); const wordCount = ref(0); const charCount = ref(0); +type DocumentMode = "preview" | "edit" | "mixed"; + // File state const currentFilePath = ref(null); const saveStatus = ref(""); @@ -75,7 +77,7 @@ function onEditorWheel(e: WheelEvent) { // ---- toolbar state ---- const showThumbnail = ref(true); -const previewOnly = ref(false); +const documentMode = ref("edit"); const showMoreMenu = ref(false); function handleExportPdf() { @@ -319,17 +321,33 @@ listen("menu-event", (event) => {
- - + +
+ + + +
@@ -363,7 +381,7 @@ listen("menu-event", (event) => {
{ background-color: #f4f1ea; } +.mode-toggle { + display: inline-flex; + align-items: center; + height: 30px; + padding: 2px; + border: 1px solid #e0dbcf; + border-radius: 7px; + background-color: #f4f1ea; + flex-shrink: 0; +} + +.mode-toggle-btn { + display: inline-flex; + align-items: center; + justify-content: center; + height: 24px; + min-width: 42px; + padding: 0 9px; + border: none; + border-radius: 5px; + background: transparent; + color: #8c877d; + font-size: 12px; + line-height: 1; + cursor: pointer; + transition: + background-color 0.15s, + color 0.15s, + box-shadow 0.15s; +} + +.mode-toggle-btn:hover { + color: #38342e; +} + +.mode-toggle-btn-active { + background-color: #fffdfa; + color: #bf6a3b; + box-shadow: 0 1px 3px rgba(56, 52, 46, 0.12); +} + .dropdown-menu { position: absolute; right: 0; diff --git a/src/components/MarkdownEditor.vue b/src/components/MarkdownEditor.vue index b3933f7..6507fdb 100644 --- a/src/components/MarkdownEditor.vue +++ b/src/components/MarkdownEditor.vue @@ -1,5 +1,11 @@