mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Improve document tree custom sorting stability when creating a notebook or doc https://github.com/siyuan-note/siyuan/issues/15716
This commit is contained in:
parent
c17a09d37e
commit
6c1156afc8
2 changed files with 12 additions and 1 deletions
|
|
@ -1024,7 +1024,11 @@ func CreateDocByMd(boxID, p, title, md string, sorts []string) (tree *parse.Tree
|
|||
}
|
||||
|
||||
FlushTxQueue()
|
||||
ChangeFileTreeSort(box.ID, sorts)
|
||||
if 0 < len(sorts) {
|
||||
ChangeFileTreeSort(box.ID, sorts)
|
||||
} else {
|
||||
box.addMinSort(path.Dir(tree.Path), tree.ID)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,13 @@ func CreateBox(name string) (id string, err error) {
|
|||
createDocLock.Lock()
|
||||
defer createDocLock.Unlock()
|
||||
|
||||
boxes, _ := ListNotebooks()
|
||||
for i, b := range boxes {
|
||||
c := b.GetConf()
|
||||
c.Sort = i + 1
|
||||
b.SaveConf(c)
|
||||
}
|
||||
|
||||
id = ast.NewNodeID()
|
||||
boxLocalPath := filepath.Join(util.DataDir, id)
|
||||
err = os.MkdirAll(boxLocalPath, 0755)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue