mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 23:38:49 +01:00
🎨 改进文档树拖拽形成子文档时的层级校验 Fix https://github.com/siyuan-note/siyuan/issues/6434
This commit is contained in:
parent
beb5005125
commit
f988805c93
2 changed files with 27 additions and 5 deletions
|
|
@ -992,11 +992,6 @@ func MoveDoc(fromBoxID, fromPath, toBoxID, toPath string) (newPath string, err e
|
|||
return
|
||||
}
|
||||
|
||||
if depth := strings.Count(toPath, "/"); 6 < depth && !Conf.FileTree.AllowCreateDeeper {
|
||||
err = errors.New(Conf.Language(118))
|
||||
return
|
||||
}
|
||||
|
||||
fromDir := strings.TrimSuffix(fromPath, ".sy")
|
||||
if strings.HasPrefix(toPath, fromDir) {
|
||||
err = errors.New(Conf.Language(87))
|
||||
|
|
@ -1016,6 +1011,12 @@ func MoveDoc(fromBoxID, fromPath, toBoxID, toPath string) (newPath string, err e
|
|||
return
|
||||
}
|
||||
|
||||
childDepth := util.GetChildDocDepth(filepath.Join(util.DataDir, fromBoxID, fromPath))
|
||||
if depth := strings.Count(toPath, "/") + childDepth; 6 < depth && !Conf.FileTree.AllowCreateDeeper {
|
||||
err = errors.New(Conf.Language(118))
|
||||
return
|
||||
}
|
||||
|
||||
toBox := Conf.Box(toBoxID)
|
||||
if nil == toBox {
|
||||
err = errors.New(Conf.Language(0))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue