添加测试工作区

This commit is contained in:
zhandouxiaojiji committed 2020-11-05 16:08:10 +08:00
1 parent fc6447acb5
commit 4bb083f736
10 files changed
+34 -14

No files matched your search

+21 -13
View File
@@ -94,6 +94,20 @@ export default class AppMenu {
this.mainProcess.rebuildMenu();
this.webContents.send(MainEventType.OPEN_DIR, this.settings.curWorkspace.getWorkdir());
};
const saveToNewPath = () => {
(async () => {
const res = await dialog.showSaveDialog({
properties: ['showOverwriteConfirmation'],
filters: [
{ name: "Json", extensions: ['json'] }
]
});
if (!res.canceled) {
this.settings.curWorkspace.setFilepath(res.filePath);
this.settings.curWorkspace.save();
}
})();
}
const recentItems: MenuItemConstructorOptions[] = [];
for (let path of this.settings.recentWorkspaces) {
recentItems.push({
@@ -129,22 +143,16 @@ export default class AppMenu {
if (this.settings.curWorkspace.getFilepath()) {
this.settings.curWorkspace.save();
} else {
(async () => {
const res = await dialog.showSaveDialog({
properties: ['showOverwriteConfirmation'],
filters: [
{ name: "Json", extensions: ['json'] }
]
});
if (!res.canceled) {
this.settings.curWorkspace.setFilepath(res.filePath);
this.settings.curWorkspace.save();
}
})();
saveToNewPath();
}
}
},
{
label: '另存为',
click: () => {
saveToNewPath();
},
},
{
label: "最近打开",
submenu: recentItems,