mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-12 15:11:10 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
df2d99f152
@ -282,8 +282,9 @@ func moveDocs(c *gin.Context) {
|
|||||||
fromPaths = append(fromPaths, fromPath.(string))
|
fromPaths = append(fromPaths, fromPath.(string))
|
||||||
}
|
}
|
||||||
toPath := arg["toPath"].(string)
|
toPath := arg["toPath"].(string)
|
||||||
|
toNotebook := arg["toNotebook"].(string)
|
||||||
|
|
||||||
err := model.MoveDocs(fromPaths, toPath)
|
err := model.MoveDocs(fromPaths, toNotebook, toPath)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
ret.Code = -1
|
ret.Code = -1
|
||||||
ret.Msg = err.Error()
|
ret.Msg = err.Error()
|
||||||
|
@ -1027,21 +1027,19 @@ func MoveDoc(fromBoxID, fromPath, toBoxID, toPath string) (newPath string, err e
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func MoveDocs(fromPaths []string, toPath string) (err error) {
|
func MoveDocs(fromPaths []string, toBoxID, toPath string) (err error) {
|
||||||
toID := strings.TrimSuffix(path.Base(toPath), ".sy")
|
toBox := Conf.Box(toBoxID)
|
||||||
toBlock := treenode.GetBlockTree(toID)
|
|
||||||
if nil == toBlock {
|
|
||||||
err = ErrBlockNotFound
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
toBox := Conf.Box(toBlock.BoxID)
|
|
||||||
if nil == toBox {
|
if nil == toBox {
|
||||||
err = errors.New(Conf.Language(0))
|
err = errors.New(Conf.Language(0))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fromPaths = util.FilterMoveDocFromPaths(fromPaths, toPath)
|
if "/" == toPath {
|
||||||
|
// 移动到根目录下时不需要根据目标路径去重,所以这里传入一个不可能存在的随机笔记本名称
|
||||||
|
fromPaths = util.FilterMoveDocFromPaths(fromPaths, ast.NewNodeID())
|
||||||
|
} else {
|
||||||
|
fromPaths = util.FilterMoveDocFromPaths(fromPaths, toPath)
|
||||||
|
}
|
||||||
pathsBoxes := getBoxesByPaths(fromPaths)
|
pathsBoxes := getBoxesByPaths(fromPaths)
|
||||||
needShowProgress := 32 < len(fromPaths)
|
needShowProgress := 32 < len(fromPaths)
|
||||||
if needShowProgress {
|
if needShowProgress {
|
||||||
|
Loading…
Reference in New Issue
Block a user