From 5d403e3505df22d8d47c9d77d2b16c2a5cc0fb2f Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 31 Aug 2022 22:13:59 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=95=B0=E6=8D=AE=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E6=94=AF=E6=8C=81=E5=8F=AA=E8=AF=BB=E5=8F=AF?= =?UTF-8?q?=E8=A7=86=E5=8C=96=E9=A2=84=E8=A7=88=20https://github.com/siyua?= =?UTF-8?q?n-note/siyuan/issues/5735?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/history.go | 4 +++- kernel/model/history.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/api/history.go b/kernel/api/history.go index 432047916..b3652d0de 100644 --- a/kernel/api/history.go +++ b/kernel/api/history.go @@ -121,7 +121,7 @@ func getDocHistoryContent(c *gin.Context) { if nil != k { keyword = k.(string) } - content, isLargeDoc, err := model.GetDocHistoryContent(historyPath, keyword) + id, rootID, content, isLargeDoc, err := model.GetDocHistoryContent(historyPath, keyword) if nil != err { ret.Code = -1 ret.Msg = err.Error() @@ -129,6 +129,8 @@ func getDocHistoryContent(c *gin.Context) { } ret.Data = map[string]interface{}{ + "id": id, + "rootID": rootID, "content": content, "isLargeDoc": isLargeDoc, } diff --git a/kernel/model/history.go b/kernel/model/history.go index 8c7961d47..e7e301f8d 100644 --- a/kernel/model/history.go +++ b/kernel/model/history.go @@ -141,7 +141,7 @@ func ClearWorkspaceHistory() (err error) { 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) { return } @@ -160,6 +160,8 @@ func GetDocHistoryContent(historyPath, keyword string) (content string, isLargeD os.RemoveAll(historyPath) return } + id = historyTree.Root.ID + rootID = historyTree.Root.ID if !isLargeDoc { renderTree := &parse.Tree{Root: &ast.Node{Type: ast.NodeDocument}}