🐛 移动文档后打开文档滚动触发动态加载后会关闭页签 Fix https://github.com/siyuan-note/siyuan/issues/7231
This commit is contained in:
parent
4ae9fda611
commit
e05ad77aef
1 changed files with 3 additions and 21 deletions
|
@ -147,26 +147,8 @@ func GetBlockTree(id string) (ret *BlockTree) {
|
|||
}
|
||||
|
||||
func SetBlockTreePath(tree *parse.Tree) {
|
||||
hash := btHash(tree.ID)
|
||||
val, ok := blockTrees.Load(hash)
|
||||
if !ok {
|
||||
val = &btSlice{data: map[string]*BlockTree{}, changed: time.Time{}, m: &sync.Mutex{}}
|
||||
blockTrees.Store(hash, val)
|
||||
}
|
||||
|
||||
slice := val.(*btSlice)
|
||||
slice.m.Lock()
|
||||
slice.data[tree.ID] = &BlockTree{
|
||||
ID: tree.ID,
|
||||
RootID: tree.Root.ID,
|
||||
BoxID: tree.Box,
|
||||
Path: tree.Path,
|
||||
HPath: tree.HPath,
|
||||
Updated: tree.Root.IALAttr("updated"),
|
||||
Type: TypeAbbr(ast.NodeDocument.String()),
|
||||
}
|
||||
slice.m.Unlock()
|
||||
slice.changed = time.Now()
|
||||
RemoveBlockTreesByRootID(tree.ID)
|
||||
IndexBlockTree(tree)
|
||||
}
|
||||
|
||||
func RemoveBlockTreesByRootID(rootID string) {
|
||||
|
@ -176,7 +158,7 @@ func RemoveBlockTreesByRootID(rootID string) {
|
|||
slice.m.Lock()
|
||||
for _, b := range slice.data {
|
||||
if b.RootID == rootID {
|
||||
ids = append(ids, b.RootID)
|
||||
ids = append(ids, b.ID)
|
||||
}
|
||||
}
|
||||
slice.m.Unlock()
|
||||
|
|
Loading…
Add table
Reference in a new issue