Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
332 changes: 85 additions & 247 deletions bun.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"url": "git+https://github.com/opencor/webapp.git"
},
"type": "module",
"version": "1.20261102.0",
"version": "1.20261105.0",
"engines": {
"bun": ">=1.2.0"
},
Expand Down Expand Up @@ -53,7 +53,7 @@
"xxhash-wasm": "^1.1.0"
},
"devDependencies": {
"@biomejs/biome": "^2.6.4",
"@biomejs/biome": "^2.6.5",
"@celldl/editor": "^0.20261029.0",
"@celldl/rdf": "^1.20260822.0",
"@electron-toolkit/tsconfig": "^2.0.0",
Expand All @@ -62,8 +62,8 @@
"@physiomelinks/bg2cellml": "^0.6.2",
"@primeuix/themes": "2.0.3",
"@primevue/auto-import-resolver": "4.5.5",
"@tailwindcss/postcss": "^4.3.3",
"@tailwindcss/vite": "^4.3.3",
"@tailwindcss/postcss": "^4.3.4",
"@tailwindcss/vite": "^4.3.4",
"@types/bun": "^1.4.4",
"@types/node": "^26.6.6",
"@vitejs/plugin-vue": "^6.0.10",
Expand All @@ -72,7 +72,7 @@
"@wasm-fmt/clang-format": "^23.1.1",
"autoprefixer": "^10.6.2",
"cmake-js": "^8.0.0",
"electron": "^45.2.1",
"electron": "^45.2.3",
"electron-builder": "^26.18.0",
"electron-conf": "^1.3.0",
"electron-updater": "^6.8.11",
Expand All @@ -83,10 +83,10 @@
"postcss": "^8.5.32",
"primeicons": "7.0.0",
"primevue": "4.5.5",
"rollup-plugin-visualizer": "^7.1.1",
"stylelint": "^17.16.0",
"stylelint-config-standard": "^40.0.0",
"tailwindcss": "^4.3.3",
"rollup-plugin-visualizer": "^7.1.2",
"stylelint": "^18.0.0",
"stylelint-config-standard": "^41.0.0",
"tailwindcss": "^4.3.4",
"tailwindcss-primeui": "^0.6.1",
"tar": "^7.5.22",
"typescript": "^7.0.2",
Expand Down
46 changes: 44 additions & 2 deletions src/main/MainMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ let enabledMenu: electron.Menu | null = null;
let disabledMenu: electron.Menu | null = null;
let recentFilePaths: string[] = [];
let hasFiles = false;
let canSave = false;
let canSaveAs = false;
let menuEnabled = false;
// Note: our main menu is disabled until our renderer enables it (see MainWindow's constructor).

Expand Down Expand Up @@ -125,7 +127,11 @@ export const enableDisableMainMenu = (enable: boolean): void => {
label: 'Most Recent',
accelerator: 'CmdOrCtrl+Shift+T',
click: () => {
mainWindow?.send('open', recentFilePaths[0]);
const filePath = recentFilePaths[0];

if (filePath) {
mainWindow?.openFile(filePath);
}
},
enabled: recentFilePaths.length > 0
});
Expand All @@ -137,7 +143,7 @@ export const enableDisableMainMenu = (enable: boolean): void => {
fileReopenSubMenu.push({
label: filePath,
click: () => {
mainWindow?.send('open', filePath);
mainWindow?.openFile(filePath);
}
});
});
Expand All @@ -159,6 +165,25 @@ export const enableDisableMainMenu = (enable: boolean): void => {
submenu: fileReopenSubMenu
});
fileSubMenu.push({ type: 'separator' });
fileSubMenu.push({
id: 'fileSave',
label: 'Save',
accelerator: 'CmdOrCtrl+S',
click: () => {
mainWindow?.send('save');
},
enabled: canSave
});
fileSubMenu.push({
id: 'fileSaveAs',
label: 'Save As...',
accelerator: 'CmdOrCtrl+Shift+S',
click: () => {
mainWindow?.send('save-as');
},
enabled: canSaveAs
});
fileSubMenu.push({ type: 'separator' });
fileSubMenu.push({
id: 'fileClose',
label: 'Close',
Expand Down Expand Up @@ -322,6 +347,23 @@ export const enableDisableFileCloseAndCloseAllMenuItems = (enable: boolean): voi
}
};

export const enableDisableFileSaveAndSaveAsMenuItems = (enableSave: boolean, enableSaveAs: boolean): void => {
// Note: same as for enableDisableFileCloseAndCloseAllMenuItems().

canSave = enableSave;
canSaveAs = enableSaveAs;

if (enabledMenu) {
const fileSaveMenu = enabledMenu.getMenuItemById('fileSave');
const fileSaveAsMenu = enabledMenu.getMenuItemById('fileSaveAs');

if (fileSaveMenu && fileSaveAsMenu) {
fileSaveMenu.enabled = canSave;
fileSaveAsMenu.enabled = canSaveAs;
}
}
};

export const updateReopenMenu = (filePaths: string[]): void => {
// Invalidate our enabled menu so that it gets rebuilt with our new Reopen menu, but only rebuild (and set) it now if
// our menu is enabled. Indeed, our menu may be disabled (e.g., because a dialog is open in our renderer), in which
Expand Down
Loading
Loading