Skip to content

Commit

Permalink
Add descriptive project names for exporting
Browse files Browse the repository at this point in the history
  • Loading branch information
terryzfeng committed Sep 10, 2024
1 parent a08337b commit 8940626
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/services/export/exportChuck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function exportProjectFiles() {
// Create invisible download link
const downloadLink = document.createElement("a");
downloadLink.href = zipURL;
downloadLink.download = "project.zip";
downloadLink.download = `${ProjectSystem.activeFile.getFilename().split('.')[0]} Project.zip`;

Check failure on line 57 in src/services/export/exportChuck.ts

View workflow job for this annotation

GitHub Actions / build

Strings must use doublequote

Check failure on line 57 in src/services/export/exportChuck.ts

View workflow job for this annotation

GitHub Actions / build

Strings must use doublequote
downloadLink.click();
});
}
9 changes: 5 additions & 4 deletions src/services/export/exportWebchuck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async function exportWebchuck(
if (projectFilesToPreload.length === 0) {
exportSingleWCFile(wc_html);
} else {
exportProjectWCFiles(wc_html, projectFilesToPreload);
exportProjectWCFiles(title, wc_html, projectFilesToPreload);
}
}

Expand All @@ -135,9 +135,10 @@ function exportSingleWCFile(wc_html: Document) {
* Export all project files as a .zip
* @param wc_html webchuck html document
*/
function exportProjectWCFiles(wc_html: Document, projectFiles: any) {
function exportProjectWCFiles(title: string, wc_html: Document, projectFiles: any) {
const zip = new JSZip();
zip.file("index.html", wc_html.documentElement.outerHTML);
console.log(projectFiles);
projectFiles.forEach((file: any) => {
zip.file(file.getFilename(), file.getData());
});
Expand All @@ -147,8 +148,8 @@ function exportProjectWCFiles(wc_html: Document, projectFiles: any) {
// Create invisible download link
const downloadLink = document.createElement("a");
downloadLink.href = zipURL;
downloadLink.download = "project.zip";
downloadLink.click();
downloadLink.download = `${title} Project.zip`;
// downloadLink.click();
});
}

Expand Down

0 comments on commit 8940626

Please sign in to comment.