diff --git a/core/block.js b/core/block.js index 946f19200..cab5a0fb7 100644 --- a/core/block.js +++ b/core/block.js @@ -807,16 +807,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 dd793a4dc..460788a0b 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -293,7 +293,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++) { @@ -311,6 +310,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.