mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
✨ 反链面板
This commit is contained in:
parent
cb9241eedc
commit
667e0d3f74
2 changed files with 13 additions and 5 deletions
|
|
@ -49,9 +49,9 @@ func getBacklinkDoc(c *gin.Context) {
|
|||
|
||||
defID := arg["defID"].(string)
|
||||
refTreeID := arg["refTreeID"].(string)
|
||||
doms := model.GetBacklinkDoc(defID, refTreeID)
|
||||
backlinks := model.GetBacklinkDoc(defID, refTreeID)
|
||||
ret.Data = map[string]interface{}{
|
||||
"doms": doms,
|
||||
"backlinks": backlinks,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,8 +158,13 @@ OK:
|
|||
return
|
||||
}
|
||||
|
||||
func GetBacklinkDoc(defID, refTreeID string) (ret []string) {
|
||||
ret = []string{}
|
||||
type Backlink struct {
|
||||
DOM string `json:"dom"`
|
||||
BlockPaths []*BlockPath `json:"blockPaths"`
|
||||
}
|
||||
|
||||
func GetBacklinkDoc(defID, refTreeID string) (ret []*Backlink) {
|
||||
ret = []*Backlink{}
|
||||
keyword := ""
|
||||
beforeLen := 12
|
||||
sqlBlock := sql.GetBlock(defID)
|
||||
|
|
@ -279,7 +284,10 @@ func GetBacklinkDoc(defID, refTreeID string) (ret []string) {
|
|||
for _, c := range link.Children {
|
||||
n := treenode.GetNodeInTree(refTree, c.ID)
|
||||
dom := lute.RenderNodeBlockDOM(n, luteEngine.ParseOptions, luteEngine.RenderOptions)
|
||||
ret = append(ret, dom)
|
||||
ret = append(ret, &Backlink{
|
||||
DOM: dom,
|
||||
BlockPaths: buildBlockBreadcrumb(n),
|
||||
})
|
||||
}
|
||||
}
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue