Selaa lähdekoodia

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

Daniel 1 vuosi sitten
vanhempi
commit
1d2516afb9
3 muutettua tiedostoa jossa 3 lisäystä ja 24 poistoa
  1. 2 2
      kernel/model/attribute_view.go
  2. 1 1
      kernel/model/blockinfo.go
  3. 0 21
      kernel/treenode/node.go

+ 2 - 2
kernel/model/attribute_view.go

@@ -2943,12 +2943,12 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
 			// 将游离行绑定到新建的块上
 			// 将游离行绑定到新建的块上
 			bindBlockAv(tx, avID, rowID)
 			bindBlockAv(tx, avID, rowID)
 		}
 		}
-	} else {                    // 之前绑定了块
+	} else { // 之前绑定了块
 		if isUpdatingBlockKey { // 正在更新主键
 		if isUpdatingBlockKey { // 正在更新主键
 			if val.IsDetached { // 现在是游离行
 			if val.IsDetached { // 现在是游离行
 				// 将绑定的块从属性视图中移除
 				// 将绑定的块从属性视图中移除
 				unbindBlockAv(tx, avID, rowID)
 				unbindBlockAv(tx, avID, rowID)
-			} else {                                // 现在绑定了块
+			} else { // 现在绑定了块
 				if oldBoundBlockID != val.BlockID { // 之前绑定的块和现在绑定的块不一样
 				if oldBoundBlockID != val.BlockID { // 之前绑定的块和现在绑定的块不一样
 					// 换绑块
 					// 换绑块
 					unbindBlockAv(tx, avID, oldBoundBlockID)
 					unbindBlockAv(tx, avID, oldBoundBlockID)

+ 1 - 1
kernel/model/blockinfo.go

@@ -365,7 +365,7 @@ func buildBlockBreadcrumb(node *ast.Node, excludeTypes []string) (ret []*BlockPa
 		if ast.NodeDocument == parent.Type {
 		if ast.NodeDocument == parent.Type {
 			name = box.Name + hPath
 			name = box.Name + hPath
 		} else if ast.NodeAttributeView == parent.Type {
 		} else if ast.NodeAttributeView == parent.Type {
-			name = treenode.GetAttributeViewName(parent.AttributeViewID)
+			name, _ = av.GetAttributeViewName(parent.AttributeViewID)
 		} else {
 		} else {
 			if "" == name {
 			if "" == name {
 				if ast.NodeListItem == parent.Type {
 				if ast.NodeListItem == parent.Type {

+ 0 - 21
kernel/treenode/node.go

@@ -546,27 +546,6 @@ func IsChartCodeBlockCode(code *ast.Node) bool {
 	return render.NoHighlight(language)
 	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) {
 func getAttributeViewContent(avID string) (content string) {
 	if "" == avID {
 	if "" == avID {
 		return
 		return