mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-03 19:30:16 +01:00
🎨 Support exporting .sy.zip after selecting multiple documents https://github.com/siyuan-note/siyuan/issues/14484
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
315618a77c
commit
65532aec99
4 changed files with 51 additions and 20 deletions
|
|
@ -451,27 +451,24 @@ func ExportNotebookSY(id string) (zipPath string) {
|
|||
return
|
||||
}
|
||||
|
||||
func ExportSY(id string) (name, zipPath string) {
|
||||
block := treenode.GetBlockTree(id)
|
||||
if nil == block {
|
||||
logging.LogErrorf("not found block [%s]", id)
|
||||
return
|
||||
}
|
||||
|
||||
boxID := block.BoxID
|
||||
box := Conf.Box(boxID)
|
||||
func ExportSYs(ids []string) (zipPath string) {
|
||||
block := treenode.GetBlockTree(ids[0])
|
||||
box := Conf.Box(block.BoxID)
|
||||
baseFolderName := path.Base(block.HPath)
|
||||
if "." == baseFolderName {
|
||||
baseFolderName = path.Base(block.Path)
|
||||
}
|
||||
rootPath := block.Path
|
||||
docPaths := []string{rootPath}
|
||||
docFiles := box.ListFiles(strings.TrimSuffix(block.Path, ".sy"))
|
||||
for _, docFile := range docFiles {
|
||||
docPaths = append(docPaths, docFile.path)
|
||||
|
||||
var docPaths []string
|
||||
bts := treenode.GetBlockTrees(ids)
|
||||
for _, bt := range bts {
|
||||
docPaths = append(docPaths, bt.Path)
|
||||
docFiles := box.ListFiles(strings.TrimSuffix(bt.Path, ".sy"))
|
||||
for _, docFile := range docFiles {
|
||||
docPaths = append(docPaths, docFile.path)
|
||||
}
|
||||
}
|
||||
zipPath = exportSYZip(boxID, path.Dir(rootPath), baseFolderName, docPaths)
|
||||
name = util.GetTreeID(block.Path)
|
||||
zipPath = exportSYZip(block.BoxID, path.Dir(block.Path), baseFolderName, docPaths)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue