@@ -6,6 +6,27 @@ goog.require('Blockly.Blocks');
66goog . require ( 'Blockly.Colours' ) ;
77goog . require ( 'Blockly.ScratchBlocks.VerticalExtensions' ) ;
88
9+ const mutatorPopulateUtil2 = function ( connection , type , optValue , optValueName ) {
10+ if ( connection . sourceBlock_ . isInsertionMarker_ ) return ;
11+
12+ ScratchBlocks . Events . disable ( ) ;
13+ const block = this . workspace . newBlock ( type ) ;
14+ try {
15+ if ( optValue ) block . setFieldValue ( optValue , optValueName ) ;
16+ block . setShadow ( true ) ;
17+ if ( ! this . isInsertionMarker ( ) ) {
18+ block . initSvg ( ) ;
19+ block . render ( false ) ;
20+ }
21+ } finally {
22+ ScratchBlocks . Events . enable ( ) ;
23+ }
24+
25+ if ( ScratchBlocks . Events . isEnabled ( ) ) ScratchBlocks . Events . fire ( new ScratchBlocks . Events . BlockCreate ( block ) ) ;
26+ if ( block . outputConnection ) block . outputConnection . connect ( connection ) ;
27+ else block . previousConnection . connect ( connection ) ;
28+ }
29+
930Blockly . Blocks [ 'control_expandableIf' ] = {
1031 /**
1132 * pm: Block for joining strings together (determined by user)
@@ -38,7 +59,7 @@ Blockly.Blocks['control_expandableIf'] = {
3859 this . endsInElse = false ;
3960 } ,
4061
41- fillInBlock : mutatorPopulateUtil ,
62+ fillInBlock : mutatorPopulateUtil2 ,
4263 fixupButtons : function ( ) {
4364 const expandableInput = this . getInput ( "" ) ;
4465 this . inputList . splice ( this . inputList . indexOf ( expandableInput ) , 1 ) ;
0 commit comments