Skip to content

Commit

Permalink
Do not show return block if no custom blocks exist
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Jul 11, 2023
1 parent bdf1873 commit 9e6acb5
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions core/procedures.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,21 @@ Blockly.Procedures.flyoutCategory = function(workspace) {
xmlList.push(block);
}

var returnBlock = goog.dom.createDom('block');
returnBlock.setAttribute('type', 'procedures_return');
returnBlock.setAttribute('gap', 16);
var returnBlockValue = goog.dom.createDom('value');
returnBlockValue.setAttribute('name', 'VALUE');
var returnBlockShadow = goog.dom.createDom('shadow');
returnBlockShadow.setAttribute('type', 'text');
var returnBlockField = goog.dom.createDom('field');
returnBlockField.setAttribute('name', 'TEXT');
returnBlockShadow.appendChild(returnBlockField);
returnBlockValue.appendChild(returnBlockShadow);
returnBlock.appendChild(returnBlockValue);
xmlList.push(returnBlock);
if (mutations.length > 0) {
var returnBlock = goog.dom.createDom('block');
returnBlock.setAttribute('type', 'procedures_return');
returnBlock.setAttribute('gap', 16);
var returnBlockValue = goog.dom.createDom('value');
returnBlockValue.setAttribute('name', 'VALUE');
var returnBlockShadow = goog.dom.createDom('shadow');
returnBlockShadow.setAttribute('type', 'text');
var returnBlockField = goog.dom.createDom('field');
returnBlockField.setAttribute('name', 'TEXT');
returnBlockShadow.appendChild(returnBlockField);
returnBlockValue.appendChild(returnBlockShadow);
returnBlock.appendChild(returnBlockValue);
xmlList.push(returnBlock);
}

return xmlList;
};
Expand Down

0 comments on commit 9e6acb5

Please sign in to comment.