From b110db9c59bd3600a5debdfbbed495a1f5c8b38e Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 13 Nov 2022 21:07:45 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20`[[`=20=E5=BC=95=E7=94=A8=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E9=94=9A=E6=96=87=E6=9C=AC=E9=95=BF=E5=BA=A6=E9=99=90?= =?UTF-8?q?=E5=88=B6=E6=97=A0=E6=95=88=20Fix=20https://github.com/siyuan-n?= =?UTF-8?q?ote/siyuan/issues/6566?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/search.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/kernel/model/search.go b/kernel/model/search.go index 6b2ec11af..daa97f4ad 100644 --- a/kernel/model/search.go +++ b/kernel/model/search.go @@ -117,11 +117,8 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int) (ret []*Block, ne if nil == block { continue } - block.Content = maxContent(block.Content, Conf.Editor.BlockRefDynamicAnchorTextMaxLen) - block.RefText = block.Content - if block.IsContainerBlock() { - block.RefText = block.FContent // `((` 引用列表项时使用第一个子块作为动态锚文本 https://github.com/siyuan-note/siyuan/issues/4536 - } + block.RefText = sql.GetRefText(block.ID) + block.RefText = maxContent(block.RefText, Conf.Editor.BlockRefDynamicAnchorTextMaxLen) ret = append(ret, block) } if 1 > len(ret) { @@ -135,9 +132,9 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int) (ret []*Block, ne trees := map[string]*parse.Tree{} for _, b := range ret { hitFirstChildID := false - b.RefText = b.Content + b.RefText = sql.GetRefText(b.ID) + b.RefText = maxContent(b.RefText, Conf.Editor.BlockRefDynamicAnchorTextMaxLen) if b.IsContainerBlock() { - b.RefText = b.FContent // `((` 引用列表项时使用第一个子块作为动态锚文本 https://github.com/siyuan-note/siyuan/issues/4536 // `((` 引用候选中排除当前块的父块 https://github.com/siyuan-note/siyuan/issues/4538 tree := trees[b.RootID] @@ -154,7 +151,6 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int) (ret []*Block, ne } if b.ID != id && !hitFirstChildID && b.ID != rootID { - b.Content = maxContent(b.Content, Conf.Editor.BlockRefDynamicAnchorTextMaxLen) tmp = append(tmp, b) } }