From c34a843d5cebbe35cf188602678870fcd525c876 Mon Sep 17 00:00:00 2001
From: thzxx
Date: Thu, 4 Jun 2026 14:23:27 +0800
Subject: [PATCH] =?UTF-8?q?v0.3.6:=20=E4=BF=AE=E5=A4=8D=E6=96=87=E6=A1=A3?=
=?UTF-8?q?=E5=A4=A7=E7=BA=B2=E5=AF=BC=E8=88=AABug=20+=20=E6=96=B0?=
=?UTF-8?q?=E5=A2=9E=E8=87=AA=E5=8A=A8=E4=BF=9D=E5=AD=98=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bug修复:
- 文档大纲点击标题未定位到编辑器内容 (P0)
- 根因: raw markdown字符偏移 ≠ ProseMirror文档位置
- 改为通过 view.state.doc.descendants() 遍历节点树,
按 heading类型名 + level + textContent 三重匹配定位
新增功能:
- 自动保存 (2秒防抖), 仅对文件标签页生效
- 状态栏显示 自动/保存中... 指示器
版本同步: package.json / AboutDialog / README 均更新至 v0.3.6
---
README.md | 2 +-
package.json | 2 +-
src/renderer/App.tsx | 4 +-
.../components/AboutDialog/AboutDialog.tsx | 2 +-
.../components/OutlinePanel/OutlinePanel.tsx | 11 ++-
src/renderer/components/Sidebar/Sidebar.tsx | 30 +++++--
.../components/StatusBar/StatusBar.tsx | 22 ++++-
src/renderer/hooks/useAutoSave.ts | 87 +++++++++++++++++++
src/renderer/styles/global.css | 17 ++++
9 files changed, 163 insertions(+), 14 deletions(-)
create mode 100644 src/renderer/hooks/useAutoSave.ts
diff --git a/README.md b/README.md
index d27e4fc..1ac84d6 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@
-
+
diff --git a/package.json b/package.json
index c8abcf8..ab44c59 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "marklite",
- "version": "0.3.5",
+ "version": "0.3.6",
"description": "Lightweight Markdown Editor for Windows",
"main": "./dist/main/index.js",
"scripts": {
diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx
index 74ccc84..893fee0 100644
--- a/src/renderer/App.tsx
+++ b/src/renderer/App.tsx
@@ -9,6 +9,7 @@ import { useUnsavedWarning } from './hooks/useUnsavedWarning'
import { useFileWatch } from './hooks/useFileWatch'
import { useFileOperations } from './hooks/useFileOperations'
import { useDragDrop } from './hooks/useDragDrop'
+import { useAutoSave } from './hooks/useAutoSave'
import { useIpcListeners } from './hooks/useIpcListeners'
import { useToast } from './hooks/useToast'
import { useConfirm } from './hooks/useConfirm'
@@ -49,6 +50,7 @@ export function App() {
const { handleOpenFile, handleSave, handleSaveAs, handleOpenRecent } = useFileOperations(showToast)
useDragDrop(showToast)
useFileWatch()
+ const { isAutoSaving, autoSaveEnabled } = useAutoSave()
// UX-01: 传入 confirm 函数替代原生 confirm()
const handleConfirmClose = useCallback(async (message: string): Promise => {
@@ -107,7 +109,7 @@ export function App() {
)}
-
+
{showAbout && }
diff --git a/src/renderer/components/AboutDialog/AboutDialog.tsx b/src/renderer/components/AboutDialog/AboutDialog.tsx
index f38067c..5c0f686 100644
--- a/src/renderer/components/AboutDialog/AboutDialog.tsx
+++ b/src/renderer/components/AboutDialog/AboutDialog.tsx
@@ -1,7 +1,7 @@
import React from 'react'
import { AppIcon, Gitee } from '../Icons'
-const APP_VERSION = 'v0.3.4'
+const APP_VERSION = 'v0.3.6'
interface AboutDialogProps {
onClose: () => void
diff --git a/src/renderer/components/OutlinePanel/OutlinePanel.tsx b/src/renderer/components/OutlinePanel/OutlinePanel.tsx
index e545150..224c64a 100644
--- a/src/renderer/components/OutlinePanel/OutlinePanel.tsx
+++ b/src/renderer/components/OutlinePanel/OutlinePanel.tsx
@@ -36,25 +36,27 @@ export function parseHeadings(markdown: string): Heading[] {
interface OutlinePanelProps {
headings: Heading[]
- onNavigate: (pos: number) => void
+ onNavigate: (heading: Heading, index: number) => void
activeHeadingIndex: number | null
}
interface OutlineItemProps {
heading: Heading
+ index: number
isActive: boolean
- onNavigate: (pos: number) => void
+ onNavigate: (heading: Heading, index: number) => void
}
const OutlineItem = memo(function OutlineItem({
heading,
+ index,
isActive,
onNavigate
}: OutlineItemProps) {
return (