mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🎨 API listDocsByPath add an optional parameter maxListCount Fix https://github.com/siyuan-note/siyuan/issues/7993
This commit is contained in:
parent
0b0712f741
commit
ee3138be64
4 changed files with 17 additions and 13 deletions
|
|
@ -95,7 +95,7 @@ func heading2Doc(c *gin.Context) {
|
|||
|
||||
name := path.Base(targetPath)
|
||||
box := model.Conf.Box(targetNotebook)
|
||||
files, _, _ := model.ListDocTree(targetNotebook, path.Dir(targetPath), model.Conf.FileTree.Sort, false)
|
||||
files, _, _ := model.ListDocTree(targetNotebook, path.Dir(targetPath), model.Conf.FileTree.Sort, false, model.Conf.FileTree.MaxListCount)
|
||||
evt := util.NewCmdResult("heading2doc", 0, util.PushModeBroadcast)
|
||||
evt.Data = map[string]interface{}{
|
||||
"box": box,
|
||||
|
|
@ -140,7 +140,7 @@ func li2Doc(c *gin.Context) {
|
|||
|
||||
name := path.Base(targetPath)
|
||||
box := model.Conf.Box(targetNotebook)
|
||||
files, _, _ := model.ListDocTree(targetNotebook, path.Dir(targetPath), model.Conf.FileTree.Sort, false)
|
||||
files, _, _ := model.ListDocTree(targetNotebook, path.Dir(targetPath), model.Conf.FileTree.Sort, false, model.Conf.FileTree.MaxListCount)
|
||||
evt := util.NewCmdResult("li2doc", 0, util.PushModeBroadcast)
|
||||
evt.Data = map[string]interface{}{
|
||||
"box": box,
|
||||
|
|
@ -448,7 +448,7 @@ func createDailyNote(c *gin.Context) {
|
|||
evt.AppId = app
|
||||
|
||||
name := path.Base(p)
|
||||
files, _, _ := model.ListDocTree(box.ID, path.Dir(p), model.Conf.FileTree.Sort, false)
|
||||
files, _, _ := model.ListDocTree(box.ID, path.Dir(p), model.Conf.FileTree.Sort, false, model.Conf.FileTree.MaxListCount)
|
||||
evt.Data = map[string]interface{}{
|
||||
"box": box,
|
||||
"path": p,
|
||||
|
|
@ -619,14 +619,18 @@ func listDocsByPath(c *gin.Context) {
|
|||
if arg["flashcard"] != nil {
|
||||
flashcard = arg["flashcard"].(bool)
|
||||
}
|
||||
maxListCount := model.Conf.FileTree.MaxListCount
|
||||
if arg["maxListCount"] != nil {
|
||||
maxListCount = int(arg["maxListCount"].(float64))
|
||||
}
|
||||
|
||||
files, totals, err := model.ListDocTree(notebook, p, sortMode, flashcard)
|
||||
files, totals, err := model.ListDocTree(notebook, p, sortMode, flashcard, maxListCount)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
if model.Conf.FileTree.MaxListCount < totals {
|
||||
if maxListCount < totals {
|
||||
util.PushMsg(fmt.Sprintf(model.Conf.Language(48), len(files)), 7000)
|
||||
}
|
||||
|
||||
|
|
@ -718,7 +722,7 @@ func getDoc(c *gin.Context) {
|
|||
func pushCreate(box *model.Box, p, treeID string, arg map[string]interface{}) {
|
||||
evt := util.NewCmdResult("create", 0, util.PushModeBroadcast)
|
||||
name := path.Base(p)
|
||||
files, _, _ := model.ListDocTree(box.ID, path.Dir(p), model.Conf.FileTree.Sort, false)
|
||||
files, _, _ := model.ListDocTree(box.ID, path.Dir(p), model.Conf.FileTree.Sort, false, model.Conf.FileTree.MaxListCount)
|
||||
evt.Data = map[string]interface{}{
|
||||
"box": box,
|
||||
"path": p,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue