Fix some bugs in exporting a variable to a file.

dev
Michael Ball 2015-12-01 02:16:34 -08:00
rodzic 9490b65270
commit d004543a32
2 zmienionych plików z 7 dodań i 7 usunięć

7
gui.js
Wyświetl plik

@ -3654,7 +3654,9 @@ IDE_Morph.prototype.saveFileAs = function (
dataURI, dialog;
// fileType is a <kind>/<ext>;<charset> format.
fileExt = '.' + fileType.split('/')[1].split(';')[0];
fileExt = fileType.split('/')[1].split(';')[0];
// handle text/plain as a .txt file
fileExt = '.' + (fileExt === 'plain' ? 'txt' : fileExt);
// This is a workaround for a known Chrome crash with large URLs
function exhibitsChomeBug(contents) {
@ -3690,8 +3692,7 @@ IDE_Morph.prototype.saveFileAs = function (
blobIsSupported = !!new Blob;
} catch (e) {}
if (false) {
//if (newWindow) {
if (newWindow) {
// Blob URIs need a custom URL to be displayed in a new window
if (contents instanceof Blob) {
dataURI = URL.createObjectURL(contents);

Wyświetl plik

@ -7625,12 +7625,11 @@ WatcherMorph.prototype.userMenu = function () {
menu.addItem(
'export...',
function () {
var ide = myself.parentThatIsA(IDE_Morph);
ide.saveFileAs(
this.currentValue.toString(),
myself.currentValue.toString(),
'text/plain;charset=utf-8',
// TODO: Name!
'variable',
false
myself.getter // variable name
);
}
);