Pull request that gives items more control over the save process


I’m working on a pull request to give items more control over the save process, by allowing them to specify the save dialogue options. Does this seem like a reasonable approach?


What does it look like in practice?


The pane item (i.e. TextEditor or some other custom pane item created by an opener) has the option to implement getSaveOptions with returns options that will be used to show the save panel. For example:

getSaveOptions: ->
  {} =
    filters: [
      name: 'Outlines'
      extensions: [ 'opml', 'ftml' ]


I would recommend documenting the options that are supported.


The options are the same as electron dialog.showsavedialog.

I can document more in the code but I’m unsure right now. I don’t know if it makes sense to make this a public API at this point. Implementing your own pane item already means following lots of undocumented convention… I was thinking this would be a small internal change to how things work that would allow easier control of the save panel using a bit more undocumented convention.

I think eventually the way to document it would be to add a public documented textEditor.getSaveOptions method. Does that seem reasonable?

Also here’s a related request and use case for this request, i.e. it would likely be useful outside of my particular use case:


Even if it isn’t a public API, it can still be documented. Just use the Private: or Experimental: tag at the beginning of the documentation block. Documenting it separately from dialog.showsavedialog would show what you’ve tested (hopefully) and verified works as intended.


Thanks, I’ve documented it by adding a private method comment in TextEditor that describes how it will be used.