mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
This commit is contained in:
parent
a31cf35836
commit
d9a19bb3dc
2 changed files with 20 additions and 5 deletions
|
|
@ -233,7 +233,11 @@ func checkBlockFold(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
id := arg["id"].(string)
|
id := arg["id"].(string)
|
||||||
ret.Data = model.IsBlockFolded(id)
|
isFolded, isRoot := model.IsBlockFolded(id)
|
||||||
|
ret.Data = map[string]interface{}{
|
||||||
|
"isFolded": isFolded,
|
||||||
|
"isRoot": isRoot,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkBlockExist(c *gin.Context) {
|
func checkBlockExist(c *gin.Context) {
|
||||||
|
|
|
||||||
|
|
@ -268,20 +268,31 @@ func GetBlockSiblingID(id string) (parent, previous, next string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsBlockFolded(id string) bool {
|
func IsBlockFolded(id string) (isFolded, isRoot bool) {
|
||||||
|
tree, _ := LoadTreeByBlockID(id)
|
||||||
|
if nil == tree {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if tree.Root.ID == id {
|
||||||
|
isRoot = true
|
||||||
|
}
|
||||||
|
|
||||||
for i := 0; i < 32; i++ {
|
for i := 0; i < 32; i++ {
|
||||||
b, _ := getBlock(id, nil)
|
b, _ := getBlock(id, nil)
|
||||||
if nil == b {
|
if nil == b {
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if "1" == b.IAL["fold"] {
|
if "1" == b.IAL["fold"] {
|
||||||
return true
|
isFolded = true
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
id = b.ParentID
|
id = b.ParentID
|
||||||
|
|
||||||
}
|
}
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func RecentUpdatedBlocks() (ret []*Block) {
|
func RecentUpdatedBlocks() (ret []*Block) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue