mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 07:48:49 +01:00
🐛 删除父文档时子文档排序配置未清理干净 Fix https://github.com/siyuan-note/siyuan/issues/6469
This commit is contained in:
parent
0b1e48c24a
commit
21e354836e
2 changed files with 27 additions and 26 deletions
|
|
@ -19,7 +19,9 @@ package treenode
|
|||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
|
|
@ -108,3 +110,26 @@ func IALStr(n *ast.Node) string {
|
|||
}
|
||||
return string(parse.IAL2Tokens(n.KramdownIAL))
|
||||
}
|
||||
|
||||
func RootChildIDs(rootID string) (ret []string) {
|
||||
root := GetBlockTree(rootID)
|
||||
if nil == root {
|
||||
return
|
||||
}
|
||||
|
||||
ret = append(ret, rootID)
|
||||
boxLocalPath := filepath.Join(util.DataDir, root.BoxID)
|
||||
subFolder := filepath.Join(boxLocalPath, strings.TrimSuffix(root.Path, ".sy"))
|
||||
if !gulu.File.IsDir(subFolder) {
|
||||
return
|
||||
}
|
||||
filepath.Walk(subFolder, func(path string, info fs.FileInfo, err error) error {
|
||||
if strings.HasSuffix(path, ".sy") {
|
||||
name := filepath.Base(path)
|
||||
id := strings.TrimSuffix(name, ".sy")
|
||||
ret = append(ret, id)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue