Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions webapp/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2286,17 +2286,24 @@ export class ProjectView
const header = mainPkg.header;
if (!header?.tutorial?.templateCode) return;

if (keepAssets) {
// Convert all temporary assets to named assets before we load in the template
let currentText = await workspace.getTextAsync(header.id);
const imageJres = appendTemporaryAssets(currentText[pxt.MAIN_BLOCKS], currentText[pxt.IMAGES_JRES]);
pkg.mainEditorPkg().setFile(pxt.IMAGES_JRES, imageJres);
await mainPkg.saveFilesAsync();
}
try {
core.showLoading("reset-tutorial", lf("Replacing tutorial code..."));

if (keepAssets) {
// Convert all temporary assets to named assets before we load in the template
let currentText = await workspace.getTextAsync(header.id);
const imageJres = appendTemporaryAssets(currentText[pxt.MAIN_BLOCKS], currentText[pxt.IMAGES_JRES]);
pkg.mainEditorPkg().setFile(pxt.IMAGES_JRES, imageJres);
await mainPkg.saveFilesAsync();
}

header.tutorial.templateLoaded = false;
delete header.tutorial.mergeHeaderId;
await this.reloadHeaderAsync();
header.tutorial.templateLoaded = false;
delete header.tutorial.mergeHeaderId;
await this.reloadHeaderAsync();
}
finally {
core.hideLoading("reset-tutorial");
}
}

removeProject() {
Expand Down
Loading