mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 支持笔记本设置独立的排序规则 https://github.com/siyuan-note/siyuan/issues/3623
This commit is contained in:
parent
4103b380ab
commit
72a8132775
3 changed files with 10 additions and 0 deletions
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
package conf
|
package conf
|
||||||
|
|
||||||
|
import "github.com/siyuan-note/siyuan/kernel/util"
|
||||||
|
|
||||||
// BoxConf 维护 .siyuan/conf.json 笔记本配置。
|
// BoxConf 维护 .siyuan/conf.json 笔记本配置。
|
||||||
type BoxConf struct {
|
type BoxConf struct {
|
||||||
Name string `json:"name"` // 笔记本名称
|
Name string `json:"name"` // 笔记本名称
|
||||||
|
|
@ -26,6 +28,7 @@ type BoxConf struct {
|
||||||
DocCreateSavePath string `json:"docCreateSavePath"` // 新建文档存储路径
|
DocCreateSavePath string `json:"docCreateSavePath"` // 新建文档存储路径
|
||||||
DailyNoteSavePath string `json:"dailyNoteSavePath"` // 新建日记存储路径
|
DailyNoteSavePath string `json:"dailyNoteSavePath"` // 新建日记存储路径
|
||||||
DailyNoteTemplatePath string `json:"dailyNoteTemplatePath"` // 新建日记使用的模板路径
|
DailyNoteTemplatePath string `json:"dailyNoteTemplatePath"` // 新建日记使用的模板路径
|
||||||
|
SortMode int `json:"sortMode"` // 排序方式
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBoxConf() *BoxConf {
|
func NewBoxConf() *BoxConf {
|
||||||
|
|
@ -34,5 +37,6 @@ func NewBoxConf() *BoxConf {
|
||||||
Closed: true,
|
Closed: true,
|
||||||
DailyNoteSavePath: "/daily note/{{now | date \"2006/01\"}}/{{now | date \"2006-01-02\"}}",
|
DailyNoteSavePath: "/daily note/{{now | date \"2006/01\"}}/{{now | date \"2006-01-02\"}}",
|
||||||
DailyNoteTemplatePath: "",
|
DailyNoteTemplatePath: "",
|
||||||
|
SortMode: util.SortModeFileTree,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -233,6 +233,11 @@ func ListDocTree(boxID, path string, sortMode int) (ret []*File, totals int, err
|
||||||
return nil, 0, errors.New(Conf.Language(0))
|
return nil, 0, errors.New(Conf.Language(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boxConf := box.GetConf()
|
||||||
|
if util.SortModeFileTree != boxConf.SortMode {
|
||||||
|
sortMode = boxConf.SortMode
|
||||||
|
}
|
||||||
|
|
||||||
var files []*FileInfo
|
var files []*FileInfo
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
files, totals, err = box.Ls(path)
|
files, totals, err = box.Ls(path)
|
||||||
|
|
|
||||||
|
|
@ -68,4 +68,5 @@ const (
|
||||||
SortModeSizeDESC // 12:文件大小降序
|
SortModeSizeDESC // 12:文件大小降序
|
||||||
SortModeSubDocCountASC // 13:子文档数升序
|
SortModeSubDocCountASC // 13:子文档数升序
|
||||||
SortModeSubDocCountDESC // 14:子文档数降序
|
SortModeSubDocCountDESC // 14:子文档数降序
|
||||||
|
SortModeFileTree // 15:使用文档树排序规则
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue