🐛 [[ 引用动态锚文本长度限制无效 Fix https://github.com/siyuan-note/siyuan/issues/6566

This commit is contained in:
Liang Ding 2022-11-13 21:07:45 +08:00
parent 2bb12d67aa
commit b110db9c59
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -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)
}
}