Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/17958

Daniel784fca2dc672
diff --git a/kernel/api/filetree.go b/kernel/api/filetree.go
index e2f55e6219..43b56239bc 100644
--- a/kernel/api/filetree.go
+++ b/kernel/api/filetree.go
@@ -242,15 +242,15 @@ func heading2Doc(c *gin.Context) {
if arg["targetPath"] != nil {
targetPath = arg["targetPath"].(string)
}
- var previousPath string
- if arg["previousPath"] != nil {
- previousPath = arg["previousPath"].(string)
- }
- var toTop bool
- if arg["toTop"] != nil {
- toTop = arg["toTop"].(bool)
- }
- srcRootBlockID, targetPath, err := model.Heading2Doc(srcHeadingID, targetNotebook, targetPath, previousPath, toTop)
+ var previousPath string
+ if arg["previousPath"] != nil {
+ previousPath = arg["previousPath"].(string)
+ }
+ var toTop bool
+ if arg["toTop"] != nil {
+ toTop = arg["toTop"].(bool)
+ }
+ srcRootBlockID, targetPath, err := model.Heading2Doc(srcHeadingID, targetNotebook, targetPath, previousPath, toTop)
if err != nil {
ret.Code = -1
ret.Msg = err.Error()
@@ -285,15 +285,15 @@ func li2Doc(c *gin.Context) {
if arg["targetPath"] != nil {
targetPath = arg["targetPath"].(string)
}
- var previousPath string
- if arg["previousPath"] != nil {
- previousPath = arg["previousPath"].(string)
- }
- var toTop bool
- if arg["toTop"] != nil {
- toTop = arg["toTop"].(bool)
- }
- srcRootBlockID, targetPath, err := model.ListItem2Doc(srcListItemID, targetNotebook, targetPath, previousPath, toTop)
+ var previousPath string
+ if arg["previousPath"] != nil {
+ previousPath = arg["previousPath"].(string)
+ }
+ var toTop bool
+ if arg["toTop"] != nil {
+ toTop = arg["toTop"].(bool)
+ }
+ srcRootBlockID, targetPath, err := model.ListItem2Doc(srcListItemID, targetNotebook, targetPath, previousPath, toTop)
if err != nil {
ret.Code = -1
ret.Msg = err.Error()
diff --git a/kernel/model/heading.go b/kernel/model/heading.go
index 3eb5ce1b52..651c7018a5 100644
--- a/kernel/model/heading.go
+++ b/kernel/model/heading.go
@@ -425,13 +425,13 @@ func Heading2Doc(srcHeadingID, targetBoxID, targetPath, previousPath string, toT
newTree.Box, newTree.Path = targetBoxID, newTargetPath
newTree.Root.SetIALAttr("updated", util.CurrentTimeSecondsStr())
newTree.Root.Spec = treenode.CurrentSpec
- if "" != previousPath {
- box.addSort(previousPath, newTree.ID)
- } else if toTop {
- box.addMinSort(path.Dir(newTargetPath), newTree.ID)
- } else {
- box.setSortByConf(path.Dir(newTargetPath), newTree.ID)
- }
+ if "" != previousPath {
+ box.addSort(previousPath, newTree.ID)
+ } else if toTop {
+ box.addMinSort(path.Dir(newTargetPath), newTree.ID)
+ } else {
+ box.setSortByConf(path.Dir(newTargetPath), newTree.ID)
+ }
if err = indexWriteTreeUpsertQueue(newTree); err != nil {
return "", "", err
}
diff --git a/kernel/model/listitem.go b/kernel/model/listitem.go
index a1f552f85e..92ae75d702 100644
--- a/kernel/model/listitem.go
+++ b/kernel/model/listitem.go
@@ -130,13 +130,13 @@ func ListItem2Doc(srcListItemID, targetBoxID, targetPath, previousPath string, t
newTree.Box, newTree.Path = targetBoxID, newTargetPath
newTree.Root.SetIALAttr("updated", util.CurrentTimeSecondsStr())
newTree.Root.Spec = treenode.CurrentSpec
- if "" != previousPath {
- box.addSort(previousPath, newTree.ID)
- } else if toTop {
- box.addMinSort(path.Dir(newTargetPath), newTree.ID)
- } else {
- box.setSortByConf(path.Dir(newTargetPath), newTree.ID)
- }
+ if "" != previousPath {
+ box.addSort(previousPath, newTree.ID)
+ } else if toTop {
+ box.addMinSort(path.Dir(newTargetPath), newTree.ID)
+ } else {
+ box.setSortByConf(path.Dir(newTargetPath), newTree.ID)
+ }
if err = indexWriteTreeUpsertQueue(newTree); err != nil {
return "", "", err
}