-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Calling block.setFieldValue without supplying the field name for the required second parameter results in the block's first unnamed field being set to the value of the first argument. For example, calling it on a built-in text_print block replaces print with whatever the new value that's passed is. Connected to this, calling block.getField or block.getFieldValue without supplying a name of the field (value) to get returns the block's first unnamed field (value).
To Reproduce
Steps to reproduce the behavior:
- Go to https://blockly-demo.appspot.com/static/tests/playground.html
- Drag in a
text_printblock. - Open the Developer console and type
Blockly.getMainWorkspace().getAllBlocks()[0].setFieldValue("Blockly") - See the text
printchange toBlockly.
Expected behavior
Throw an error when calling setFieldValue without specifying the name of the field to set and throw a warning or error when calling getField or getFieldValue without specifying the name of the field (of the value) to get.