🎨 Refresh the data in the interface after moving the document https://github.com/siyuan-note/siyuan/issues/15762

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-09-10 21:39:14 +08:00
parent d5e7b27a11
commit ee4ddf89c1
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
6 changed files with 39 additions and 23 deletions

View file

@ -18,7 +18,6 @@ package model
import (
"os"
"path"
"path/filepath"
"strings"
"time"
@ -38,25 +37,22 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func refreshDocInfo(tree *parse.Tree, size uint64) {
func refreshDocInfo(tree *parse.Tree) {
refreshDocInfoWithSize(tree, filesys.TreeSize(tree))
}
func refreshDocInfoWithSize(tree *parse.Tree, size uint64) {
refreshDocInfo0(tree, size)
refreshParentDocInfo(tree)
}
func refreshParentDocInfo(tree *parse.Tree) {
parentTree := loadParentTree(tree)
if nil == parentTree {
return
}
luteEngine := lute.New()
boxDir := filepath.Join(util.DataDir, tree.Box)
parentDir := path.Dir(tree.Path)
if parentDir == boxDir || parentDir == "/" {
return
}
parentPath := parentDir + ".sy"
parentTree, err := filesys.LoadTree(tree.Box, parentPath, luteEngine)
if err != nil {
return
}
renderer := render.NewJSONRenderer(parentTree, luteEngine.RenderOptions)
data := renderer.Render()
refreshDocInfo0(parentTree, uint64(len(data)))