Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #19 from leaphy-robotics/development
Browse files Browse the repository at this point in the history
Fix issue num #18
  • Loading branch information
koen1711 authored Aug 10, 2023
2 parents 47c5f05 + d0aa6e6 commit 9d43cb5
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions src/app/effects/backend.wired.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,32 @@ export class BackendWiredEffects {
});

fileNamesDialogRef.afterClosed().subscribe((name: string) => {
const data = this.blocklyEditorState.workspaceXml;
const blob = new Blob([data], {type: 'text/plain'});
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = name + '.ino';

a.click();
window.URL.revokeObjectURL(url);
// delete a after it is clicked
a.remove();
console.log(this.appState.getCurrentEditor())
if (this.appState.getCurrentEditor() == CodeEditorType.Beginner) {
const data = this.blocklyEditorState.workspaceXml;
const blob = new Blob([data], {type: 'text/plain'});
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = name + '.leaphy';

a.click();
window.URL.revokeObjectURL(url);
// delete a after it is clicked
a.remove();
} else {
const data = this.blocklyEditorState.code;
const blob = new Blob([data], {type: 'text/plain'});
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = name + '.ino';

a.click();
window.URL.revokeObjectURL(url);
// delete a after it is clicked
a.remove();
}
})
break;
case 'compile':
Expand Down

0 comments on commit 9d43cb5

Please sign in to comment.