Skip to content
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

Rearrange the buttons on the message box for unsaved files #3388

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/menu/actions/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,23 +161,23 @@ const handleResponseForSave = async (e, { id, filename, markdown, pathname, opti
const showUnsavedFilesMessage = async (win, files) => {
const { response } = await dialog.showMessageBox(win, {
type: 'warning',
buttons: ['Save', 'Cancel', 'Don\'t save'],
buttons: ['Save', 'Don\'t save', 'Cancel'],
defaultId: 0,
message: `Do you want to save the changes you made to ${files.length} ${files.length === 1 ? 'file' : 'files'}?\n\n${files.map(f => f.filename).join('\n')}`,
detail: 'Your changes will be lost if you don\'t save them.',
cancelId: 1,
cancelId: 2,
noLink: true
})

switch (response) {
case 2:
return { needSave: false }
case 0:
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({ needSave: true })
})
})
case 1:
return { needSave: false }
default:
return null
}
Expand Down