I'm working on adding a custom context menu to a specific shadow block, but the issue I'm facing is that the menu that appears is always the parent block's menu.
My use case involves dynamically adding and removing these shadow blocks from this parent block via some buttons. I want to provide an extra option to remove a specific block from the middle using the context menu. These blocks need to remain as shadow blocks, so they can't be removed from the input. Does anyone have a workaround? I've ran out of ideas and I wanted to avoid patching the gesture class.
I'm working on recreating a function block (image attached) using the new version of Blockly, where users can dynamically add or remove multiple shadow argument blocks. However, most blocks cannot connect in this setup, with a few exceptions. I also implemented a custom dragging strategy that allows new argument blocks to be created by dragging shadow argument blocks.
Now, I want to enhance the shadow blocks by adding a context menu that allows users to edit or remove the selected block. I experimented with making the argument blocks non-movable instead of using shadow blocks, but this approach didn’t work with the dragging strategy.
I think this is the case: "We normally only expect developers to use shadow blocks in situations where there will be a single block attached to a single input, and typically the attached block is a simple reporter (block with just one field, one output, and nothing else)."I'm working on recreating a function block (image attached) using the new version of Blockly, where users can dynamically add or remove multiple shadow argument blocks. However, most blocks cannot connect in this setup, with a few exceptions. I also implemented a custom dragging strategy that allows new argument blocks to be created by dragging shadow argument blocks.
Now, I want to enhance the shadow blocks by adding a context menu that allows users to edit or remove the selected block. I experimented with making the argument blocks non-movable instead of using shadow blocks, but this approach didn’t work with the dragging strategy.
I've been testing with shadow blocks, and while everything looks great visually, there's still the issue with the context menu. When I tried using non-shadow blocks as suggested, actions like copy/paste or undo/redo would result in an extra block being created. My theory is that this happens because a block is being created during the display update. Then, the block's state includes another block that replaces the created one, which disconnects the initially created block, leading to the extra block. I'm unsure how to work around this issue. Any suggestions?