Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 12, 2023
2 parents 02ec0f6 + 0ea9b8f commit 025a8ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions app/src/protyle/render/av/blockAttr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import {popTextCell} from "./cell";
export const genAVValueHTML = (value: IAVCellValue) => {
let html = "";
switch (value.type) {
case "block":
html = `<div class="fn__flex-1">${value.block.content}</div>`;
break;
case "text":
html = `<textarea rows="${value.text.content.split("\n").length}" class="b3-text-field b3-text-field--text fn__flex-1">${value.text.content}</textarea>`;
break;
Expand Down
16 changes: 8 additions & 8 deletions kernel/model/attribute_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {

var keyValues []*av.KeyValues
for _, kv := range attrView.KeyValues {
if av.KeyTypeBlock == kv.Key.Type {
continue
}

kValues := &av.KeyValues{Key: kv.Key}
for _, v := range kv.Values {
if v.BlockID == blockID {
Expand Down Expand Up @@ -180,7 +176,11 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {
switch kv.Key.Type {
case av.KeyTypeTemplate:
if 0 < len(kv.Values) {
ial := GetBlockAttrs(blockID)
ial := map[string]string{}
block := getRowBlockValue(keyValues)
if !block.IsDetached {
ial = GetBlockAttrs(blockID)
}
kv.Values[0].Template.Content = renderTemplateCol(ial, kv.Key.Template, keyValues)
}
}
Expand Down Expand Up @@ -243,7 +243,7 @@ func RenderAttributeView(avID string) (viewable av.Viewable, attrView *av.Attrib
}

// 做一些数据兼容处理,保存的时候也会做 av.SaveAttributeView()
now := util.CurrentTimeMillis()
currentTimeMillis := util.CurrentTimeMillis()
for _, kv := range attrView.KeyValues {
switch kv.Key.Type {
case av.KeyTypeBlock: // 补全 block 的创建时间和更新时间
Expand All @@ -254,11 +254,11 @@ func RenderAttributeView(avID string) (viewable av.Viewable, attrView *av.Attrib
if nil == parseErr {
v.Block.Created = created.UnixMilli()
} else {
v.Block.Created = now
v.Block.Created = currentTimeMillis
}
}
if 0 == v.Block.Updated {
v.Block.Updated = now
v.Block.Updated = currentTimeMillis
}
}
}
Expand Down

0 comments on commit 025a8ea

Please sign in to comment.