feat: 小银 Markdown 编辑器 v2.6.1 源码
纯本地 Windows Markdown 编辑器(Electron + Tauri 双栈): - 实时预览、多标签 / 多窗口两种打开方式 - 查找高亮、大纲、侧栏面板 - 右键复制全文 / 打开目录、常用快捷键 - 不联网、不登录、不收集任何数据 仓库化时做的处理: - 路径脱敏:README 与 tools/mklink.js 里写死的 C:\Users\<用户名> 改为 %USERPROFILE% / process.env.USERPROFILE,换机器即可用(原文件含个人目录名) - 补 .gitignore(node_modules / dist / src-tauri/target / Tauri 自动生成的 gen/schemas) - 补 MIT LICENSE(与 package.json 的 license 字段一致)
This commit is contained in:
commit
66bad58593
37 files changed
+11319
No files matched your search
@@ -0,0 +1,35 @@
|
||||
/* 验证关闭窗口时主进程不抛异常 */
|
||||
process.on('uncaughtException', (e) => {
|
||||
console.log('UNCAUGHT:', e.message);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
const { app, BrowserWindow } = require('electron');
|
||||
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
require('../src/main.js');
|
||||
// 阻止 window-all-closed 自动退出,便于关闭后继续检查
|
||||
app.removeAllListeners('window-all-closed');
|
||||
|
||||
let errors = [];
|
||||
process.on('uncaughtException', (e) => errors.push(e.message));
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
await wait(1400);
|
||||
const wins = BrowserWindow.getAllWindows();
|
||||
console.log('打开窗口数:', wins.length);
|
||||
|
||||
// 连续开关多个窗口,覆盖正常关闭和迁移式关闭
|
||||
const w2 = new BrowserWindow({ show: false, webPreferences: { offscreen: true } });
|
||||
w2.close();
|
||||
await wait(300);
|
||||
|
||||
for (const w of wins) w.close();
|
||||
await wait(1000);
|
||||
|
||||
if (errors.length) {
|
||||
console.log('FAIL 主进程异常:', errors.join(' | '));
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('PASS 关闭窗口无主进程异常');
|
||||
process.exit(0);
|
||||
});
|
||||
Reference in new issue
Block a user