fix: protect editor content and harden document exports

Protect pending edits on window close, keep save-as paths and drafts consistent,
copy relative image resources, reject oversized table imports without truncation,
and preserve independent preview scrolling during refresh.

Archive rendered MHTML resources with portable references and embedded local
fonts. Preserve existing outputs on export cancellation or failure. Convert
editor match positions and filter directory results in linear passes.

Include the previously completed editor image/table/history improvements,
undoable replacement, export snapshots, shared page settings, and cancellable
PDF/Word export workflow. Update documentation and version to 0.3.1.

Validation: 142 pytest cases passed; GUI smoke, improvements integration, and
offline MHTML/scroll reliability smoke checks passed.
This commit is contained in:
2026-10-29 18:22:42 +08:00
parent fac5cbb011
commit 8dae91c2ca
26 changed files with 2722 additions and 385 deletions
+24
View File
@@ -81,6 +81,18 @@ MDHelper 读取文档时不会锁定文件,外部编辑器仍可保存。
可先导出 HTML,确认内容渲染正常,再导出 PDF。
## 导出的 Word 目录仍显示提示文字
Word 目录使用可更新的目录域。打开文件后,在目录提示文字处右键选择“更新域”,由 Word 按实际页面生成页码。PDF 的目录页码在导出时自动生成。
## 修改已经保存,想恢复旧内容
使用“文件 → 历史版本”,查看版本差异后恢复到编辑区。确认无误再保存;恢复操作本身可以撤销。本机每个文件路径保留最近 20 个保存前版本,重命名后的路径有独立记录。
## 分享文档后图片无法显示
粘贴或拖入的图片保存在文档旁的“文档名.assets”文件夹。移动或分享 Markdown 时,请将该文件夹一起带走,并保持相对位置不变。
## 代码文件不显示
打开 `工具 - 设置 - 展示文件类型`,勾选需要的类型:
@@ -113,6 +125,18 @@ MDHelper 读取文档时不会锁定文件,外部编辑器仍可保存。
.\dist\MDHelper\MDHelper.exe --check --project-root .
```
## 另存为失败或图片无法复制
另存为到其他目录会同时复制相对引用的图片。请确认源图片存在且目标目录可写。失败时编辑内容、原文档路径和草稿仍保留;只有全部保存成功才切换到新路径。
## 从 Excel 粘贴表格提示超限
图形表格上限为 1000 行(含表头)、100 列。超限时不导入任何单元格,以免静默截断。可拆分后粘贴,或直接编辑 Markdown 源码。
## MHTML 导出失败
离线归档需要先加载文档中的实际图片、公式及图表。请根据提示修复资源路径,或将未能封装的远程样式资源改为本地资源。取消和失败均保留原有输出文件。成功导出的归档可单独移动,不需要原图片目录。
## 如何定位日志
MDHelper 会把日志写到用户可写目录。若启动或打开文档异常,优先查看最近的运行日志,并把错误堆栈和打开的文件路径一起记录下来。