mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🐛 The selection options are inconsistent after pasting data into the database https://github.com/siyuan-note/siyuan/issues/11409
This commit is contained in:
parent
cbea8c6023
commit
f7d23b41fd
3 changed files with 38 additions and 0 deletions
|
|
@ -41,6 +41,30 @@ import (
|
|||
"github.com/xrash/smetrics"
|
||||
)
|
||||
|
||||
func GetAttributeViewSelectOptions(avID string, keyID string) (ret []*av.SelectOption) {
|
||||
ret = []*av.SelectOption{}
|
||||
|
||||
attrView, err := av.ParseAttributeView(avID)
|
||||
if nil != err {
|
||||
logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)
|
||||
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
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func SetDatabaseBlockView(blockID, viewID string) (err error) {
|
||||
node, tree, err := getNodeByBlockID(nil, blockID)
|
||||
if nil != err {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue