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