Merge pull request #2338 from bromagosa/allow-importing-custom-block-scripts

Allow loading downloaded scripts that contain custom blocks
pull/89/head
Jens Mönig 2019-02-22 18:05:58 +01:00 zatwierdzone przez GitHub
commit 8c13fddd3a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -1085,6 +1085,14 @@ SnapSerializer.prototype.loadScript = function (model, object) {
// private
var topBlock, block, nextBlock,
myself = this;
// Check whether we're importing a single script, not a script as part of a
// whole project
if (!this.project.stage) {
this.project.stage = object.parentThatIsA(StageMorph);
this.project.targetStage = this.project.stage;
}
model.children.forEach(function (child) {
nextBlock = myself.loadBlock(child, false, object);
if (!nextBlock) {
@ -1122,6 +1130,7 @@ SnapSerializer.prototype.loadBlock = function (model, isReporter, object) {
// private
var block, info, inputs, isGlobal, receiver, migration,
migrationOffset = 0;
if (model.tag === 'block') {
if (Object.prototype.hasOwnProperty.call(
model.attributes,