Enable taking window as parameter in dialog.showOpenDialog.
This commit is contained in:
parent
a4262bc39d
commit
76ac8f2719
2 changed files with 21 additions and 3 deletions
|
@ -7,7 +7,13 @@ fileDialogProperties =
|
|||
messageBoxTypes = ['none', 'info', 'warning']
|
||||
|
||||
module.exports =
|
||||
showOpenDialog: (options) ->
|
||||
showOpenDialog: (window, options, callback) ->
|
||||
if window? and window.constructor isnt BrowserWindow
|
||||
# Shift.
|
||||
callback = options
|
||||
options = window
|
||||
window = null
|
||||
|
||||
options = title: 'Open', properties: ['openFile'] unless options?
|
||||
options.properties = options.properties ? ['openFile']
|
||||
throw new TypeError('Properties need to be array') unless Array.isArray options.properties
|
||||
|
@ -19,7 +25,10 @@ module.exports =
|
|||
options.title = options.title ? ''
|
||||
options.defaultPath = options.defaultPath ? ''
|
||||
|
||||
binding.showOpenDialog options.title, options.defaultPath, properties
|
||||
binding.showOpenDialog options.title,
|
||||
options.defaultPath,
|
||||
properties,
|
||||
window
|
||||
|
||||
showSaveDialog: (window, options) ->
|
||||
throw new TypeError('Invalid window') unless window?.constructor is BrowserWindow
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue