kopia lustrzana https://github.com/backface/turtlestitch
Fix some bugs in exporting a variable to a file.
rodzic
9490b65270
commit
d004543a32
7
gui.js
7
gui.js
|
@ -3654,7 +3654,9 @@ IDE_Morph.prototype.saveFileAs = function (
|
||||||
dataURI, dialog;
|
dataURI, dialog;
|
||||||
|
|
||||||
// fileType is a <kind>/<ext>;<charset> format.
|
// 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
|
// This is a workaround for a known Chrome crash with large URLs
|
||||||
function exhibitsChomeBug(contents) {
|
function exhibitsChomeBug(contents) {
|
||||||
|
@ -3690,8 +3692,7 @@ IDE_Morph.prototype.saveFileAs = function (
|
||||||
blobIsSupported = !!new Blob;
|
blobIsSupported = !!new Blob;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
if (false) {
|
if (newWindow) {
|
||||||
//if (newWindow) {
|
|
||||||
// Blob URIs need a custom URL to be displayed in a new window
|
// Blob URIs need a custom URL to be displayed in a new window
|
||||||
if (contents instanceof Blob) {
|
if (contents instanceof Blob) {
|
||||||
dataURI = URL.createObjectURL(contents);
|
dataURI = URL.createObjectURL(contents);
|
||||||
|
|
|
@ -7625,12 +7625,11 @@ WatcherMorph.prototype.userMenu = function () {
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
'export...',
|
'export...',
|
||||||
function () {
|
function () {
|
||||||
|
var ide = myself.parentThatIsA(IDE_Morph);
|
||||||
ide.saveFileAs(
|
ide.saveFileAs(
|
||||||
this.currentValue.toString(),
|
myself.currentValue.toString(),
|
||||||
'text/plain;charset=utf-8',
|
'text/plain;charset=utf-8',
|
||||||
// TODO: Name!
|
myself.getter // variable name
|
||||||
'variable',
|
|
||||||
false
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Ładowanie…
Reference in New Issue