mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 数据历史文档支持只读可视化预览 https://github.com/siyuan-note/siyuan/issues/5735
This commit is contained in:
parent
90678a7915
commit
5d403e3505
2 changed files with 6 additions and 2 deletions
|
|
@ -121,7 +121,7 @@ func getDocHistoryContent(c *gin.Context) {
|
||||||
if nil != k {
|
if nil != k {
|
||||||
keyword = k.(string)
|
keyword = k.(string)
|
||||||
}
|
}
|
||||||
content, isLargeDoc, err := model.GetDocHistoryContent(historyPath, keyword)
|
id, rootID, content, isLargeDoc, err := model.GetDocHistoryContent(historyPath, keyword)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
ret.Code = -1
|
ret.Code = -1
|
||||||
ret.Msg = err.Error()
|
ret.Msg = err.Error()
|
||||||
|
|
@ -129,6 +129,8 @@ func getDocHistoryContent(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.Data = map[string]interface{}{
|
ret.Data = map[string]interface{}{
|
||||||
|
"id": id,
|
||||||
|
"rootID": rootID,
|
||||||
"content": content,
|
"content": content,
|
||||||
"isLargeDoc": isLargeDoc,
|
"isLargeDoc": isLargeDoc,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ func ClearWorkspaceHistory() (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDocHistoryContent(historyPath, keyword string) (content string, isLargeDoc bool, err error) {
|
func GetDocHistoryContent(historyPath, keyword string) (id, rootID, content string, isLargeDoc bool, err error) {
|
||||||
if !gulu.File.IsExist(historyPath) {
|
if !gulu.File.IsExist(historyPath) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -160,6 +160,8 @@ func GetDocHistoryContent(historyPath, keyword string) (content string, isLargeD
|
||||||
os.RemoveAll(historyPath)
|
os.RemoveAll(historyPath)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
id = historyTree.Root.ID
|
||||||
|
rootID = historyTree.Root.ID
|
||||||
|
|
||||||
if !isLargeDoc {
|
if !isLargeDoc {
|
||||||
renderTree := &parse.Tree{Root: &ast.Node{Type: ast.NodeDocument}}
|
renderTree := &parse.Tree{Root: &ast.Node{Type: ast.NodeDocument}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue