mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 15: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
19f0834766
commit
e5f3fc5e51
1 changed files with 16 additions and 2 deletions
|
|
@ -252,6 +252,16 @@ func Outline(rootID string, preview bool) (ret []*Path, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil != storage["expandIds"] {
|
if nil != storage["expandIds"] {
|
||||||
|
// 先全部折叠,后面再根据展开 ID 列表展开对应标题
|
||||||
|
for _, p := range ret {
|
||||||
|
for _, b := range p.Blocks {
|
||||||
|
b.Folded = false
|
||||||
|
for _, c := range b.Children {
|
||||||
|
walkChildren(c, []string{"expandNone"})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
expandIDsArg := storage["expandIds"].([]interface{})
|
expandIDsArg := storage["expandIds"].([]interface{})
|
||||||
var expandIDs []string
|
var expandIDs []string
|
||||||
for _, id := range expandIDsArg {
|
for _, id := range expandIDsArg {
|
||||||
|
|
@ -271,8 +281,12 @@ func Outline(rootID string, preview bool) (ret []*Path, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func walkChildren(b *Block, expandIDs []string) {
|
func walkChildren(b *Block, expandIDs []string) {
|
||||||
if 1 == len(expandIDs) && "expandAll" == expandIDs[0] {
|
if 1 == len(expandIDs) {
|
||||||
|
if "expandAll" == expandIDs[0] {
|
||||||
b.Folded = false
|
b.Folded = false
|
||||||
|
} else if "expandNone" == expandIDs[0] {
|
||||||
|
b.Folded = true
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
b.Folded = !gulu.Str.Contains(b.ID, expandIDs)
|
b.Folded = !gulu.Str.Contains(b.ID, expandIDs)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue