From 1590913db73d8def51a05544b8a2b5e654285aa3 Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Thu, 12 Oct 2023 19:55:57 +0800
Subject: [PATCH] :art: Update attr panel for av
---
app/src/protyle/render/av/blockAttr.ts | 3 +++
kernel/model/attribute_view.go | 10 +++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/app/src/protyle/render/av/blockAttr.ts b/app/src/protyle/render/av/blockAttr.ts
index a469f2d5b..0ddb0ed89 100644
--- a/app/src/protyle/render/av/blockAttr.ts
+++ b/app/src/protyle/render/av/blockAttr.ts
@@ -8,6 +8,9 @@ import {popTextCell} from "./cell";
export const genAVValueHTML = (value: IAVCellValue) => {
let html = "";
switch (value.type) {
+ case "block":
+ html = `
${value.block.content}
`;
+ break;
case "text":
html = ``;
break;
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 67e2bbe6a..246e4aed8 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -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 {
@@ -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)
}
}