Skip to content

Commit f070644

Browse files
Suggestions: Show structural-marker visual treatment in every editor 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.
1 parent 51781f9 commit f070644

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

packages/editor/src/components/suggestion-mode/with-suggestion-overlay.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ function structuralMarkerClass( type ) {
165165
* pending suggestion — either an attribute overlay (renders the green
166166
* "bracket" treatment) or a structural marker stored in
167167
* `metadata.suggestion` (renders strikethrough/dim/move overlays).
168+
*
169+
* The attribute "bracket" is suggest-mode-only — it represents the suggester's
170+
* uncommitted edits living in the local overlay, which other intents have no
171+
* way to interact with. Structural markers, by contrast, are persisted on the
172+
* live block (synced through the same path as block content), so reviewers in
173+
* Edit or View intent see and can act on them too — that's the visual cue a
174+
* post author needs to spot a pending removal/insertion/move at a glance.
168175
*/
169176
const withSuggestionBlockClassName = createHigherOrderComponent(
170177
( BlockListBlock ) =>
@@ -190,11 +197,9 @@ const withSuggestionBlockClassName = createHigherOrderComponent(
190197
const hasPendingOverlay =
191198
!! entry &&
192199
Object.keys( entry.overlayAttributes ?? {} ).length > 0;
200+
const showOverlayBracket = isSuggestMode && hasPendingOverlay;
193201

194-
if (
195-
! isSuggestMode ||
196-
( ! hasPendingOverlay && ! structuralClass )
197-
) {
202+
if ( ! showOverlayBracket && ! structuralClass ) {
198203
return <BlockListBlock { ...props } />;
199204
}
200205

@@ -203,7 +208,7 @@ const withSuggestionBlockClassName = createHigherOrderComponent(
203208
{ ...props }
204209
className={ clsx(
205210
props.className,
206-
hasPendingOverlay && 'is-suggestion-pending',
211+
showOverlayBracket && 'is-suggestion-pending',
207212
structuralClass
208213
) }
209214
/>

0 commit comments

Comments
 (0)