diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go index ea0a55490..4d27daf07 100644 --- a/kernel/model/blockinfo.go +++ b/kernel/model/blockinfo.go @@ -36,6 +36,7 @@ import ( type BlockInfo struct { ID string `json:"id"` + RootID string `json:"rootID"` Name string `json:"name"` RefCount int `json:"refCount"` SubFileCount int `json:"subFileCount"` @@ -44,17 +45,17 @@ type BlockInfo struct { Icon string `json:"icon"` } -func GetDocInfo(rootID string) (ret *BlockInfo) { +func GetDocInfo(blockID string) (ret *BlockInfo) { WaitForWritingFiles() - tree, err := loadTreeByBlockID(rootID) + tree, err := loadTreeByBlockID(blockID) if nil != err { - logging.LogErrorf("load tree by root id [%s] failed: %s", rootID, err) + logging.LogErrorf("load tree by root id [%s] failed: %s", blockID, err) return } title := tree.Root.IALAttr("title") - ret = &BlockInfo{ID: rootID, Name: title} + ret = &BlockInfo{ID: blockID, RootID: tree.Root.ID, Name: title} ret.IAL = parse.IAL2Map(tree.Root.KramdownIAL) scrollData := ret.IAL["scroll"] if 0 < len(scrollData) { @@ -81,7 +82,7 @@ func GetDocInfo(rootID string) (ret *BlockInfo) { } } } - ret.RefIDs, _ = sql.QueryRefIDsByDefID(rootID, false) + ret.RefIDs, _ = sql.QueryRefIDsByDefID(blockID, false) ret.RefCount = len(ret.RefIDs) var subFileCount int