mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-19 13:38:06 +01:00
🎨 Add kernel api getAttributeViewKeysByAvID
This commit is contained in:
parent
4624b62e4d
commit
7d87df9932
3 changed files with 8 additions and 17 deletions
|
|
@ -41,8 +41,8 @@ import (
|
|||
"github.com/xrash/smetrics"
|
||||
)
|
||||
|
||||
func GetAttributeViewSelectOptions(avID string, keyID string) (ret []*av.SelectOption) {
|
||||
ret = []*av.SelectOption{}
|
||||
func GetAttributeViewKeysByAvID(avID string) (ret []*av.Key) {
|
||||
ret = []*av.Key{}
|
||||
|
||||
attrView, err := av.ParseAttributeView(avID)
|
||||
if nil != err {
|
||||
|
|
@ -50,17 +50,9 @@ func GetAttributeViewSelectOptions(avID string, keyID string) (ret []*av.SelectO
|
|||
return
|
||||
}
|
||||
|
||||
key, _ := attrView.GetKey(keyID)
|
||||
if nil == key {
|
||||
return
|
||||
}
|
||||
|
||||
if av.KeyTypeSelect != key.Type && av.KeyTypeMSelect != key.Type {
|
||||
return
|
||||
}
|
||||
|
||||
if 0 < len(key.Options) {
|
||||
ret = key.Options
|
||||
for _, keyValues := range attrView.KeyValues {
|
||||
key := keyValues.Key
|
||||
ret = append(ret, key)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue