mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +01:00
🎨 Improve av
This commit is contained in:
parent
d77d29cf78
commit
a45b62e76b
2 changed files with 16 additions and 7 deletions
|
|
@ -1216,7 +1216,7 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page,
|
|||
}
|
||||
|
||||
// 做一些数据兼容和订正处理
|
||||
checkViewInstance(attrView, view)
|
||||
checkViewInstance(attrView)
|
||||
upgradeAttributeViewSpec(attrView)
|
||||
|
||||
switch view.LayoutType {
|
||||
|
|
|
|||
|
|
@ -23,14 +23,23 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/treenode"
|
||||
)
|
||||
|
||||
func checkViewInstance(attrView *av.AttributeView, view *av.View) {
|
||||
if av.LayoutTypeGallery == view.LayoutType && nil == view.Gallery {
|
||||
// 切换为画廊视图时可能没有初始化画廊实例 https://github.com/siyuan-note/siyuan/issues/15122
|
||||
if nil != view.Table {
|
||||
view.LayoutType = av.LayoutTypeTable
|
||||
av.SaveAttributeView(attrView)
|
||||
func checkViewInstance(attrView *av.AttributeView) {
|
||||
changed := false
|
||||
for i, view := range attrView.Views {
|
||||
if av.LayoutTypeGallery == view.LayoutType && nil == view.Gallery {
|
||||
// 切换为画廊视图时可能没有初始化画廊实例 https://github.com/siyuan-note/siyuan/issues/15122
|
||||
if nil != view.Table {
|
||||
view.LayoutType = av.LayoutTypeTable
|
||||
changed = true
|
||||
} else {
|
||||
attrView.Views = append(attrView.Views[:i], attrView.Views[i+1:]...)
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if changed {
|
||||
av.SaveAttributeView(attrView)
|
||||
}
|
||||
}
|
||||
|
||||
func upgradeAttributeViewSpec(attrView *av.AttributeView) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue