From 1e7cf8917b43786a44c7d700c3cac3150b72d2c7 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 27 Mar 2023 15:22:33 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=96=87=E6=A1=A3=E6=A0=91=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=8E=92=E5=BA=8F=E6=8B=96=E6=8B=BD=E4=B8=8D?= =?UTF-8?q?=E7=A8=B3=E5=AE=9A=20https://github.com/siyuan-note/siyuan/issu?= =?UTF-8?q?es/7726?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/filetree.go | 4 +++- kernel/model/file.go | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/kernel/api/filetree.go b/kernel/api/filetree.go index c4116dd94..c71201be4 100644 --- a/kernel/api/filetree.go +++ b/kernel/api/filetree.go @@ -267,7 +267,9 @@ func moveDocs(c *gin.Context) { return } - err := model.MoveDocs(fromPaths, toNotebook, toPath) + callback := arg["callback"] + + err := model.MoveDocs(fromPaths, toNotebook, toPath, callback) if nil != err { ret.Code = -1 ret.Msg = err.Error() diff --git a/kernel/model/file.go b/kernel/model/file.go index 29ae0b925..25e6987b2 100644 --- a/kernel/model/file.go +++ b/kernel/model/file.go @@ -989,7 +989,7 @@ func GetFullHPathByID(id string) (hPath string, err error) { return } -func MoveDocs(fromPaths []string, toBoxID, toPath string) (err error) { +func MoveDocs(fromPaths []string, toBoxID, toPath string, callback interface{}) (err error) { toBox := Conf.Box(toBoxID) if nil == toBox { err = errors.New(Conf.Language(0)) @@ -1020,7 +1020,7 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string) (err error) { WaitForWritingFiles() luteEngine := util.NewLute() for fromPath, fromBox := range pathsBoxes { - _, err = moveDoc(fromBox, fromPath, toBox, toPath, luteEngine) + _, err = moveDoc(fromBox, fromPath, toBox, toPath, luteEngine, callback) if nil != err { return } @@ -1036,7 +1036,7 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string) (err error) { return } -func moveDoc(fromBox *Box, fromPath string, toBox *Box, toPath string, luteEngine *lute.Lute) (newPath string, err error) { +func moveDoc(fromBox *Box, fromPath string, toBox *Box, toPath string, luteEngine *lute.Lute, callback interface{}) (newPath string, err error) { isSameBox := fromBox.ID == toBox.ID if isSameBox { @@ -1150,6 +1150,7 @@ func moveDoc(fromBox *Box, fromPath string, toBox *Box, toPath string, luteEngin "toPath": toPath, "newPath": newPath, } + evt.Callback = callback util.PushEvent(evt) return }