添加测试工作区
This commit is contained in:
1 parent
fc6447acb5
commit
4bb083f736
10 files changed
+34
-14
No files matched your search
+21
-13
@@ -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,
|
||||
|
||||
@@ -14,7 +14,6 @@ export interface SettingsModel {
|
||||
}
|
||||
|
||||
const settingPath = 'settings.json';
|
||||
const sampleNodeConfig = 'sample-node-config.json';
|
||||
const sampleNodeClassify: BehaviorNodeClassify[] = [
|
||||
{ classify: "Composite", desc: "复合节点" },
|
||||
{ classify: "Decorator", desc: "修饰节点" },
|
||||
@@ -83,6 +82,9 @@ export default class Settings {
|
||||
pushRecentWorkspace(path: string) {
|
||||
if (this.settings.recentWorkspaces.indexOf(path) < 0) {
|
||||
this.settings.recentWorkspaces.unshift(path);
|
||||
console.log("push", path);
|
||||
} else {
|
||||
console.log("already in path", this.settings.recentWorkspaces, path);
|
||||
}
|
||||
this.save();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user