Files
msime-windows/engine/contracts/webview/messages.json
T
Lu Fan(SonnyCalcr) 4375d80414 feat: 支持导入自定义辅助码,内置“加加”更名为“拼音加加” (#477)
* feat(engine): 支持 helpcodes/custom 下的自定义辅助码

custom 目录里的每个 .txt 都是一套方案,方案名为 custom/<文件名>。
文件开头的 "# name:" / "# name_en:" 注释给出中英文显示名,缺省用文件名;
兼容 BOM、CRLF 和全角冒号。方案名不能跳出 custom 目录。

* feat(engine): WebView 契约新增 openHelpcodeDirectory

设置页请求打开自定义辅助码目录,仅允许 settings 页发送。同步 ui-html/webview2/shared。

* feat(server): 设置页列出自定义辅助码并可打开其目录

配置快照带上 helpcode.custom_schemas 与 helpcode.custom_directory,每次都会重新扫描;
方案文件被删除或改名后回退到 lantian。两个设置宿主都会处理 openHelpcodeDirectory。

* feat(ui-html): 辅助码设置显示拼音加加与自定义方案

内置方案“加加”改名为“拼音加加”。自定义方案追加在内置方案之后;新增说明区,
提供“打开目录”和“刷新方案”两个按钮,刷新完成后弹出提示。

* feat(installer): 升级与迁移数据目录时保留自定义辅助码

升级清理时只清掉 helpcodes 里的内置表,保留 custom 子目录;更换数据目录时一并迁移;
安装时建出 helpcodes\custom。
2026-09-26 20:21:55 +08:00

965 lines
19 KiB
JSON

{
"version": 1,
"client": {
"configRequest": {
"surfaces": [
"settings"
]
},
"skinCatalogRequest": {
"surfaces": [
"settings"
]
},
"openSkinDirectory": {
"surfaces": [
"settings"
]
},
"openHelpcodeDirectory": {
"surfaces": [
"settings"
]
},
"openHandwritingPanel": {
"surfaces": [
"settings"
]
},
"restartServer": {
"surfaces": [
"settings"
]
},
"copyText": {
"surfaces": [
"settings"
],
"data": {
"type": "string"
}
},
"openExternalUrl": {
"surfaces": [
"settings"
],
"data": {
"type": "string"
}
},
"dragStart": {
"surfaces": [
"settings",
"toolbar"
]
},
"focus": {
"surfaces": [
"settings"
]
},
"resizeStart": {
"surfaces": [
"settings"
],
"data": {
"type": "string",
"enum": [
"left",
"right",
"top",
"bottom",
"left-top",
"right-top",
"left-bottom",
"right-bottom",
"client"
]
}
},
"resizeHitTest": {
"surfaces": [
"settings"
],
"data": {
"type": "string",
"enum": [
"left",
"right",
"top",
"bottom",
"left-top",
"right-top",
"left-bottom",
"right-bottom",
"client"
]
}
},
"windowControl": {
"surfaces": [
"settings"
],
"data": {
"type": "string",
"enum": [
"minimize",
"maximize",
"restore",
"close"
]
}
},
"maximizeButtonRect": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"width": {
"type": "number",
"minimum": 0
},
"height": {
"type": "number",
"minimum": 0
},
"dpr": {
"type": "number",
"minimum": 0.01
}
},
"required": [
"x",
"y",
"width",
"height",
"dpr"
],
"additionalProperties": false
}
},
"configUpdate": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"value": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
}
]
}
},
"required": [
"path",
"value"
],
"additionalProperties": false
}
},
"apiCredentialTest": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"requestId": {
"type": "string"
},
"service": {
"type": "string",
"enum": [
"translation.tencent",
"translation.niutrans",
"translation.custom",
"voice.asr",
"voice.polish",
"ai.assistant"
]
},
"config": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": true
}
},
"required": [
"requestId",
"service",
"config"
],
"additionalProperties": false
}
},
"dictionaryRequest": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"requestId": {
"type": "string"
},
"dictionary": {
"type": "string",
"enum": [
"quanpin",
"wubi",
"english",
"quick"
]
},
"action": {
"type": "string",
"enum": [
"query",
"create",
"update",
"delete",
"import",
"importHans",
"export"
]
},
"word": {
"type": "string"
},
"code": {
"type": "string"
},
"content": {
"type": "string"
},
"weight": {
"type": "integer"
},
"oldWord": {
"type": "string"
},
"oldCode": {
"type": "string"
},
"display": {
"type": "string"
},
"oldDisplay": {
"type": "string"
},
"offset": {
"type": "integer",
"minimum": 0,
"maximum": 2147483647
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 200
}
},
"required": [
"requestId",
"dictionary",
"action"
],
"additionalProperties": false
}
},
"statsRequest": {
"surfaces": [
"settings"
],
"data": {
"type": "object",
"properties": {
"requestId": {
"type": "string"
},
"action": {
"type": "string",
"enum": [
"overview",
"clearAll",
"openDirectory"
]
}
},
"required": [
"requestId",
"action"
],
"additionalProperties": false
}
},
"openKeyboardPanel": {
"surfaces": [
"settings",
"toolbar"
]
},
"candidate": {
"surfaces": [
"candidate"
],
"data": {
"type": "integer",
"minimum": 1,
"maximum": 10
}
},
"delete": {
"surfaces": [
"candidate"
],
"data": {
"type": "integer",
"minimum": 1,
"maximum": 10
}
},
"pin": {
"surfaces": [
"candidate"
],
"data": {
"type": "integer",
"minimum": 1,
"maximum": 10
}
},
"clearPosition": {
"surfaces": [
"candidate"
],
"data": {
"type": "integer",
"minimum": 1,
"maximum": 10
}
},
"candidateWheel": {
"surfaces": [
"candidate"
],
"data": {
"type": "integer",
"minimum": -32768,
"maximum": 32767
}
},
"fixPosition": {
"surfaces": [
"candidate"
],
"data": {
"type": "object",
"properties": {
"index": {
"type": "integer",
"minimum": 1,
"maximum": 10
},
"position": {
"type": "integer",
"minimum": 1,
"maximum": 5
}
},
"required": [
"index",
"position"
],
"additionalProperties": false
}
},
"contextMenuResize": {
"surfaces": [
"candidate"
],
"data": {
"type": "object",
"properties": {
"width": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"height": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"topExpansion": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"leftExpansion": {
"type": "integer",
"minimum": 0,
"maximum": 65535
}
},
"required": [
"width",
"height"
],
"additionalProperties": false
}
},
"contextMenuClosed": {
"surfaces": [
"candidate"
]
},
"candidatePointerArmed": {
"surfaces": [
"candidate"
]
},
"candidatePointerMotion": {
"surfaces": [
"candidate"
]
},
"candidateFrameProbe": {
"surfaces": [
"candidate"
],
"data": {
"type": "object",
"properties": {
"revision": {
"type": "integer"
},
"stage": {
"type": "integer"
},
"performanceMs": {
"type": "number",
"minimum": 0
}
},
"required": [
"revision",
"stage",
"performanceMs"
],
"additionalProperties": false
}
},
"candidatePointerProbe": {
"surfaces": [
"candidate"
],
"data": {
"type": "object",
"properties": {
"probe": {
"type": "integer"
},
"screenX": {
"type": "integer"
},
"screenY": {
"type": "integer"
},
"clientX": {
"type": "integer"
},
"clientY": {
"type": "integer"
},
"movementX": {
"type": "integer"
},
"movementY": {
"type": "integer"
},
"armed": {
"type": "boolean"
}
},
"required": [
"probe",
"screenX",
"screenY",
"clientX",
"clientY",
"movementX",
"movementY",
"armed"
],
"additionalProperties": false
}
},
"contentTruncated": {
"surfaces": [
"candidate",
"toolbar",
"menu"
],
"data": {
"type": "object",
"properties": {
"surface": {
"type": "string",
"enum": [
"candidate",
"toolbar",
"menu",
"ftb",
"candwnd",
"cand"
]
},
"width": {
"type": "number",
"minimum": 0
},
"height": {
"type": "number",
"minimum": 0
}
},
"required": [
"surface",
"width",
"height"
],
"additionalProperties": true
}
},
"floatingToggle": {
"surfaces": [
"menu"
],
"data": {
"type": "boolean"
}
},
"settings": {
"surfaces": [
"menu"
]
},
"about": {
"surfaces": [
"menu"
]
},
"emojiSymbols": {
"surfaces": [
"menu"
]
},
"keyboardPanel": {
"surfaces": [
"menu"
]
},
"handwritingPanel": {
"surfaces": [
"menu"
]
},
"voiceInput": {
"surfaces": [
"menu"
]
},
"ready": {
"surfaces": [
"toolbar"
]
},
"exitEnglishInputMode": {
"surfaces": [
"toolbar"
]
},
"changeCharacterSet": {
"surfaces": [
"toolbar"
]
},
"openSettings": {
"surfaces": [
"toolbar"
]
},
"openEmojiPanel": {
"surfaces": [
"toolbar"
]
},
"changeIMEMode": {
"surfaces": [
"toolbar"
],
"data": {
"type": "string",
"enum": [
"cn",
"en"
]
}
},
"changeCharMode": {
"surfaces": [
"toolbar"
],
"data": {
"type": "string",
"enum": [
"fullwidth",
"halfwidth"
]
}
},
"changePuncMode": {
"surfaces": [
"toolbar"
],
"data": {
"type": "string",
"enum": [
"puncEn",
"puncCn"
]
}
}
},
"server": {
"configSnapshot": {
"data": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": true
}
},
"windowState": {
"data": {
"type": "object",
"properties": {
"isMaximized": {
"type": "boolean"
}
},
"required": [
"isMaximized"
],
"additionalProperties": false
}
},
"maxButtonEvent": {
"data": {
"type": "object",
"properties": {
"event": {
"type": "string",
"enum": [
"enter",
"leave",
"down",
"up",
"click"
]
}
},
"required": [
"event"
],
"additionalProperties": false
}
},
"apiCredentialTestResult": {
"properties": {
"requestId": {
"type": "string"
},
"ok": {
"type": "boolean"
},
"message": {
"type": "string"
}
},
"required": [
"requestId",
"ok",
"message"
],
"additionalProperties": false
},
"dictionaryResponse": {
"properties": {
"requestId": {
"type": "string"
},
"action": {
"type": "string"
},
"dictionary": {
"type": "string"
},
"ok": {
"type": "boolean"
},
"message": {
"type": "string"
},
"rows": {
"type": "array",
"items": {
"type": "object",
"properties": {
"word": {
"type": "string"
},
"code": {
"type": "string"
},
"display": {
"type": "string"
},
"weight": {
"type": "integer"
}
},
"required": [
"word"
],
"additionalProperties": false
}
},
"content": {
"type": "string"
},
"filename": {
"type": "string"
},
"offset": {
"type": "integer",
"minimum": 0
},
"hasMore": {
"type": "boolean"
}
},
"required": [
"requestId",
"ok",
"message",
"rows"
],
"additionalProperties": true
},
"statsResponse": {
"properties": {
"requestId": {
"type": "string"
},
"action": {
"type": "string"
},
"ok": {
"type": "boolean"
},
"message": {
"type": "string"
},
"overview": {
"type": "object",
"properties": {
"hasData": {
"type": "boolean"
},
"firstDayKey": {
"type": "integer"
},
"lastDayKey": {
"type": "integer"
},
"days": {
"type": "integer"
},
"totalChars": {
"type": "integer"
},
"totalActiveMs": {
"type": "integer"
},
"todayDayKey": {
"type": "integer"
},
"todayChars": {
"type": "integer"
},
"todayActiveMs": {
"type": "integer"
},
"averagePerDay": {
"type": "number"
},
"currentStreak": {
"type": "integer"
},
"longestStreak": {
"type": "integer"
},
"bestDayKey": {
"type": "integer"
},
"bestDayChars": {
"type": "integer"
},
"todaySpeed": {
"type": "number"
},
"averageSpeed": {
"type": "number"
},
"fastestSpeed": {
"type": "number"
},
"fastestDayKey": {
"type": "integer"
},
"categories": {
"type": "object",
"properties": {
"cjk": {
"type": "integer"
},
"latin": {
"type": "integer"
},
"digit": {
"type": "integer"
},
"punct": {
"type": "integer"
},
"other": {
"type": "integer"
}
},
"required": [
"cjk",
"latin",
"digit",
"punct",
"other"
],
"additionalProperties": false
},
"todayHourly": {
"type": "array",
"items": {
"type": "integer"
}
},
"daily": {
"type": "array",
"items": {
"type": "object",
"properties": {
"dayKey": {
"type": "integer"
},
"cjk": {
"type": "integer"
},
"latin": {
"type": "integer"
},
"digit": {
"type": "integer"
},
"punct": {
"type": "integer"
},
"other": {
"type": "integer"
},
"activeMs": {
"type": "integer"
}
},
"required": [
"dayKey",
"cjk",
"latin",
"digit",
"punct",
"other",
"activeMs"
],
"additionalProperties": false
}
}
},
"required": [
"hasData",
"firstDayKey",
"lastDayKey",
"days",
"totalChars",
"totalActiveMs",
"todayDayKey",
"todayChars",
"todayActiveMs",
"averagePerDay",
"currentStreak",
"longestStreak",
"bestDayKey",
"bestDayChars",
"todaySpeed",
"averageSpeed",
"fastestSpeed",
"fastestDayKey",
"categories",
"todayHourly",
"daily"
],
"additionalProperties": false
},
"removedDays": {
"type": "integer"
}
},
"required": [
"requestId",
"action",
"ok",
"message"
],
"additionalProperties": true
}
}
}