Skip to content

Commit 0668c70

Browse files
committed
🐛 草稿无内容的情况下,不需要提示保存 fix: #421
1 parent a312b2e commit 0668c70

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

app/src/pages/_app.tsx

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import RecentFilesPanel from "./_fixed_panel/_recent_files_panel";
2626
import StartFilePanel from "./_fixed_panel/_start_file_panel";
2727
import TagPanel from "./_fixed_panel/_tag_panel";
2828
import FloatingOutlet from "./_floating_outlet";
29+
import { StageManager } from "../core/stage/stageManager/StageManager";
2930

3031
export default function App() {
3132
const [maxmized, setMaxmized] = React.useState(false);
@@ -98,21 +99,26 @@ export default function App() {
9899
e.preventDefault();
99100
try {
100101
if (Stage.path.getFilePath() === Stage.path.draftName) {
101-
await Dialog.show({
102-
title: "真的要关闭吗?",
103-
content: "您现在的新建草稿没有保存,是否要关闭项目?",
104-
buttons: [
105-
{
106-
text: "不保存",
107-
onClick: async () => {
108-
await getCurrentWindow().destroy();
102+
if (StageManager.isEmpty()) {
103+
// 空草稿,直接关闭
104+
await getCurrentWindow().destroy();
105+
} else {
106+
await Dialog.show({
107+
title: "真的要关闭吗?",
108+
content: "您现在的新建草稿没有保存,是否要关闭项目?",
109+
buttons: [
110+
{
111+
text: "不保存",
112+
onClick: async () => {
113+
await getCurrentWindow().destroy();
114+
},
109115
},
110-
},
111-
{
112-
text: "取消",
113-
},
114-
],
115-
});
116+
{
117+
text: "取消",
118+
},
119+
],
120+
});
121+
}
116122
} else {
117123
// 先检查下是否开启了关闭自动保存
118124
const isAutoSave = await Settings.get("autoSaveWhenClose");

0 commit comments

Comments
 (0)