mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 嵌入块查询结果中显示块引用计数 https://github.com/siyuan-note/siyuan/issues/7191
This commit is contained in:
parent
ef436cf12e
commit
35baf86b6e
2 changed files with 35 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue