v0.3.7: 修复保存竞争态 + 新增源码编辑模式

Bug修复:
  - BUG-10 修复: 保存文件时 watcher restart 触发虚假 change 事件覆盖编辑器内容
    - ipc-handlers.ts: restart watcher 在 setSelfWriting(true) 保护内执行
    - App.tsx handleReloadModified: 增加 if (tab?.isModified) return 安全守卫

新功能:
  - 新增源码(Source)视图模式,直接用 textarea 编辑原始 Markdown
  - ViewMode 扩展为 editor|preview|source
  - 工具栏增加源码按钮,快捷键 Ctrl+3
  - 内容与 WYSIWYG 编辑器共享 tabStore,切换模式不丢内容

验证: TS 0错误, ESLint 0错误(1个预存警告), 90/90测试通过
This commit is contained in:
thzxx
2026-06-04 15:17:26 +08:00
parent c34a843d5c
commit c0e16f2885
9 changed files with 141 additions and 24 deletions
+36 -2
View File
@@ -322,6 +322,35 @@ body {
cursor: text;
}
/* Source Editor */
.source-editor-wrapper {
flex: 1;
display: flex;
min-width: 0;
min-height: 0;
}
.source-editor-textarea {
flex: 1;
border: none;
outline: none;
resize: none;
padding: 16px 20px;
font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
font-size: 14px;
line-height: 1.6;
tab-size: 2;
color: #1e1e1e;
background: #fafafa;
user-select: text;
cursor: text;
}
.source-editor-dark .source-editor-textarea {
color: #d4d4d4;
background: #1e1e1e;
}
/* Tab Bar */
#tab-bar {
height: 36px;
@@ -583,8 +612,13 @@ body {
}
@keyframes auto-save-pulse {
0%, 100% { opacity: 0.6; }
50% { opacity: 1; }
0%,
100% {
opacity: 0.6;
}
50% {
opacity: 1;
}
}
/* Drop Overlay */