fix: allowed dialog file types with one filter (#46900)

This commit is contained in:
Shelley Vohr
2025-05-06 10:31:00 +02:00
committed by GitHub
parent be399f2fee
commit a5ec3f7476

View File

@@ -131,10 +131,6 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) {
[file_types_list addObject:content_types_set];
}
// Don't add file format picker.
if ([file_types_list count] <= 1)
return;
NSArray* content_types = [file_types_list objectAtIndex:0];
__block BOOL allowAllFiles = NO;
@@ -148,6 +144,10 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) {
[dialog setAllowedContentTypes:allowAllFiles ? @[] : content_types];
// Don't add file format picker.
if ([file_types_list count] <= 1)
return;
// Add file format picker.
ElectronAccessoryView* accessoryView = [[ElectronAccessoryView alloc]
initWithFrame:NSMakeRect(0.0, 0.0, 200, 32.0)];