Hi, this question is regarding the workspace-multiselect plugin used in the Blockly workspace of App Inventor.
- How do I get notified after the blocks have been selected? I need a JS listener to know when this happens.
- Then, how do you query for the selected blocks?
1 Like
The standard Blockly selection event will fire, so just add an event listener on the workspace. The multiselect plugin has a field called dragSelectionWeakMap that contains a mapping of workspace ID to the set of selected blocks. However, I don't think this is exposed publicly in any way. We'd probably need a patch to the plugin to expose a function that could get the current selection, and then save the reference to the plugin so it could be called, or least expose it on some other namespace like the AI2 namespace.