This commit is contained in:
Liang Ding 2023-03-03 10:26:02 +08:00
parent efa308d945
commit 9c1d6a1a70
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
12 changed files with 63 additions and 67 deletions

View file

@ -19,7 +19,6 @@ package model
import (
"errors"
"fmt"
"github.com/88250/lute/parse"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/av"
@ -94,7 +93,7 @@ func removeAttributeViewBlock(blockID, avID string, tree *parse.Tree) (err error
}
for i, row := range attrView.Rows {
if row[0].Value() == blockID {
if row.Cells[0].(*av.Cell).Value == blockID {
attrView.Rows = append(attrView.Rows[:i], attrView.Rows[i+1:]...)
break
}
@ -124,18 +123,18 @@ func addAttributeViewBlock(blockID, avID string, tree *parse.Tree) (err error) {
// 不允许重复添加相同的块到属性视图中
for _, row := range attrView.Rows {
if row[0].Value() == blockID {
if row.Cells[0].(*av.Cell).Value == blockID {
return
}
}
var row []av.Cell
row = append(row, av.NewCellBlock(block.ID))
row := av.NewRow()
row.Cells = append(row.Cells, av.NewCellBlock(block.ID))
if 1 < len(attrView.Columns) {
attrs := parse.IAL2Map(node.KramdownIAL)
for _, col := range attrView.Columns[1:] {
colName := col.Name()
colName := col.(*av.Column).Name
attrs[colName] = ""
}