Block editors: Make block editors read-only when document is trashed (closes #21973)#21982
Conversation
There was a problem hiding this comment.
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/settingspropertyWriteGuardrules 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-blockwith other ref blocks by adding the missing.readonly/.hrefbindings.
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
left a comment
There was a problem hiding this comment.
Tested out, works as described! 🚀
| }; | ||
|
|
||
| this.readOnlyGuard?.addRule(rule); | ||
| this.content.propertyWriteGuard.addRule({ unique, permitted: false }); |
There was a problem hiding this comment.
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.
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:
Testing