* [bug #57792] fix doc sorting UI.

This commit is contained in:
sunhao
2025-06-18 14:50:34 +08:00
parent 300c5c70f1
commit 4fa003f47e
+8 -1
View File
@@ -2007,7 +2007,7 @@ function isMatchFilter(type, filterType, item)
*/
function formatOrders(orders, useIndex)
{
const orderedKeys = useIndex ? [] : Array.from(orders).sort();
const orderedKeys = useIndex ? [] : Array.from(orders).sort((a, b) => a - b);
return orders.reduce((map, key, index) =>
{
map[key] = useIndex ? index : orderedKeys[index];
@@ -2078,6 +2078,13 @@ function getSortableOptions(type)
if(fromType !== 'doc') key = key.substring(1);
orderedList.push(+key);
});
if(fromType === 'doc')
{
const docApp = getDocApp();
const doc = docApp.getDoc(orderedList[0]);
const lib = doc ? docApp.getLib(doc.lib) : null;
if(lib && typeof lib.data.orderBy === 'string' && lib.data.orderBy.endsWith('desc')) orderedList.reverse();
}
sortItems(fromType, orderedList);
}
}