[Google Blockly] Only register toolbox callback if we're using the modal function editor #48896
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now that we have deleted the unwanted "return" blocks from Sprite Lab - and therefore from Poetry as well (#48895), we can do the same for Dance.
With these blocks deleted in all current/upcoming Google Blockly labs, we can now move some things around related to the toolbox category callback. (Required context: #48545)
Previously, we were using the callback function
getFunctionsFlyoutBlocks
to customize the blocks that would appear in the auto-populated Functions category. The main difference between our callback and the standard Google Blockly callback (https://github.com/google/blockly/blob/5a23c84e6ef9c0b2bbd503ad9f58fa86db1232a8/core/procedures.ts#L202-L287) was that we were not including "return" blocks. With these deleted, we no longer need to override this call back at all, unless Blockly is going to use the modal function editor.Fortunately, this previous work wasn't at all a waste of time, because we will still need most of it for the modal function editor.
We already pass in
useModalFunctionEditor
as an option when we inject Blockly, but so far we haven't been using that information for anything. (In fact, we've updated Poetry and Dance levels to no longer allow setting this property to true, for now.)I think we can actually use this work to set up some a useful starting point for overriding this category once we do have a modal editor hooked up. We will not use the definition block (
procedures_defnoreturn
) in these toolboxes, instead replacing it with an orange "Create a Function" button. This is what we are eventually aiming for:I'm not including screenshots for this PR because there are no visible differences anywhere.
Next steps in the modal editor journey:
Fortunately, none of this is needed any more for the Dance Party flip, but we have a little head start! :)
Links
Testing story
Deployment strategy
Follow-up work
Privacy
Security
Caching
PR Checklist: