| 2094 | } | 2094 | } |
| 2095 | | 2095 | |
| 2096 | entities.sort((a, b) => { | 2096 | entities.sort((a, b) => { |
| 2097 | // Sort tags/folders will always be at the top | 2097 | // Sort tags/folders will always be at the top. Their original sorting will be kept, to respect manual tag sorting. |
| 2098 | if (a.type === 'tag' && b.type !== 'tag') { | 2098 | if (a.type === 'tag' || b.type === 'tag') { |
| 2099 | return -1; | 2099 | // The one that is a tag will be at the top |
| 2100 | } | 2100 | return (a.type === 'tag' ? -1 : 1) - (b.type === 'tag' ? -1 : 1); |
| 2101 | if (a.type !== 'tag' && b.type === 'tag') { | | |
| 2102 | return 1; | | |
| 2103 | } | 2101 | } |
| 2104 | | 2102 | |
| 2105 | // If we have search sorting, we take scores and use those | 2103 | // If we have search sorting, we take scores and use those |