@@ -1237,23 +1237,6 @@ class Blocks {
12371237 if ( block . mutation ) {
12381238 xmlString += this . mutationToXML ( block . mutation ) ;
12391239 }
1240- // Add any inputs on this block.
1241- for ( const input in block . inputs ) {
1242- if ( ! Object . prototype . hasOwnProperty . call ( block . inputs , input ) ) continue ;
1243- const blockInput = block . inputs [ input ] ;
1244- // Only encode a value tag if the value input is occupied.
1245- if ( blockInput . block || blockInput . shadow ) {
1246- xmlString += `<value name="${ xmlEscape ( blockInput . name ) } ">` ;
1247- if ( blockInput . block ) {
1248- xmlString += this . blockToXML ( blockInput . block , comments ) ;
1249- }
1250- if ( blockInput . shadow && blockInput . shadow !== blockInput . block ) {
1251- // Obscured shadow.
1252- xmlString += this . blockToXML ( blockInput . shadow , comments ) ;
1253- }
1254- xmlString += '</value>' ;
1255- }
1256- }
12571240 // Add any fields on this block.
12581241 for ( const field in block . fields ) {
12591242 if ( ! Object . prototype . hasOwnProperty . call ( block . fields , field ) ) continue ;
@@ -1273,6 +1256,23 @@ class Blocks {
12731256 }
12741257 xmlString += `>${ value } </field>` ;
12751258 }
1259+ // Add any inputs on this block.
1260+ for ( const input in block . inputs ) {
1261+ if ( ! Object . prototype . hasOwnProperty . call ( block . inputs , input ) ) continue ;
1262+ const blockInput = block . inputs [ input ] ;
1263+ // Only encode a value tag if the value input is occupied.
1264+ if ( blockInput . block || blockInput . shadow ) {
1265+ xmlString += `<value name="${ xmlEscape ( blockInput . name ) } ">` ;
1266+ if ( blockInput . block ) {
1267+ xmlString += this . blockToXML ( blockInput . block , comments ) ;
1268+ }
1269+ if ( blockInput . shadow && blockInput . shadow !== blockInput . block ) {
1270+ // Obscured shadow.
1271+ xmlString += this . blockToXML ( blockInput . shadow , comments ) ;
1272+ }
1273+ xmlString += '</value>' ;
1274+ }
1275+ }
12761276 // Add blocks connected to the next connection.
12771277 if ( block . next ) {
12781278 xmlString += `<next>${ this . blockToXML ( block . next , comments ) } </next>` ;
0 commit comments