mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Support doc/snapshot history for database table view https://github.com/siyuan-note/siyuan/issues/9567
This commit is contained in:
parent
235e54fbf1
commit
66211b2f3f
1 changed files with 19 additions and 0 deletions
|
|
@ -242,6 +242,25 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
tree, _ := loadTree(srcPath, util.NewLute())
|
||||
if nil != tree {
|
||||
historyDir := strings.TrimPrefix(historyPath, util.HistoryDir+string(os.PathSeparator))
|
||||
if strings.Contains(historyDir, string(os.PathSeparator)) {
|
||||
historyDir = historyDir[:strings.Index(historyDir, string(os.PathSeparator))]
|
||||
}
|
||||
historyDir = filepath.Join(util.HistoryDir, historyDir)
|
||||
|
||||
// 恢复包含的的属性视图 https://github.com/siyuan-note/siyuan/issues/9567
|
||||
avNodes := tree.Root.ChildrenByType(ast.NodeAttributeView)
|
||||
for _, avNode := range avNodes {
|
||||
srcAvPath := filepath.Join(historyDir, "storage", "av", avNode.AttributeViewID+".json")
|
||||
destAvPath := filepath.Join(util.DataDir, "storage", "av", avNode.AttributeViewID+".json")
|
||||
if copyErr := filelock.CopyNewtimes(srcAvPath, destAvPath); nil != copyErr {
|
||||
logging.LogErrorf("copy av [%s] failed: %s", srcAvPath, copyErr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
util.ReloadUI()
|
||||
FullReindex()
|
||||
IncSync()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue