🎨 文档树支持 Ctrl+ClickShift+↑/↓ 进行多选 https://github.com/siyuan-note/siyuan/issues/1359

This commit is contained in:
Liang Ding 2022-11-05 10:23:23 +08:00
parent 02a912aba0
commit db414990aa
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 1 additions and 13 deletions

View file

@ -1012,12 +1012,7 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string) (err error) {
return return
} }
if "/" == toPath { fromPaths = util.FilterSelfChildDocs(fromPaths)
// 移动到根目录下时不需要根据目标路径去重,所以这里传入一个不可能存在的随机笔记本名称
fromPaths = util.FilterMoveDocFromPaths(fromPaths, ast.NewNodeID())
} else {
fromPaths = util.FilterMoveDocFromPaths(fromPaths, toPath)
}
pathsBoxes := getBoxesByPaths(fromPaths) pathsBoxes := getBoxesByPaths(fromPaths)
// 检查路径深度是否超过限制 // 检查路径深度是否超过限制

View file

@ -175,13 +175,6 @@ func NormalizeEndpoint(endpoint string) string {
return endpoint 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) { func FilterSelfChildDocs(paths []string) (ret []string) {
sort.Slice(paths, func(i, j int) bool { return strings.Count(paths[i], "/") < strings.Count(paths[j], "/") }) sort.Slice(paths, func(i, j int) bool { return strings.Count(paths[i], "/") < strings.Count(paths[j], "/") })