fix: dont add comments to full block fields by maribethb · Pull Request #9263 · RaspberryPiFoundation/blockly
The basics
The details
Resolves
Fixes #9260
Proposed Changes
- Modifies precondition for "add comment" context menu option to hide the option if the block is a simple reporter block with a full-block field. If the block already has a comment, the option is shown so that it can be removed.
- Also fixed the type of the
getFieldsgenerator so thatnext().valuewould be typed correctly asField | undefinedinstead ofany
Reason for Changes
You can't interact with the comment icon on full-block fields.
Test Coverage
- Drag a math_number block to the advanced playground in geras renderer
- Add a comment to it with context menu
- Change renderer to zelos
- You can remove the comment with context menu
- Now you can no longer add a comment with context menu
Documentation
Additional Information
| @@ -365,7 +371,11 @@ export function registerComment() { | |||
| !block!.isInFlyout && | |||
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're here, mind adding a block && condition at the beginning and then dropping the non-null assertions on all the remaining conditions?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call, done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters