mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-19 23:06:09 +01:00
🐛 搜索处于折叠状态的块时未聚焦显示结果 Fix https://github.com/siyuan-note/siyuan/issues/7252
This commit is contained in:
parent
aa74cacdb0
commit
3fb296c88c
2 changed files with 17 additions and 13 deletions
|
|
@ -154,19 +154,7 @@ func checkBlockFold(c *gin.Context) {
|
|||
}
|
||||
|
||||
id := arg["id"].(string)
|
||||
b, err := model.GetBlock(id, nil)
|
||||
if errors.Is(err, filelock.ErrUnableAccessFile) {
|
||||
ret.Code = 2
|
||||
ret.Data = id
|
||||
return
|
||||
}
|
||||
if errors.Is(err, model.ErrIndexing) {
|
||||
ret.Code = 0
|
||||
ret.Data = false
|
||||
return
|
||||
}
|
||||
|
||||
ret.Data = nil != b && "1" == b.IAL["fold"]
|
||||
ret.Data = model.IsBlockFolded(id)
|
||||
}
|
||||
|
||||
func checkBlockExist(c *gin.Context) {
|
||||
|
|
|
|||
|
|
@ -87,6 +87,22 @@ type Path struct {
|
|||
Created string `json:"created"` // 创建时间
|
||||
}
|
||||
|
||||
func IsBlockFolded(id string) bool {
|
||||
for i := 0; i < 32; i++ {
|
||||
b, _ := getBlock(id, nil)
|
||||
if nil == b {
|
||||
return true
|
||||
}
|
||||
|
||||
if "1" == b.IAL["fold"] {
|
||||
return true
|
||||
}
|
||||
|
||||
id = b.ParentID
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func RecentUpdatedBlocks() (ret []*Block) {
|
||||
ret = []*Block{}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue