diff --git a/src/js/core/Utils.js b/src/js/core/Utils.js index 9ef0b2b1..abee0c50 100755 --- a/src/js/core/Utils.js +++ b/src/js/core/Utils.js @@ -1028,20 +1028,43 @@ var Utils = { }; var formatFile = function(file, i) { + var blob = new Blob( + [new Uint8Array(file.bytes)], + {type: "octet/stream"} + ); + var blobUrl = window.URL.createObjectURL(blob); + + var downloadAnchorElem = $("") + .html("\u21B4") + .attr("href", blobUrl) + .attr("title", "Download '" + file.fileName + "'") + .attr("download", file.fileName); + + var expandFileContentsElem = $("") + .html("🔍") + .addClass("collapsed") + .attr("data-toggle", "collapse") + .attr("aria-expanded", "true") + .attr("aria-controls", "collapse" + i) + .attr("href", "#collapse" + i) + .attr("title", "Show/hide contents of '" + file.fileName + "'"); + var html = "