mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 https://github.com/siyuan-note/siyuan/issues/16233 https://github.com/siyuan-note/siyuan/issues/16121
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
74faaa50d4
commit
15fc11e600
1 changed files with 14 additions and 6 deletions
|
|
@ -239,10 +239,15 @@ func Outline(rootID string, preview bool) (ret []*Path, err error) {
|
|||
ret = outline(tree)
|
||||
|
||||
storage, _ := GetOutlineStorage(rootID)
|
||||
if nil == storage {
|
||||
// 默认展开顶层
|
||||
if nil == storage || 0 == len(storage) {
|
||||
// 默认全部展开
|
||||
for _, p := range ret {
|
||||
p.Folded = false
|
||||
for _, b := range p.Blocks {
|
||||
b.Folded = false
|
||||
for _, c := range b.Children {
|
||||
walkChildren(c, []string{"expandAll"})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -254,8 +259,6 @@ func Outline(rootID string, preview bool) (ret []*Path, err error) {
|
|||
}
|
||||
|
||||
for _, p := range ret {
|
||||
p.Folded = false // 顶层默认展开
|
||||
|
||||
for _, b := range p.Blocks {
|
||||
b.Folded = !gulu.Str.Contains(b.ID, expandIDs)
|
||||
for _, c := range b.Children {
|
||||
|
|
@ -268,7 +271,12 @@ func Outline(rootID string, preview bool) (ret []*Path, err error) {
|
|||
}
|
||||
|
||||
func walkChildren(b *Block, expandIDs []string) {
|
||||
b.Folded = !gulu.Str.Contains(b.ID, expandIDs)
|
||||
if 1 == len(expandIDs) && "expandAll" == expandIDs[0] {
|
||||
b.Folded = false
|
||||
} else {
|
||||
b.Folded = !gulu.Str.Contains(b.ID, expandIDs)
|
||||
}
|
||||
|
||||
for _, c := range b.Children {
|
||||
walkChildren(c, expandIDs)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue