feat: SOME sorting

This commit is contained in:
not-nullptr 2025-04-14 23:30:31 +01:00
parent 2191c95500
commit ea53fc7b9b
1 changed files with 11 additions and 2 deletions

View File

@ -231,12 +231,21 @@
c.supportedFormats.find( c.supportedFormats.find(
(f) => f.name === file.from, (f) => f.name === file.from,
)?.isNative )?.isNative
? c.formatStrings((f) => f.toSupported) ? c.supportedFormats.filter(
: c.formatStrings( (f) => f.toSupported,
)
: c.supportedFormats.filter(
(f) => (f) =>
f.toSupported && f.isNative, f.toSupported && f.isNative,
), ),
) )
.sort((a, b) => {
// sort native formats first
if (a.isNative && !b.isNative) return -1;
if (!a.isNative && b.isNative) return 1;
return 0;
})
.map((f) => f.name)
.filter( .filter(
(format) => (format) =>
format !== ".svg" && format !== ".heif", format !== ".svg" && format !== ".heif",