mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
🍎 Add additional options for Mac's open dialog
Support an additional attributes available in macOS's NSOpenPanel: message.
This commit is contained in:
@@ -81,7 +81,8 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
|
||||
let {buttonLabel, defaultPath, filters, properties, title} = options
|
||||
let {buttonLabel, defaultPath, filters, properties, title,
|
||||
message} = options
|
||||
|
||||
if (properties == null) {
|
||||
properties = ['openFile']
|
||||
@@ -118,11 +119,18 @@ module.exports = {
|
||||
filters = []
|
||||
}
|
||||
|
||||
if (message == null) {
|
||||
message = ''
|
||||
} else if (typeof message !== 'string') {
|
||||
throw new TypeError('Message must be a string')
|
||||
}
|
||||
|
||||
const wrappedCallback = typeof callback === 'function' ? function (success, result) {
|
||||
return callback(success ? result : void 0)
|
||||
} : null
|
||||
return binding.showOpenDialog(title, buttonLabel, defaultPath, filters,
|
||||
dialogProperties, window, wrappedCallback)
|
||||
dialogProperties, message, window,
|
||||
wrappedCallback)
|
||||
},
|
||||
|
||||
showSaveDialog: function (...args) {
|
||||
|
||||
Reference in New Issue
Block a user