Suggest mode 6a: Render block-remove pending state in canvas and sidebar#77970
Suggest mode 6a: Render block-remove pending state in canvas and sidebar#77970adamsilverstein wants to merge 3 commits intosuggest-mode-6a-remove-mechanismfrom
Conversation
Brings the visual treatment for block-remove suggestions:
- BlockListBlock filter reads metadata.suggestion.type and adds
is-suggestion-pending-{remove,insert,move} classes alongside the
existing is-suggestion-pending overlay class. structuralMarkerClass
centralizes the marker-to-class lookup so the single rendering layer
stays a thin shell over the data model. The pre-existing
attribute-overlay class still applies independently — a block can
carry both a structural marker and a pending attribute edit.
- style.scss adds the pending-remove treatment: 50% opacity plus a
centered horizontal red rule via ::after, so selection, focus, and
the block toolbar keep working while the block reads as proposed
for deletion. Pending-insert and pending-move styles ship with their
own follow-up PRs.
- suggestion-summary.js adds a "Remove block: <name>" line via a small
friendlyBlockName helper that strips the namespace prefix. Falls
back to "block" when the op carries no name.
- suggestion-diff.js adds BlockRemoveDiff, which renders the captured
block snapshot (op.block) as strikethrough text. collectBlockText
walks the snapshot's RichText content and innerBlocks recursively
with a length cap so a huge subtree doesn't bloat the sidebar.
Pulled the per-op render decision into a flat DiffForOperation
component so the JSX stays free of nested ternaries.
Refs #77434.
|
Size Change: +303 B (0%) Total Size: 7.92 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Flaky tests detected in 4a9b565. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25406061600
|
…intent The BlockListBlock filter previously bailed out for any client not in Suggest intent, so a post author reviewing a suggestion in Edit (the default) saw the canvas in its post-suggestion state with no visual cue that the change was still pending — a deletion looked already deleted, an insertion looked like a normal block, etc. Structural markers live in `metadata.suggestion` on the live block and travel through the same sync path as block content, so any intent already has the data needed to render the dimmed/struck treatment. Drop the suggest-mode gate for the structural-class branch, and keep it only for the attribute overlay "bracket" — that one tracks the suggester's local, in-progress edits in the overlay context, which no other intent has any way to read or act on. Refs #77434.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
What
Adds the visual treatment for block-remove suggestions (#77434, task 6a). Pairs with the mechanism PR (#77968).
metadata.suggestion = { type: 'pending-remove' }renders at 50% opacity with a horizontal red rule across its center.How
with-suggestion-overlay.js: BlockListBlock filter readsmetadata.suggestion.typeand addsis-suggestion-pending-{remove,insert,move}classes alongside the existing attribute-overlay class.style.scss: pending-remove styling (50% opacity + ::after horizontal rule).suggestion-summary.js: handlesblock-removeops with a "Remove block: " line.suggestion-diff.js:BlockRemoveDiffrenders the captured block snapshot as strikethrough text via a newcollectBlockTextwalker.Testing
Stack
Refs #77434, #73411.