mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
f6bd240a85
9 changed files with 26 additions and 39 deletions
|
@ -3820,7 +3820,7 @@
|
|||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "In the code block, only select the content of the code block"
|
||||
"Data": "Double press to select all loaded content blocks in the document; in the code block, only select the content of the code block"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -3818,7 +3818,7 @@
|
|||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "代码块中使用时仅选中代码块中的内容"
|
||||
"Data": "连续按下两次以选中文档中所有已加载的内容块;代码块中使用时仅选中代码块中的内容"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -3808,7 +3808,7 @@
|
|||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "代碼塊中使用時僅選中代碼塊中的內容"
|
||||
"Data": "連續按下兩次以選中文檔中所有已加載的內容塊;代碼塊中使用時僅選中代碼塊中的內容"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -3775,7 +3775,7 @@
|
|||
"Children": [
|
||||
{
|
||||
"Type": "NodeText",
|
||||
"Data": "コードブロックではコードのみが選択されます"
|
||||
"Data": "文書内のすべてのロード済みコンテンツブロックを選択するにはダブルプレスしてください;コードブロックではコードのみが選択されます"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -42,6 +42,8 @@ type AttributeView struct {
|
|||
KeyIDs []string `json:"keyIDs"` // 属性视图属性键 ID,用于排序
|
||||
ViewID string `json:"viewID"` // 当前视图 ID
|
||||
Views []*View `json:"views"` // 视图
|
||||
|
||||
RenderedViewables map[string]Viewable `json:"-"` // 已经渲染好的视图
|
||||
}
|
||||
|
||||
// KeyValues 描述了属性视图属性键值列表的结构。
|
||||
|
@ -428,7 +430,7 @@ func ParseAttributeView(avID string) (ret *AttributeView, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
ret = &AttributeView{}
|
||||
ret = &AttributeView{RenderedViewables: map[string]Viewable{}}
|
||||
if err = gulu.JSON.UnmarshalJSON(data, ret); err != nil {
|
||||
if strings.Contains(err.Error(), ".relation.contents of type av.Value") {
|
||||
mapAv := map[string]interface{}{}
|
||||
|
|
|
@ -110,15 +110,7 @@ func renderAttributeViewGroups(viewable av.Viewable, attrView *av.AttributeView,
|
|||
|
||||
// 如果存在分组的话渲染分组视图
|
||||
|
||||
fixDev := false
|
||||
for _, groupView := range view.Groups {
|
||||
if (nil == groupView.GroupVal || nil == groupView.GroupKey) && !fixDev {
|
||||
// TODO 分组上线后删除,预计 2025 年 9 月后可以删除
|
||||
regenAttrViewGroups(attrView)
|
||||
av.SaveAttributeView(attrView)
|
||||
fixDev = true
|
||||
}
|
||||
|
||||
switch groupView.GetGroupValue() {
|
||||
case groupValueDefault:
|
||||
groupView.Name = fmt.Sprintf(Conf.language(264), groupKey.Name)
|
||||
|
|
|
@ -74,11 +74,13 @@ func RenderView(attrView *av.AttributeView, view *av.View, query string) (ret av
|
|||
renderedAttrViews := map[string]*av.AttributeView{}
|
||||
renderedAttrViews[attrView.ID] = attrView
|
||||
ret = renderView(attrView, view, query, &depth, renderedAttrViews)
|
||||
|
||||
attrView.RenderedViewables[ret.GetID()] = ret
|
||||
renderedAttrViews[attrView.ID] = attrView
|
||||
return
|
||||
}
|
||||
|
||||
func renderView(attrView *av.AttributeView, view *av.View, query string,
|
||||
depth *int, cachedAttrViews map[string]*av.AttributeView) (ret av.Viewable) {
|
||||
func renderView(attrView *av.AttributeView, view *av.View, query string, depth *int, cachedAttrViews map[string]*av.AttributeView) (ret av.Viewable) {
|
||||
if 7 < *depth {
|
||||
return
|
||||
}
|
||||
|
@ -334,9 +336,7 @@ func fillAttributeViewBaseValue(baseValue *av.BaseValue, fieldID, itemID string,
|
|||
}
|
||||
}
|
||||
|
||||
func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collection av.Collection, ials map[string]map[string]string,
|
||||
depth *int, cachedAttrViews map[string]*av.AttributeView) {
|
||||
|
||||
func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collection av.Collection, ials map[string]map[string]string, depth *int, cachedAttrViews map[string]*av.AttributeView) {
|
||||
// 先渲染主键、创建时间、更新时间
|
||||
|
||||
for _, item := range collection.GetItems() {
|
||||
|
@ -630,23 +630,6 @@ func fillAttributeViewKeyValues(attrView *av.AttributeView, collection av.Collec
|
|||
}
|
||||
}
|
||||
|
||||
func mergeKeyValues(kv1, kv2 []*av.KeyValues) (ret []*av.KeyValues) {
|
||||
ret = kv2
|
||||
for _, k1 := range kv1 {
|
||||
found := false
|
||||
for _, k2 := range kv2 {
|
||||
if k1.Key.ID == k2.Key.ID {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
ret = append(ret, k1)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func FillAttributeViewNilValue(value *av.Value, typ av.KeyType) {
|
||||
value.Type = typ
|
||||
switch typ {
|
||||
|
|
|
@ -18,8 +18,13 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func RenderAttributeViewGallery(attrView *av.AttributeView, view *av.View, query string,
|
||||
depth *int, cachedAttrViews map[string]*av.AttributeView) (ret *av.Gallery) {
|
||||
func RenderAttributeViewGallery(attrView *av.AttributeView, view *av.View, query string, depth *int, cachedAttrViews map[string]*av.AttributeView) (ret *av.Gallery) {
|
||||
viewable := attrView.RenderedViewables[view.ID]
|
||||
if nil != viewable {
|
||||
ret = viewable.(*av.Gallery)
|
||||
return
|
||||
}
|
||||
|
||||
ret = &av.Gallery{
|
||||
BaseInstance: av.NewViewBaseInstance(view),
|
||||
CoverFrom: view.Gallery.CoverFrom,
|
||||
|
|
|
@ -22,8 +22,13 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func RenderAttributeViewTable(attrView *av.AttributeView, view *av.View, query string,
|
||||
depth *int, cachedAttrViews map[string]*av.AttributeView) (ret *av.Table) {
|
||||
func RenderAttributeViewTable(attrView *av.AttributeView, view *av.View, query string, depth *int, cachedAttrViews map[string]*av.AttributeView) (ret *av.Table) {
|
||||
viewable := attrView.RenderedViewables[view.ID]
|
||||
if nil != viewable {
|
||||
ret = viewable.(*av.Table)
|
||||
return
|
||||
}
|
||||
|
||||
ret = &av.Table{
|
||||
BaseInstance: av.NewViewBaseInstance(view),
|
||||
Columns: []*av.TableColumn{},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue