Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: 文档树自定义排序拖拽不稳定 https://github.com/siyuan-note/siyuan/issues/7726

Liang Ding65e0d8af5670
diff --git a/kernel/api/filetree.go b/kernel/api/filetree.go
index c4116dd940..c71201be49 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 29ae0b9255..25e6987b22 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
}