made block vars transient for block libraries

upd4.1
Jens Mönig 2017-10-04 16:23:41 +02:00
rodzic 385ca6f891
commit bbc16d1328
3 zmienionych plików z 12 dodań i 5 usunięć

Wyświetl plik

@ -108,7 +108,7 @@ BooleanSlotMorph, XML_Serializer*/
// Global stuff ////////////////////////////////////////////////////////
modules.byob = '2017-September-26';
modules.byob = '2017-October-04';
// Declarations
@ -3755,7 +3755,7 @@ BlockExportDialogMorph.prototype.selectNone = function () {
// BlockExportDialogMorph ops
BlockExportDialogMorph.prototype.exportBlocks = function () {
var str = this.serializer.serialize(this.blocks),
var str = this.serializer.serialize(this.blocks, true), // for library
ide = this.world().children[0];
if (this.blocks.length > 0) {

Wyświetl plik

@ -3676,6 +3676,7 @@ Fixes:
171004
------
* Objects: limited sprites' direction and coordinates to finite numbers
* Store, BYOB: made block vars transient for block libraries
v4.1 Features:
@ -3726,3 +3727,4 @@ Fixes:
* fixed occasional empty drop-down menu items named “close”
* fixed some typos
* limited sprites' direction and coordinates to finite numbers
* made block vars transient for block libraries

Wyświetl plik

@ -61,7 +61,7 @@ normalizeCanvas, contains*/
// Global stuff ////////////////////////////////////////////////////////
modules.store = '2017-September-28';
modules.store = '2017-October-04';
// XML_Serializer ///////////////////////////////////////////////////////
@ -79,6 +79,7 @@ function XML_Serializer() {
this.contents = [];
this.media = [];
this.isCollectingMedia = false;
this.isExportingBlocksLibrary = false;
}
// XML_Serializer preferences settings:
@ -90,11 +91,12 @@ XML_Serializer.prototype.version = 1; // increment on structural change
// XML_Serializer accessing:
XML_Serializer.prototype.serialize = function (object) {
XML_Serializer.prototype.serialize = function (object, forBlocksLibrary) {
// public: answer an XML string representing the given object
var xml;
this.flush(); // in case an error occurred in an earlier attempt
this.flushMedia();
this.isExportingBlocksLibrary = forBlocksLibrary;
xml = this.store(object);
this.flush();
return xml;
@ -187,6 +189,7 @@ XML_Serializer.prototype.flushMedia = function () {
});
}
this.media = [];
this.isExportingBlocksLibrary = false;
};
// XML_Serializer formatting:
@ -1925,7 +1928,9 @@ CustomCommandBlockMorph.prototype.toBlockXML = function (serializer) {
this.isGlobal ?
'' : serializer.format(' scope="@"', scope),
serializer.store(this.inputs()),
this.isGlobal && this.definition.variableNames.length ?
this.isGlobal &&
this.definition.variableNames.length &&
!serializer.isExportingBlocksLibrary ?
'<variables>' +
this.variables.toXML(serializer) +
'</variables>'