Skip to content

Block editors: Make block editors read-only when document is trashed (closes #21973)#21982

Merged
leekelleher merged 2 commits intomainfrom
v17/bugfix/21973-make-block-editors-readonly-when-trashed
Mar 3, 2026
Merged

Block editors: Make block editors read-only when document is trashed (closes #21973)#21982
leekelleher merged 2 commits intomainfrom
v17/bugfix/21973-make-block-editors-readonly-when-trashed

Conversation

@AndyButland
Copy link
Copy Markdown
Contributor

@AndyButland AndyButland commented Mar 3, 2026

Description

Addresses: #21973

This issue showed that when a block editor is read-only - e.g. when a document is trashed, block editors - some buttons and fields were still enabled and appeared that they could be edited. Edits can't be saved, but for consistency and clarity, they shouldn't display as editable.

With this PR:

  • Edit, settings, and delete action buttons are hidden on all block entry elements when read-only.
  • Inline block fields remain visible and expandable but all property editors are read-only.
  • Non-inline blocks remain clickable to open the dialog for viewing, but fields inside are read-only.

Testing

  • Create a document with block list, block grid, block single, and block RTE properties containing blocks
  • Trash the document
  • Open the trashed document and verify that:
    • Edit/settings/delete buttons are hidden on all block entries
    • Inline block fields are visible but read-only (cannot type into them)
    • Non-inline block labels are clickable and open a dialog with read-only fields
      • The "Update" button of the dialog is hidden
    • Copy-to-clipboard button still works
  • Restore the document from trash and verify blocks are fully editable again
  • Verify blocks work normally on non-trashed documents (edit/settings/delete all functional)

Copilot AI review requested due to automatic review settings March 3, 2026 05:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures block editor UIs across Block List, Block Grid, Block Single, and Block RTE correctly enter a read-only rendering mode when the parent document is trashed by propagating the block manager’s read-only state into the property write-guards and hiding edit-related actions.

Changes:

  • Propagate block manager read-only state into content/settings propertyWriteGuard rules so underlying property editors render as read-only.
  • Hide edit/settings/delete actions on block entry elements while in read-only mode (copy-to-clipboard remains available).
  • Align umb-ref-single-block with other ref blocks by adding the missing .readonly / .href bindings.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Umbraco.Web.UI.Client/src/packages/block/block/workspace/block-workspace.context.ts Adds/removes denied rules on propertyWriteGuard for content/settings when block manager read-only is active.
src/Umbraco.Web.UI.Client/src/packages/block/block-single/components/ref-single-block/ref-single-block.element.ts Adds .readonly and switches to property-binding .href consistent with other ref block implementations.
src/Umbraco.Web.UI.Client/src/packages/block/block-single/components/block-single-entry/block-single-entry.element.ts Ensures custom views render without expose overlay in read-only and hides edit/settings actions when read-only.
src/Umbraco.Web.UI.Client/src/packages/block/block-rte/components/block-rte-entry/block-rte-entry.element.ts Introduces read-only state handling and hides edit/settings/delete actions accordingly.
src/Umbraco.Web.UI.Client/src/packages/block/block-list/components/block-list-entry/block-list-entry.element.ts Ensures custom views render without expose overlay in read-only and hides edit/settings actions when read-only.
src/Umbraco.Web.UI.Client/src/packages/block/block-grid/components/block-grid-entry/block-grid-entry.element.ts Ensures custom views render without expose overlay in read-only and hides edit/settings actions when read-only.

@leekelleher leekelleher linked an issue Mar 3, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Member

@leekelleher leekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested out, works as described! 🚀

@leekelleher leekelleher merged commit 0340d8c into main Mar 3, 2026
28 of 29 checks passed
@leekelleher leekelleher deleted the v17/bugfix/21973-make-block-editors-readonly-when-trashed branch March 3, 2026 13:06
};

this.readOnlyGuard?.addRule(rule);
this.content.propertyWriteGuard.addRule({ unique, permitted: false });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we can´t just inherit the state. That would not work for Block Level Variants if the user does not have access to edit Invariant Fields but has access to edit fields of a particular Culture.
In that case the user needs to navigate via the invariant property to edit culture specific fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Block List is not readonly when content is trashed

4 participants