mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-07 17:28:50 +01:00
🎨 Improve move doc https://github.com/siyuan-note/siyuan/issues/9356
This commit is contained in:
parent
84c801bbc9
commit
9e731908e2
1 changed files with 23 additions and 2 deletions
|
|
@ -1257,8 +1257,12 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string, callback interface{})
|
|||
}
|
||||
}
|
||||
|
||||
// A progress layer appears when moving more than 16 documents at once https://github.com/siyuan-note/siyuan/issues/9356
|
||||
needShowProgress := 16 < len(fromPaths)
|
||||
// A progress layer appears when moving more than 64 documents at once https://github.com/siyuan-note/siyuan/issues/9356
|
||||
subDocsCount := 0
|
||||
for fromPath, fromBox := range pathsBoxes {
|
||||
subDocsCount += countSubDocs(fromBox.ID, fromPath)
|
||||
}
|
||||
needShowProgress := 64 < subDocsCount
|
||||
if needShowProgress {
|
||||
defer util.PushClearProgress()
|
||||
}
|
||||
|
|
@ -1282,6 +1286,23 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string, callback interface{})
|
|||
return
|
||||
}
|
||||
|
||||
func countSubDocs(box, p string) (ret int) {
|
||||
p = strings.TrimSuffix(p, ".sy")
|
||||
_ = filepath.Walk(filepath.Join(util.DataDir, box, p), func(path string, info os.FileInfo, err error) error {
|
||||
if nil != err {
|
||||
return err
|
||||
}
|
||||
if info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
if strings.HasSuffix(path, ".sy") {
|
||||
ret++
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func moveDoc(fromBox *Box, fromPath string, toBox *Box, toPath string, luteEngine *lute.Lute, callback interface{}) (newPath string, err error) {
|
||||
isSameBox := fromBox.ID == toBox.ID
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue