mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 19:41:39 +08:00
Rearrange the buttons on the message box for unsaved files
This commit is contained in:
parent
aed36dbf32
commit
b0dd7cc8f8
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user