-
Notifications
You must be signed in to change notification settings - Fork 0
v0.4.2 pre-release #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c212493
009761c
84b5b2f
3aec2d4
682d311
e8aa274
d96e19b
f2cfd62
459113b
368b29f
5d0f09d
f224c8b
65a7a71
61caace
3719e31
6c499ed
660b488
941b045
0afe1cb
1bc3494
ceb3418
ef8547e
9db6fb6
fdbdc97
3993905
9404bc1
e34c2d1
6476416
56f2dfb
5ceaacd
c224e98
a991fd8
5fafcde
89e7a8f
2a6339d
f44c405
1151bb3
5cfae2d
5e1bb2f
9faf49b
24c6d71
125d3dd
b651e8a
e7dbbb8
3fbda19
e313c65
c5d5aed
8fca62c
e50d6af
c5f8ec5
d03a354
6653588
a248ba4
47de8bf
76f5c8b
f6b2509
3e484c0
a53d969
16783fe
a6683f3
6658efa
f034ef4
34faa1c
d6ccfd2
6f46280
bc07bda
78bfb2a
def7072
0f2ce1c
982275f
6a4fba2
9a0546f
d97ae3b
56b55d4
164187d
e50810d
49a77a9
47a4c35
2da2f3d
2276a1a
92a0cea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ name: Build | |
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - develop | ||
| types: | ||
| - opened | ||
| - synchronize | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ name: Test | |
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - develop | ||
| types: | ||
| - opened | ||
| - synchronize | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -931,6 +931,16 @@ function createApplicationMenu() { | |
| } | ||
| }, | ||
| }, | ||
| { | ||
| label: 'Copy Plan', | ||
| accelerator: isMac ? 'Cmd+Shift+C' : 'Ctrl+Shift+C', | ||
| click: () => { | ||
| const focusedWindow = BrowserWindow.getFocusedWindow(); | ||
| if (focusedWindow) { | ||
| sendMenuEvent(focusedWindow, MENU_EVENTS.copyPlan); | ||
| } | ||
| }, | ||
| }, | ||
| { type: 'separator' }, | ||
| { | ||
| label: 'Close Window', | ||
|
|
@@ -998,7 +1008,7 @@ function createApplicationMenu() { | |
| }, | ||
| }, | ||
| { | ||
| label: 'Pay Options', | ||
| label: 'Pay Details', | ||
| accelerator: isMac ? 'Cmd+Shift+P' : 'Ctrl+Shift+P', | ||
| click: () => { | ||
| const focusedWindow = BrowserWindow.getFocusedWindow(); | ||
|
|
@@ -1202,7 +1212,7 @@ function createApplicationMenu() { | |
| } | ||
|
|
||
| /** | ||
| * Handle closing a window with unsaved changes check | ||
| * Handle closing a window by attempting save-first behavior when unsaved changes exist. | ||
| */ | ||
| async function handleCloseWindow(window: BrowserWindow) { | ||
| try { | ||
|
|
@@ -1211,23 +1221,21 @@ async function handleCloseWindow(window: BrowserWindow) { | |
| ); | ||
|
|
||
| if (hasUnsaved) { | ||
| const result = await dialog.showMessageBox(window, { | ||
| type: 'warning', | ||
| // Show "Do you want to save?" dialog for unsaved plans | ||
| const response = dialog.showMessageBoxSync(window, { | ||
| type: 'question', | ||
| buttons: ['Save', "Don't Save", 'Cancel'], | ||
| defaultId: 0, | ||
| cancelId: 2, | ||
| title: 'Unsaved Changes', | ||
| message: 'You have unsaved changes', | ||
| detail: 'Do you want to save your plan before closing this window?', | ||
| title: 'Save Plan?', | ||
| message: 'This plan has unsaved changes. Do you want to save before closing?', | ||
| }); | ||
|
Comment on lines
1221
to
1232
|
||
|
|
||
| if (result.response === 2) { | ||
| // Cancel | ||
| if (response === 2) { | ||
| // User clicked Cancel, don't close | ||
| return; | ||
| } | ||
|
|
||
| if (result.response === 0) { | ||
| // Save | ||
| } else if (response === 0) { | ||
| // User clicked Save, attempt to save | ||
| const saveSuccess = await window.webContents.executeJavaScript( | ||
| `(async () => { | ||
| if (typeof window.__requestSaveBeforeClose === 'function') { | ||
|
|
@@ -1242,10 +1250,14 @@ async function handleCloseWindow(window: BrowserWindow) { | |
| ); | ||
|
|
||
| if (!saveSuccess) { | ||
| // Save failed or user canceled save dialog | ||
| dialog.showErrorBox( | ||
| 'Save Failed', | ||
| 'Could not save this plan. Please use File > Save (or Cmd/Ctrl+S) and try again.' | ||
| ); | ||
| return; | ||
| } | ||
| } | ||
| // If response === 1, user clicked "Don't Save" - proceed to close without saving | ||
| } | ||
|
|
||
| // Always save window state (size and active tab) even if content wasn't saved | ||
|
|
@@ -1273,6 +1285,7 @@ async function handleCloseWindow(window: BrowserWindow) { | |
| console.error('Error checking unsaved changes:', error); | ||
| dialog.showErrorBox('Close Error', 'Unable to verify save state. The window was not closed to prevent data loss.'); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| // Save all window states before quitting | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,10 @@ | |||||
| <meta charset="UTF-8" /> | ||||||
| <link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||||||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||||||
| <meta | ||||||
| http-equiv="Content-Security-Policy" | ||||||
| content="default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' http://localhost:* ws://localhost:* https://* wss://*; object-src 'none'; base-uri 'self'" | ||||||
|
||||||
| content="default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' http://localhost:* ws://localhost:* https://* wss://*; object-src 'none'; base-uri 'self'" | |
| content="default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' http://localhost:* ws://localhost:*; object-src 'none'; base-uri 'self'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dialog.showMessageBoxSyncblocks the Electron main process event loop while the dialog is open. Since this runs on window close, it can still freeze other windows/menus and makes shutdown behavior less responsive. Prefer using the asyncdialog.showMessageBox(...)API and awaiting it (as before) to avoid blocking the main process thread.