Skip to content

Add the ability to make a read-only workspace writable #3049

Description

@ItsHarper

Is your feature request related to a problem? Please describe.

I need to be able to have a workspace start out as read-only, but become writable.

Describe the solution you'd like

For maximum flexibility, I'd love to see a workspace.setReadOnly(boolean) function, but if it's easier to only support going from read-only to writable, a function workspace.enableEditing() would suffice.

Describe alternatives you've considered

I found this message from Neil on Google Groups, which suggests putting a transparent div over Blockly to prevent interactions. The problem with this is that it also disables panning and zooming around the Blockly workspace. I want users to be able to interact with, but not edit, the workspace.

Additional context

In that message, Neil said this:

Readonly cannot be changed after init. There are too many event handlers that would need to be added and removed.

I don't understand why that would be an unsolvable problem (maybe I'm just not familiar enough with the Blockly source). I'd like to try to implement this change myself, so I'd appreciate any additional context or guidance that anyone (@NeilFraser) can give me.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions