mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
This commit is contained in:
parent
3c52bf63a9
commit
5b46889de7
3 changed files with 11 additions and 5 deletions
|
|
@ -797,7 +797,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
transaction(protyle, [{
|
transaction(protyle, [{
|
||||||
action: "insertAttrViewBlock",
|
action: "insertAttrViewBlock",
|
||||||
id: targetElement.getAttribute("data-node-id"),
|
id: targetElement.getAttribute("data-node-id"),
|
||||||
parentID: targetElement.getAttribute("data-av-type"),
|
parentID: targetElement.getAttribute("data-av-id"),
|
||||||
previousID: "",
|
previousID: "",
|
||||||
srcIDs: sourceIds,
|
srcIDs: sourceIds,
|
||||||
}], [{
|
}], [{
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/88250/gulu"
|
"github.com/88250/gulu"
|
||||||
"github.com/88250/lute/ast"
|
|
||||||
"github.com/siyuan-note/filelock"
|
"github.com/siyuan-note/filelock"
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
|
|
@ -49,9 +48,9 @@ const (
|
||||||
AttributeViewTypeTable AttributeViewType = "table" // 属性视图类型 - 表格
|
AttributeViewTypeTable AttributeViewType = "table" // 属性视图类型 - 表格
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewAttributeView() *AttributeView {
|
func NewAttributeView(id string) *AttributeView {
|
||||||
return &AttributeView{
|
return &AttributeView{
|
||||||
ID: ast.NewNodeID(),
|
ID: id,
|
||||||
Columns: []Column{NewColumnBlock()},
|
Columns: []Column{NewColumnBlock()},
|
||||||
Rows: [][]Cell{},
|
Rows: [][]Cell{},
|
||||||
Type: AttributeViewTypeTable,
|
Type: AttributeViewTypeTable,
|
||||||
|
|
@ -115,7 +114,7 @@ const (
|
||||||
func ParseAttributeView(avID string) (ret *AttributeView, err error) {
|
func ParseAttributeView(avID string) (ret *AttributeView, err error) {
|
||||||
avJSONPath := getAttributeViewJSONPath(avID)
|
avJSONPath := getAttributeViewJSONPath(avID)
|
||||||
if !gulu.File.IsExist(avJSONPath) {
|
if !gulu.File.IsExist(avJSONPath) {
|
||||||
ret = NewAttributeView()
|
ret = NewAttributeView(avID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,13 @@ func addAttributeViewBlock(blockID, avID string, tree *parse.Tree) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 不允许重复添加相同的块到属性视图中
|
||||||
|
for _, row := range attrView.Rows {
|
||||||
|
if row[0].Value() == blockID {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var row []av.Cell
|
var row []av.Cell
|
||||||
row = append(row, av.NewCellBlock(block.ID))
|
row = append(row, av.NewCellBlock(block.ID))
|
||||||
if 1 < len(attrView.Columns) {
|
if 1 < len(attrView.Columns) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue