mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-21 11:29:29 +08: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:
parent
861ddea1b2
commit
dff47263d5
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user