Skip to content

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

:art: 文档树支持 `Ctrl+Click` 和 `Shift+↑/↓` 进行多选 https://github.com/siyuan-note/siyuan/issues/1359

Liang Dingdb414990aa98
diff --git a/kernel/model/file.go b/kernel/model/file.go
index 6b87d9c0b1..33773fb2f5 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -1012,12 +1012,7 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string) (err error) {
return
}
- if "/" == toPath {
- // 移动到根目录下时不需要根据目标路径去重,所以这里传入一个不可能存在的随机笔记本名称
- fromPaths = util.FilterMoveDocFromPaths(fromPaths, ast.NewNodeID())
- } else {
- fromPaths = util.FilterMoveDocFromPaths(fromPaths, toPath)
- }
+ fromPaths = util.FilterSelfChildDocs(fromPaths)
pathsBoxes := getBoxesByPaths(fromPaths)
// 检查路径深度是否超过限制
diff --git a/kernel/util/path.go b/kernel/util/path.go
index 2c82e3cea3..722018f752 100644
--- a/kernel/util/path.go
+++ b/kernel/util/path.go
@@ -175,13 +175,6 @@ func NormalizeEndpoint(endpoint string) string {
return endpoint
}
-func FilterMoveDocFromPaths(fromPaths []string, toPath string) (retFromPaths []string) {
- fromPaths = append(fromPaths, toPath)
- retFromPaths = FilterSelfChildDocs(fromPaths)
- retFromPaths = gulu.Str.ExcludeElem(retFromPaths, []string{toPath})
- return
-}
-
func FilterSelfChildDocs(paths []string) (ret []string) {
sort.Slice(paths, func(i, j int) bool { return strings.Count(paths[i], "/") < strings.Count(paths[j], "/") })