🎨 嵌入块查询结果中显示块引用计数 https://github.com/siyuan-note/siyuan/issues/7191

This commit is contained in:
Liang Ding 2023-01-31 19:40:55 +08:00
parent ef436cf12e
commit 35baf86b6e
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 35 additions and 0 deletions

View file

@ -19,6 +19,7 @@ package model
import (
"errors"
"fmt"
"strconv"
"time"
"github.com/88250/lute"
@ -466,6 +467,18 @@ func getEmbeddedBlock(embedBlockID string, trees map[string]*parse.Tree, sqlBloc
return
}
// 嵌入块查询结果中显示块引用计数 https://github.com/siyuan-note/siyuan/issues/7191
var defIDs []string
for _, n := range nodes {
defIDs = append(defIDs, n.ID)
}
refCount := sql.QueryRefCount(defIDs)
for _, n := range nodes {
if cnt := refCount[n.ID]; 0 < cnt {
n.SetIALAttr("refcount", strconv.Itoa(cnt))
}
}
luteEngine := NewLute()
luteEngine.RenderOptions.ProtyleContenteditable = false // 不可编辑
dom := renderBlockDOMByNodes(nodes, luteEngine)