Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve database block text in breadcrumbs https://github.com/siyuan-note/siyuan/issues/10891

Daniel1d2516afb979
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index a4c84a66fd..b04a04b9c8 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -2943,12 +2943,12 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
// 将游离行绑定到新建的块上
bindBlockAv(tx, avID, rowID)
}
- } else { // 之前绑定了块
+ } else { // 之前绑定了块
if isUpdatingBlockKey { // 正在更新主键
if val.IsDetached { // 现在是游离行
// 将绑定的块从属性视图中移除
unbindBlockAv(tx, avID, rowID)
- } else { // 现在绑定了块
+ } else { // 现在绑定了块
if oldBoundBlockID != val.BlockID { // 之前绑定的块和现在绑定的块不一样
// 换绑块
unbindBlockAv(tx, avID, oldBoundBlockID)
diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go
index aabb5b91e5..4f773cc895 100644
--- a/kernel/model/blockinfo.go
+++ b/kernel/model/blockinfo.go
@@ -365,7 +365,7 @@ func buildBlockBreadcrumb(node *ast.Node, excludeTypes []string) (ret []*BlockPa
if ast.NodeDocument == parent.Type {
name = box.Name + hPath
} else if ast.NodeAttributeView == parent.Type {
- name = treenode.GetAttributeViewName(parent.AttributeViewID)
+ name, _ = av.GetAttributeViewName(parent.AttributeViewID)
} else {
if "" == name {
if ast.NodeListItem == parent.Type {
diff --git a/kernel/treenode/node.go b/kernel/treenode/node.go
index edf07ae123..d6b24408d5 100644
--- a/kernel/treenode/node.go
+++ b/kernel/treenode/node.go
@@ -546,27 +546,6 @@ func IsChartCodeBlockCode(code *ast.Node) bool {
return render.NoHighlight(language)
}
-func GetAttributeViewName(avID string) (name string) {
- if "" == avID {
- return
- }
-
- attrView, err := av.ParseAttributeView(avID)
- if nil != err {
- logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)
- return
- }
-
- buf := bytes.Buffer{}
- for _, v := range attrView.Views {
- buf.WriteString(v.Name)
- buf.WriteByte(' ')
- }
-
- name = strings.TrimSpace(buf.String())
- return
-}
-
func getAttributeViewContent(avID string) (content string) {
if "" == avID {
return