Hi Alan,
In your case, you probably want to avoid readonly mode, since it’s intended that you can’t select blocks. Instead, you can set the blocks to be non-movable and/or non-editable.
The easiest way to handle this is to only set the blocks to be non-editable. Copyability is tied to movability, so if the blocks are still movable then they’ll be copyable. In this scenario, copy/paste would work. The caveat is that the blocks would still paste as non-editable, so you’d have to adjust the state of blocks as they’re coming in. But you could make that adjustment via a changeListener that looks for BLOCK_CREATE events.
If you want the blocks to be non-editable *and* non-movable, you would have to make more adjustments. You can re-register the copy shortcut via the ShortcutRegistry and add your own copy logic. If you want to be able to right click and copy, you can add a context menu item with the same copy logic. For your use case, when you’re writing the copy logic, you’ll likely want to make it so that the block you copy gets serialized as movable and editable. That way, when your users paste into the regular workspace, the block will be usable.
Let me know if that works or if you have other questions!
Best,
Zoë
--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/blockly/94b9c512-836b-4897-84a1-1112db399f13n%40googlegroups.com.