mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Set default extension for save dialog file filter
The code update sets the default extension to the first pattern in the save dialog file filter when options.Filters is populated. This improvement applies to Windows platform interface function for 'Save File Dialog' and provides a more intuitive user experience.
This commit is contained in:
@@ -168,6 +168,11 @@ func (m *windowSaveFileDialog) show() (chan string, error) {
|
||||
Folder: defaultFolder,
|
||||
}
|
||||
|
||||
// Original PR for v2 by @almas1992: https://github.com/wailsapp/wails/pull/3205
|
||||
if len(options.Filters) > 0 {
|
||||
config.DefaultExtension = strings.TrimPrefix(strings.Split(options.Filters[0].Pattern, ";")[0], "*")
|
||||
}
|
||||
|
||||
result, err := showCfdDialog(
|
||||
func() (cfd.Dialog, error) {
|
||||
return cfd.NewSaveFileDialog(config)
|
||||
|
||||
Reference in New Issue
Block a user