diff --git a/core/block.js b/core/block.js index 1e50a9940..721a9e459 100644 --- a/core/block.js +++ b/core/block.js @@ -808,16 +808,20 @@ Blockly.Block.prototype.setCollapsed = function(collapsed) { */ Blockly.Block.prototype.toString = function(opt_maxLength) { var text = []; - for (var i = 0, input; input = this.inputList[i]; i++) { - for (var j = 0, field; field = input.fieldRow[j]; j++) { - text.push(field.getText()); - } - if (input.connection) { - var child = input.connection.targetBlock(); - if (child) { - text.push(child.toString()); - } else { - text.push('?'); + if(this.collapsed_) { + text.push(this.getInput('_TEMP_COLLAPSED_INPUT').fieldRow[0].text_); + } else { + for (var i = 0, input; input = this.inputList[i]; i++) { + for (var j = 0, field; field = input.fieldRow[j]; j++) { + text.push(field.getText()); + } + if (input.connection) { + var child = input.connection.targetBlock(); + if (child) { + text.push(child.toString()); + } else { + text.push('?'); + } } } } diff --git a/core/block_svg.js b/core/block_svg.js index 404e1f589..420239bb3 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -325,7 +325,6 @@ Blockly.BlockSvg.prototype.setCollapsed = function(collapsed) { if (this.collapsed_ == collapsed) { return; } - Blockly.BlockSvg.superClass_.setCollapsed.call(this, collapsed); var renderList = []; // Show/hide the inputs. for (var x = 0, input; input = this.inputList[x]; x++) { @@ -343,6 +342,7 @@ Blockly.BlockSvg.prototype.setCollapsed = function(collapsed) { } else { this.removeInput(COLLAPSED_INPUT_NAME); } + Blockly.BlockSvg.superClass_.setCollapsed.call(this, collapsed); if (!renderList.length) { // No child blocks, just render this block.