From 4fa003f47ee04e7604f108731dc5fed99b3d0641 Mon Sep 17 00:00:00 2001 From: sunhao Date: Wed, 18 Jun 2025 14:49:04 +0800 Subject: [PATCH] * [bug #57792] fix doc sorting UI. --- lib/zin/wg/docapp/js/v1.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/zin/wg/docapp/js/v1.js b/lib/zin/wg/docapp/js/v1.js index d881a72ce0..0e9e4da5d2 100644 --- a/lib/zin/wg/docapp/js/v1.js +++ b/lib/zin/wg/docapp/js/v1.js @@ -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); } }