Suggest mode 3/7: block-level capture (attribute and structural) - #80429
Suggest mode 3/7: block-level capture (attribute and structural)#80429adamsilverstein wants to merge 2 commits into
Conversation
Adds the store-level interceptor that catches block mutations dispatched straight to the block-editor store (the block-switcher variation picker, programmatic writes), routing attribute drift into the overlay and reverting the live block; captures structural edits (insert/remove/move) by tagging the live block with a metadata.suggestion marker and recording the op; and the overlay HOC that renders the pending-suggestion visual treatment (the green attribute bracket and the strikethrough/dim/move-ghost overlays). The revert guard and undo guard keep the interceptor's own writes off the undo stack and out of its own subscribe loop, and the server hides un-accepted structural insertions at render time. Inline text and formatting markers are layered on top of this HOC in a later step.
|
Size Change: +7.13 kB (+0.09%) Total Size: 7.83 MB 📦 View Changed
|
|
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. |
|
Flaky tests detected in 70488b5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/31052225217
|
Part of #73411
What's in this PR
Adds the store-level interceptor that catches block mutations dispatched
straight to the block-editor store (the block-switcher variation picker,
programmatic writes), routing attribute drift into the overlay and reverting
the live block; captures structural edits (insert/remove/move) by tagging
the live block with a metadata.suggestion marker and recording the op; and
the overlay HOC that renders the pending-suggestion visual treatment (the
green attribute bracket and the strikethrough/dim/move-ghost overlays). The
revert guard and undo guard keep the interceptor's own writes off the undo
stack and out of its own subscribe loop, and the server hides un-accepted
structural insertions at render time. Inline text and formatting markers
are layered on top of this HOC in a later step.
Screenshot
Structural suggestions keep the block on the canvas and tag it instead of applying the change. A suggested move lands the block at its proposed position and leaves a ghost at the origin; a suggested removal keeps the block with a struck-through treatment:
Testing
This is one layer of the stack. To exercise the whole feature, #78994 bundles all seven layers into one branch and builds it in Playground:
👉 https://playground.wordpress.net/gutenberg.html?pr=78994
Enable Gutenberg > Experiments > Collaboration > Suggestion Mode, then follow the walkthrough in #73411, which also explains how to review the stack layer by layer.
Suggest mode stack
This rebuilds the manually-stacked Suggest mode work (#73411) as a GitHub Stack of 7 small, independently reviewable PRs, each building on the one below it:
The whole feature can be exercised end-to-end via the combined testing branch #78994 (Playground). Behind the "Suggestion Mode" experiment (Gutenberg > Experiments).