Skip to content

Commit

Permalink
v1.2.1 tree download 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
woochanleee committed Apr 9, 2021
1 parent 42f5279 commit 2107c6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export function Editor() {
const folders = [zip.folder(rootText)];

treeContents.forEach((content, index) => {
if (index !== 0) return;
if (content.depth < treeContents[index - 1]?.depth) {
folders.pop();

Expand All @@ -244,15 +245,14 @@ export function Editor() {
}
}

if (content.text.indexOf('.') >= 1) {
if (content.text.indexOf('.') >= 0) {
folders[folders.length - 1]?.file(content.text, '');
} else {
folders.push(folders[folders.length - 1]?.folder(content.text) ?? null);
}
});

zip.generateAsync({ type: 'blob' }).then(function (content) {
// see FileSaver.js
saveAs(content, 'project-tree.zip');
});
}, [treeContents]);
Expand Down

0 comments on commit 2107c6d

Please sign in to comment.