1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

All: Fixes #597: Also import sub-notebooks when importing JEX data

This commit is contained in:
Laurent Cozic
2018-06-10 19:15:40 +01:00
parent 0d9f703c75
commit ab9675544c
4 changed files with 89 additions and 16 deletions

View File

@@ -157,7 +157,7 @@ class InteropService {
async export(options) {
const exportPath = options.path ? options.path : null;
const sourceFolderIds = options.sourceFolderIds ? options.sourceFolderIds : [];
let sourceFolderIds = options.sourceFolderIds ? options.sourceFolderIds : [];
const sourceNoteIds = options.sourceNoteIds ? options.sourceNoteIds : [];
const exportFormat = options.format ? options.format : 'jex';
const result = { warnings: [] }
@@ -174,6 +174,14 @@ class InteropService {
let resourceIds = [];
const folderIds = await Folder.allIds();
let fullSourceFolderIds = sourceFolderIds.slice();
for (let i = 0; i < sourceFolderIds.length; i++) {
const id = sourceFolderIds[i];
const childrenIds = await Folder.childrenIds(id);
fullSourceFolderIds = fullSourceFolderIds.concat(childrenIds);
}
sourceFolderIds = fullSourceFolderIds;
for (let folderIndex = 0; folderIndex < folderIds.length; folderIndex++) {
const folderId = folderIds[folderIndex];
if (sourceFolderIds.length && sourceFolderIds.indexOf(folderId) < 0) continue;