fix: 补齐 macOS 桌面应用的 Markdown 文件关联

问题修复:electron-builder 的 mac 配置块此前没有声明 fileAssociations,
打包出的 .app 缺少 Info.plist 的 CFBundleDocumentTypes,导致 Finder"打开
方式"里找不到 MorphDoc,也无法通过双击 .md/.markdown 文件启动。现在新增
对应声明(.md、.markdown,角色 Editor),与 Windows 侧 ProgID 注册对齐;
主进程既有的 open-file 事件处理无需改动。

验证结果:重新打包 arm64 版本后,用 NSWorkspace 查询 .md 候选打开应用,
MorphDoc.app 已正确出现在列表中。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5N6pcbjV4jVfXrcH3NcLP
This commit is contained in:
SkyJourney
2026-08-27 19:52:42 +08:00
co-authored by Claude Sonnet 5
parent 7533226366
commit 1fc30f8cf5
2 changed files with 17 additions and 2 deletions
+5 -2
View File
@@ -9,9 +9,12 @@ Gitea Release 页面正文的基础;构建产物、校验和及详细验收记
## [Unreleased] ## [Unreleased]
### 变更 ### 修复
- 暂无。 - 修复 macOS 桌面应用未声明 `.md`/`.markdown` 文件关联的问题:`electron-builder`
`mac` 配置块新增 `fileAssociations`,写入 Info.plist 的
`CFBundleDocumentTypes`Finder"打开方式"中现在能正确列出 MorphDoc;主进程
既有的 `open-file` 事件处理无需改动。
## [0.6.4] - 2026-08-26 ## [0.6.4] - 2026-08-26
+12
View File
@@ -125,6 +125,18 @@ module.exports = {
target: "dmg" target: "dmg"
} }
], ],
// 声明 .md/.markdown 文件关联,写入 Info.plist 的 CFBundleDocumentTypes
// 否则 Finder 的"打开方式"里不会出现本应用;与 Windows 侧的 ProgID 注册
// 是对等能力,主进程已有的 open-file 事件处理无需改动。
fileAssociations: [
{
ext: ["md", "markdown"],
name: "Markdown",
description: "Markdown 文档",
role: "Editor",
icon: macIcon
}
],
extraResources: macTargetArch extraResources: macTargetArch
? [ ? [
{ {