Use anchor element to export the selected hanging protocol instead of using saveAs function of jszip library

This commit is contained in:
Evren Ozkan 2017-01-04 19:06:58 -05:00
parent 77182d1916
commit dfbd63fcb7
2 changed files with 5 additions and 1 deletions

View File

@ -120,6 +120,7 @@
<p class="lastSavedText">Last saved {{jsDateFromNow modifiedDate}}</p>
{{/if}}
</div>
<a id="downloadElement" style="display:none;"></a>
{{/with}}
</div>
</template>

View File

@ -321,7 +321,10 @@ Template.protocolEditor.events({
filename = selectedProtocol.name + '-' + (currentDate.getTime().toString()) + '.json',
protocolBlob = new Blob([protocolJSON], { type: 'application/json' });
saveAs(protocolBlob, filename);
var downloadElement = document.getElementById('downloadElement');
downloadElement.href = URL.createObjectURL(protocolBlob);
downloadElement.download = filename;
downloadElement.click();
},
/**
* Delete the currently selected Protocol