From: Cheng Zhao Date: Tue, 7 Jul 2015 10:45:43 +0000 (+0800) Subject: On OS X the "Cancel" is always get selected when dialog is cancelled X-Git-Tag: v0.30.0~49^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=df4b5f4ede3b6aa1d092bfe21216bb3309a5d513;p=electron.git On OS X the "Cancel" is always get selected when dialog is cancelled --- diff --git a/atom/browser/api/lib/dialog.coffee b/atom/browser/api/lib/dialog.coffee index 3dbd80a2..6ee334e2 100644 --- a/atom/browser/api/lib/dialog.coffee +++ b/atom/browser/api/lib/dialog.coffee @@ -93,6 +93,7 @@ module.exports = options.detail ?= '' options.icon ?= null + # Choose a default button to get selected when dialog is cancelled. unless options.cancelId? options.cancelId = 0 for text, i in options.buttons @@ -100,6 +101,12 @@ module.exports = options.cancelId = i break + # On OS X the "Cancel" is always get selected when dialog is cancelled. + if process.platform is 'darwin' + for text, i in options.buttons when text is 'Cancel' + options.cancelId = i + break + binding.showMessageBox messageBoxType, options.buttons, options.cancelId,