From 914c7659388e645395e70224f0d831950275eb05 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 24 Dec 2024 19:47:45 +0800 Subject: [PATCH] :art: Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049 --- kernel/model/attribute_view.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index b61bd6f5291..28015ed6274 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -3108,12 +3108,22 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID string, valueDa } else { // 之前绑定的块和现在绑定的块一样 content := strings.TrimSpace(val.Block.Content) node, tree, _ := getNodeByBlockID(tx, val.BlockID) + updateStaticText := true + _, blockText := getNodeAvBlockText(node) if "" == content { - _, val.Block.Content = getNodeAvBlockText(node) + val.Block.Content = blockText + } else { + if blockText == content { + updateStaticText = false + } else { + val.Block.Content = blockText + } } - // 设置静态锚文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049 - updateBlockValueStaticText(tx, node, tree, avID, content) + if updateStaticText { + // 设置静态锚文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049 + updateBlockValueStaticText(tx, node, tree, avID, content) + } } } }