mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 Improve notebook sorting https://github.com/siyuan-note/siyuan/issues/13598
This commit is contained in:
parent
5b3fa67332
commit
b12906321f
1 changed files with 2 additions and 6 deletions
|
|
@ -154,8 +154,6 @@ func ListNotebooks() (ret []*Box, err error) {
|
||||||
sort.Slice(ret, func(i, j int) bool {
|
sort.Slice(ret, func(i, j int) bool {
|
||||||
return util.PinYinCompare(ret[j].Name, ret[i].Name)
|
return util.PinYinCompare(ret[j].Name, ret[i].Name)
|
||||||
})
|
})
|
||||||
case util.SortModeUpdatedASC:
|
|
||||||
case util.SortModeUpdatedDESC:
|
|
||||||
case util.SortModeAlphanumASC:
|
case util.SortModeAlphanumASC:
|
||||||
sort.Slice(ret, func(i, j int) bool {
|
sort.Slice(ret, func(i, j int) bool {
|
||||||
return util.NaturalCompare(ret[i].Name, ret[j].Name)
|
return util.NaturalCompare(ret[i].Name, ret[j].Name)
|
||||||
|
|
@ -166,12 +164,10 @@ func ListNotebooks() (ret []*Box, err error) {
|
||||||
})
|
})
|
||||||
case util.SortModeCustom:
|
case util.SortModeCustom:
|
||||||
sort.Slice(ret, func(i, j int) bool { return ret[i].Sort < ret[j].Sort })
|
sort.Slice(ret, func(i, j int) bool { return ret[i].Sort < ret[j].Sort })
|
||||||
case util.SortModeRefCountASC:
|
|
||||||
case util.SortModeRefCountDESC:
|
|
||||||
case util.SortModeCreatedASC:
|
case util.SortModeCreatedASC:
|
||||||
sort.Slice(ret, func(i, j int) bool { return util.NaturalCompare(ret[j].ID, ret[i].ID) })
|
sort.Slice(ret, func(i, j int) bool { return ret[i].ID < ret[j].ID })
|
||||||
case util.SortModeCreatedDESC:
|
case util.SortModeCreatedDESC:
|
||||||
sort.Slice(ret, func(i, j int) bool { return util.NaturalCompare(ret[j].ID, ret[i].ID) })
|
sort.Slice(ret, func(i, j int) bool { return ret[i].ID > ret[j].ID })
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue