🎨 Add Rollup column to database table view https://github.com/siyuan-note/siyuan/issues/9958

This commit is contained in:
Daniel 2024-01-01 01:08:55 +08:00
parent 4fcc7f1b4c
commit 99218f400b
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
6 changed files with 35 additions and 10 deletions

View file

@ -168,7 +168,7 @@ func IsNodeOCRed(node *ast.Node) (ret bool) {
return
}
func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATitleURL, includeAssetPath bool) string {
func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATitleURL, includeAssetPath, fullAttrView bool) string {
if nil == node {
return ""
}
@ -178,7 +178,11 @@ func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATi
}
if ast.NodeAttributeView == node.Type {
return getAttributeViewContent(node.AttributeViewID)
if fullAttrView {
return getAttributeViewContent(node.AttributeViewID)
}
return getAttributeViewName(node.AttributeViewID)
}
buf := bytes.Buffer{}
@ -528,6 +532,27 @@ func GetAttributeViewName(avID string) (name string) {
return
}
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