File tree Expand file tree Collapse file tree 1 file changed +20
-14
lines changed Expand file tree Collapse file tree 1 file changed +20
-14
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import RecentFilesPanel from "./_fixed_panel/_recent_files_panel";
2626import StartFilePanel from "./_fixed_panel/_start_file_panel" ;
2727import TagPanel from "./_fixed_panel/_tag_panel" ;
2828import FloatingOutlet from "./_floating_outlet" ;
29+ import { StageManager } from "../core/stage/stageManager/StageManager" ;
2930
3031export 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" ) ;
You can’t perform that action at this time.
0 commit comments