From c148659fd1376485afc3991c2866ac4b07ab3589 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 7 Apr 2024 17:24:30 +0800 Subject: [PATCH 1/2] :art: Update user guide --- .../20240317202444-5txwumu.sy | 22 +++++-------------- .../20240317200013-fim8wm8.sy | 22 +++++-------------- .../20240317202230-l8duv3r.sy | 22 +++++-------------- 3 files changed, 18 insertions(+), 48 deletions(-) diff --git a/app/guide/20210808180117-6v0mkxr/20240317202444-5txwumu.sy b/app/guide/20210808180117-6v0mkxr/20240317202444-5txwumu.sy index 350208fa8..280bfc9f8 100644 --- a/app/guide/20210808180117-6v0mkxr/20240317202444-5txwumu.sy +++ b/app/guide/20210808180117-6v0mkxr/20240317202444-5txwumu.sy @@ -7,7 +7,7 @@ "id": "20240317202444-5txwumu", "title": "Extend development", "type": "doc", - "updated": "20240317202840" + "updated": "20240407172201" }, "Children": [ { @@ -283,7 +283,7 @@ "ListData": {}, "Properties": { "id": "20240317202702-wczm3on", - "updated": "20240317202840" + "updated": "20240407172201" }, "Children": [ { @@ -377,7 +377,7 @@ }, "Properties": { "id": "20240317202755-i4ttgax", - "updated": "20240317202837" + "updated": "20240407172201" }, "Children": [ { @@ -399,7 +399,7 @@ "Type": "NodeBlockquote", "Properties": { "id": "20240317202837-ahu56j5", - "updated": "20240317202837" + "updated": "20240407172201" }, "Children": [ { @@ -411,22 +411,12 @@ "Type": "NodeParagraph", "Properties": { "id": "20240317202837-83ygog5", - "updated": "20240317202837" + "updated": "20240407172201" }, "Children": [ { "Type": "NodeText", - "Data": "For more details, please refer to " - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/siyuan/issues/9807", - "TextMarkTextContent": "Github Issue #9807" - }, - { - "Type": "NodeText", - "Data": "." + "Data": "For more details, please refer to Github Issue #9807." } ] } diff --git a/app/guide/20210808180117-czj9bvb/20240317200013-fim8wm8.sy b/app/guide/20210808180117-czj9bvb/20240317200013-fim8wm8.sy index b40c8692a..cf4ce0df1 100644 --- a/app/guide/20210808180117-czj9bvb/20240317200013-fim8wm8.sy +++ b/app/guide/20210808180117-czj9bvb/20240317200013-fim8wm8.sy @@ -7,7 +7,7 @@ "id": "20240317200013-fim8wm8", "title": "扩展开发", "type": "doc", - "updated": "20240317202200" + "updated": "20240407172150" }, "Children": [ { @@ -277,7 +277,7 @@ "ListData": {}, "Properties": { "id": "20240317201708-e6uwpl2", - "updated": "20240317202200" + "updated": "20240407172150" }, "Children": [ { @@ -362,7 +362,7 @@ }, "Properties": { "id": "20240317201924-6yrpv38", - "updated": "20240317202200" + "updated": "20240407172150" }, "Children": [ { @@ -384,7 +384,7 @@ "Type": "NodeBlockquote", "Properties": { "id": "20240317201924-ljq7w3h", - "updated": "20240317201924" + "updated": "20240407172150" }, "Children": [ { @@ -396,22 +396,12 @@ "Type": "NodeParagraph", "Properties": { "id": "20240317201924-fr7chfe", - "updated": "20240317201924" + "updated": "20240407172150" }, "Children": [ { "Type": "NodeText", - "Data": "详情请见 " - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/siyuan/issues/9807", - "TextMarkTextContent": "Github Issue #9807" - }, - { - "Type": "NodeText", - "Data": "。" + "Data": "详情请见 Github Issue #9807。" } ] } diff --git a/app/guide/20211226090932-5lcq56f/20240317202230-l8duv3r.sy b/app/guide/20211226090932-5lcq56f/20240317202230-l8duv3r.sy index 863b072eb..8116adba9 100644 --- a/app/guide/20211226090932-5lcq56f/20240317202230-l8duv3r.sy +++ b/app/guide/20211226090932-5lcq56f/20240317202230-l8duv3r.sy @@ -7,7 +7,7 @@ "id": "20240317202230-l8duv3r", "title": "擴充開發", "type": "doc", - "updated": "20240317202429" + "updated": "20240407172156" }, "Children": [ { @@ -283,7 +283,7 @@ "ListData": {}, "Properties": { "id": "20240317202310-3n68u3l", - "updated": "20240317202310" + "updated": "20240407172156" }, "Children": [ { @@ -368,7 +368,7 @@ }, "Properties": { "id": "20240317202310-poaxn3m", - "updated": "20240317202310" + "updated": "20240407172156" }, "Children": [ { @@ -390,7 +390,7 @@ "Type": "NodeBlockquote", "Properties": { "id": "20240317202310-ozkltzq", - "updated": "20240317202310" + "updated": "20240407172156" }, "Children": [ { @@ -402,22 +402,12 @@ "Type": "NodeParagraph", "Properties": { "id": "20240317202310-tfo5fiq", - "updated": "20240317202310" + "updated": "20240407172156" }, "Children": [ { "Type": "NodeText", - "Data": "詳情請見 " - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://github.com/siyuan-note/siyuan/issues/9807", - "TextMarkTextContent": "Github Issue #9807" - }, - { - "Type": "NodeText", - "Data": "。" + "Data": "詳情請見 Github Issue #9807。" } ] } From 20ecabc6c39919a1b7cde0b88fdbfe5df96302e0 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 7 Apr 2024 17:39:58 +0800 Subject: [PATCH 2/2] :art: Remove rows in database bound to child blocks when deleting parent block https://github.com/siyuan-note/siyuan/issues/10923 --- kernel/model/transaction.go | 59 ++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index 39f480211..0d258f42a 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -811,35 +811,48 @@ func removeAvBlockRel(node *ast.Node) { } func syncDelete2AttributeView(node *ast.Node) { - avs := node.IALAttr(av.NodeAttrNameAvs) - if "" == avs { - return - } - - avIDs := strings.Split(avs, ",") - for _, avID := range avIDs { - attrView, parseErr := av.ParseAttributeView(avID) - if nil != parseErr { - continue + changedAvIDs := hashset.New() + ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus { + if !entering || !n.IsBlock() { + return ast.WalkContinue } - changedAv := false - blockValues := attrView.GetBlockKeyValues() - if nil == blockValues { - continue + avs := n.IALAttr(av.NodeAttrNameAvs) + if "" == avs { + return ast.WalkContinue } - for i, blockValue := range blockValues.Values { - if blockValue.Block.ID == node.ID { - blockValues.Values = append(blockValues.Values[:i], blockValues.Values[i+1:]...) - changedAv = true - break + avIDs := strings.Split(avs, ",") + for _, avID := range avIDs { + attrView, parseErr := av.ParseAttributeView(avID) + if nil != parseErr { + continue + } + + changedAv := false + blockValues := attrView.GetBlockKeyValues() + if nil == blockValues { + continue + } + + for i, blockValue := range blockValues.Values { + if blockValue.Block.ID == n.ID { + blockValues.Values = append(blockValues.Values[:i], blockValues.Values[i+1:]...) + changedAv = true + break + } + } + + if changedAv { + av.SaveAttributeView(attrView) + changedAvIDs.Add(avID) } } - if changedAv { - av.SaveAttributeView(attrView) - util.BroadcastByType("protyle", "refreshAttributeView", 0, "", map[string]interface{}{"id": avID}) - } + return ast.WalkContinue + }) + + for _, avID := range changedAvIDs.Values() { + util.BroadcastByType("protyle", "refreshAttributeView", 0, "", map[string]interface{}{"id": avID}) } }