Check against healing child shadow blocks. Fix #2227 (PR#2271)

Merge from AnmAtAnm/fix2227-heal-shadows
This commit is contained in:
Andrew n marshall
2019-02-07 13:33:13 -08:00
committed by GitHub
2 changed files with 20 additions and 2 deletions

View File

@@ -379,7 +379,9 @@ Blockly.Block.prototype.unplugFromRow_ = function(opt_healStack) {
}
var thisConnection = this.getOnlyValueConnection_();
if (!thisConnection || !thisConnection.isConnected()) {
if (!thisConnection ||
!thisConnection.isConnected() ||
thisConnection.targetBlock().isShadow()) {
// Too many or too few possible connections on this block, or there's
// nothing on the other side of this connection.
return;
@@ -430,7 +432,7 @@ Blockly.Block.prototype.unplugFromStack_ = function(opt_healStack) {
this.previousConnection.disconnect();
}
var nextBlock = this.getNextBlock();
if (opt_healStack && nextBlock) {
if (opt_healStack && nextBlock && !nextBlock.isShadow()) {
// Disconnect the next statement.
var nextTarget = this.nextConnection.targetConnection;
nextTarget.disconnect();

View File

@@ -1123,6 +1123,22 @@ h1 {
</shadow>
</value>
</block>
<block type="text_print">
<value name="TEXT">
<shadow type="text">
<field name="TEXT">Shadow value</field>
</shadow>
</value>
<next>
<shadow type="text_print">
<value name="TEXT">
<shadow type="text">
<field name="TEXT">Shadow statement</field>
</shadow>
</value>
</shadow>
</next>
</block>
<label text="Multiple Variable Refs"></label>
<block type="text_print">
<value name="TEXT">