From 50793ad855a166395ca57d4d992406e5d0b14bed Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 11 Dec 2024 21:53:25 +0800 Subject: [PATCH] :art: Remove the collapsed state of the collapsed heading on paste https://github.com/siyuan-note/siyuan/issues/13232 --- kernel/model/block.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kernel/model/block.go b/kernel/model/block.go index bf0bd7a20..671ccf9be 100644 --- a/kernel/model/block.go +++ b/kernel/model/block.go @@ -547,6 +547,22 @@ func GetHeadingChildrenDOM(id string) (ret string) { nodes := append([]*ast.Node{}, heading) children := treenode.HeadingChildren(heading) nodes = append(nodes, children...) + + // 取消折叠 https://github.com/siyuan-note/siyuan/issues/13232#issuecomment-2535955152 + for _, child := range children { + ast.Walk(child, func(n *ast.Node, entering bool) ast.WalkStatus { + if !entering { + return ast.WalkContinue + } + + n.RemoveIALAttr("heading-fold") + n.RemoveIALAttr("fold") + return ast.WalkContinue + }) + } + heading.RemoveIALAttr("fold") + heading.RemoveIALAttr("heading-fold") + luteEngine := util.NewLute() ret = renderBlockDOMByNodes(nodes, luteEngine) return