mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-26 11:28:49 +01:00
This commit is contained in:
parent
45f10bf62a
commit
eca87831fe
10 changed files with 99 additions and 190 deletions
|
|
@ -619,16 +619,16 @@ func filterByQuery(query string, collection av.Collection) {
|
|||
}
|
||||
|
||||
// manualSort 处理用户手动排序。
|
||||
func manualSort(collectionLayout av.CollectionLayout, collection av.Collection) {
|
||||
sortRowIDs := map[string]int{}
|
||||
for i, itemID := range collectionLayout.GetItemIDs() {
|
||||
sortRowIDs[itemID] = i
|
||||
func manualSort(view *av.View, collection av.Collection) {
|
||||
sortItemIDs := map[string]int{}
|
||||
for i, itemID := range view.ItemIDs {
|
||||
sortItemIDs[itemID] = i
|
||||
}
|
||||
|
||||
items := collection.GetItems()
|
||||
sort.Slice(items, func(i, j int) bool {
|
||||
iv := sortRowIDs[items[i].GetID()]
|
||||
jv := sortRowIDs[items[j].GetID()]
|
||||
iv := sortItemIDs[items[i].GetID()]
|
||||
jv := sortItemIDs[items[j].GetID()]
|
||||
if iv == jv {
|
||||
return items[i].GetID() < items[j].GetID()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue