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

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot] 2025-05-06 16:12:09 +02:00 committed by GitHub
parent 7240a14126
commit 13fe994d0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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)];