Skip to content

Undeletable Blocks Created Through .domToWorkspace can be "Deleted" through Undo #2191

@BeksOmega

Description

@BeksOmega

Problem statement

Bug: This behavior means that the user could accidentally delete an undeletable block.

Expected Behavior

When you press ctrl/cmd z to "un-create" an un-deletable block nothing should happen.

Actual Behavior

The block is deleted.

Steps to Reproduce

  1. Add below code at ~ ln 124 in playground:
var workspaceBlocks = document.getElementById("workspaceBlocks");
Blockly.Xml.domToWorkspace(workspaceBlocks, workspace);
  1. Add below code at ~ ln 366 in playground:
<xml xmlns="http://www.w3.org/1999/xhtml" id="workspaceBlocks" style="display:none">
    <block type="controls_if" deletable="false" id="1" x="12" y="13"></block>
</xml>
  1. Load the playground & observe how a "controls_if" block appears.
  2. Press ctrl/cmd z & observe how it is deleted (even though deletable is set to false).

Stack Traces

N/A

Operating System and Browser

I assume this affects all browers.

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions