Skip to content

Commit ee8b57a

Browse files
committed
Ensure that when viewing code, once decoded the file will always show as ASCII. fix #297
1 parent c315c53 commit ee8b57a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

EspruinoTools

js/plugins/storage.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,11 @@
254254
});
255255
}
256256

257-
function showViewFileDialog(fileName, contents) {
257+
function showViewFileDialog(fileName, contents, wasDecoded) {
258258
console.log("View",fileName);
259259
var buttons = [{ name:"Ok", callback : function() { popup.close(); }}];
260260
var html;
261-
if (Espruino.Core.Utils.isASCII(contents)) {
261+
if (Espruino.Core.Utils.isASCII(contents) || wasDecoded) {
262262
html = '<div style="overflow-y:auto;font-family: monospace;">'+
263263
Espruino.Core.Utils.escapeHTML(contents).replace(/\n/g,"<br>")+'</div>';
264264
buttons.push({ name:"Copy to Editor", callback : function() {
@@ -278,7 +278,7 @@
278278
Espruino.Plugins.Pretokenise.isTokenised(contents)) {
279279
buttons.push({ name:"Decode JS", callback : function() {
280280
popup.close();
281-
showViewFileDialog(fileName, Espruino.Plugins.Pretokenise.untokenise(contents));
281+
showViewFileDialog(fileName, Espruino.Plugins.Pretokenise.untokenise(contents), true);
282282
}});
283283
}
284284
}

0 commit comments

Comments
 (0)