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;
|
||||
|
||||
// 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);
|
||||
|
|
|
@ -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
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
Ładowanie…
Reference in New Issue