From 5a20678faa3858ac69ece7049cf824ce7b8f3db1 Mon Sep 17 00:00:00 2001 From: Gubolin Date: Fri, 8 Aug 2014 12:21:06 +0200 Subject: don't drop custom block definitions when changing the language (fix #557) --- gui.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gui.js b/gui.js index 6af9137..9d6d952 100644 --- a/gui.js +++ b/gui.js @@ -3440,6 +3440,12 @@ IDE_Morph.prototype.reflectLanguage = function (lang, callback) { projectData = this.serializer.serialize(this.stage); } } + this.world().children.forEach(function (morph) { + if (morph instanceof BlockEditorMorph) { + morph.updateDefinition(); // save custom blocks + // otherwise, initBlocks() will reset the definition + } + }); SpriteMorph.prototype.initBlocks(); this.spriteBar.tabBar.tabTo('scripts'); this.createCategories(); -- cgit v1.3.1 From e23a6ab4b3ebf0a4309a65ce615ffc010b383e4e Mon Sep 17 00:00:00 2001 From: Gubolin Date: Fri, 8 Aug 2014 16:46:31 +0200 Subject: correct 5a2067 (pasted code at the wrong position --- gui.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gui.js b/gui.js index 9d6d952..14beb6b 100644 --- a/gui.js +++ b/gui.js @@ -3429,6 +3429,12 @@ IDE_Morph.prototype.setLanguage = function (lang, callback) { IDE_Morph.prototype.reflectLanguage = function (lang, callback) { var projectData; SnapTranslator.language = lang; + this.world().children.forEach(function (morph) { + if (morph instanceof BlockEditorMorph) { + morph.updateDefinition(); // save custom blocks + // otherwise, initBlocks() will reset the definition + } + }); if (!this.loadNewProject) { if (Process.prototype.isCatchingErrors) { try { @@ -3440,12 +3446,6 @@ IDE_Morph.prototype.reflectLanguage = function (lang, callback) { projectData = this.serializer.serialize(this.stage); } } - this.world().children.forEach(function (morph) { - if (morph instanceof BlockEditorMorph) { - morph.updateDefinition(); // save custom blocks - // otherwise, initBlocks() will reset the definition - } - }); SpriteMorph.prototype.initBlocks(); this.spriteBar.tabBar.tabTo('scripts'); this.createCategories(); -- cgit v1.3.1