Repository navigation
Suggest mode 1/9: editor intent (edit/suggest/view) and experiment gate - #80427
adamsilverstein wants to merge 58 commits into
Conversation
Adds the session-scoped editor intent state (private setEditorIntent action / getEditorIntent selector), the Edit / Suggest / View switcher in the editor options menu, Google Docs convention keyboard shortcuts, and a read-only view intent via isPreviewMode. The Suggestion Mode experiment flag and the gate helpers (isSuggestionModeEnabled / useCanSuggest) land here so every later layer gates on the same predicate. No suggestion capture or storage yet.
|
Size Change: +1.92 kB (+0.02%) Total Size: 7.91 MB 📦 View Changed
|
|
Flaky tests detected in 5df3684. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/33116177758 refuses the drop and uploads nothing in
|
# Conflicts: # packages/editor/src/components/global-keyboard-shortcuts/index.js # packages/editor/src/store/private-selectors.js
# Conflicts: # packages/editor/CHANGELOG.md # packages/editor/src/store/private-actions.js # packages/editor/src/store/private-selectors.js
…spec The new @wordpress/dependency-group rule runs in 'never' mode, so the header comment left in this spec still failed lint after the last pass.
The guard skipped the mode snackbar and a11y announcement when the previous intent was undefined, but the reducer defaults the slice to `edit` and the selector falls back to `EDITOR_INTENT_EDIT`, so that value never occurs. The comment promised boot silence for any initial intent while only `edit` was ever silent, which is a trap for the next reader. Keep the equality check, which is what actually suppresses the notice, and say so.
New React files must use .tsx and new source should be TypeScript, so the intent switcher, the Suggest mode gate and constants, and their tests move to .ts/.tsx with real annotations instead of JSDoc types. MenuItemsChoice's onHover is typed as required even though the component defaults it to a noop and its own usage example omits it; typing the first TypeScript consumer surfaced that, so mark the prop optional.
|
Hey 👋 I wanted to give you a heads-up since this pull request is affected by recent validation changes for changelog files. #83043 adds additional validation for changelog files. You'll note that this pull request is currently failing a "Required changes from trunk" check. What you'll need to do: You will need to either rebase or merge the latest code from |
# Conflicts: # packages/editor/tsconfig.json
The 2026-09-10 package releases cut version headings above these entries, so the new changelog structure check rejected them as citing this PR from a published section. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vHxnB4ab5Ecriq8zcwBJd
Resolve the block-editor CHANGELOG conflict by keeping trunk's new entries and moving the branch's preview-mode entry under Unreleased, since trunk published the section it was in as 18.0.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GqepyjmFSryBt88j6f6ubY
Trunk published editor 15.1.0, stranding four of this branch's Bug Fixes entries under the released heading, which the changelog structure check rejects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GqepyjmFSryBt88j6f6ubY
Viewing is offered as a read-only preview, but only the block canvas honoured it: sidebar controls such as the excerpt still reached editPost() and changed the post. Refuse post-level field changes there with a snackbar, leaving block content to the canvas's own preview-mode guards so block sync and savePost keep working. Claude-Session: https://claude.ai/code/session_01EmSXGAGtuLnk3UEe5kXPSU
|
Claude took the latest review pass on this layer, here is the fix:
|
Core-data loads the post type entity configs in the background, and in some shuffled orders that request reached a fetch handler another test had installed, which rejected it as an unknown path. Vitest reports those as unhandled errors and fails the shard even though every test passes. Route the handlers through one fallback that answers the post type index and rejects anything else. Claude-Session: https://claude.ai/code/session_01EmSXGAGtuLnk3UEe5kXPSU
# Conflicts: # packages/block-editor/CHANGELOG.md
# Conflicts: # packages/editor/CHANGELOG.md
# Conflicts: # packages/editor/CHANGELOG.md
|
Testing just this one in isolation, I get the same error noted here. Let me know if I'm doing something wrong. |
Trunk's Menu now throws in development builds when a Menu.Group sits inside a Menu.RadioGroup (#83792), which crashed the editor as soon as the Options menu opened. Put the Mode label and radio items directly in the RadioGroup, the same shape trunk gave ModeSwitcher, and cover it with a jsdom test since production e2e builds never hit the guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BTRGFetxgiXPJC9a91DMTL
# Conflicts: # packages/editor/CHANGELOG.md
this should be fixed now @jasmussen - thanks for letting me know it was broken! |
Part of #73411
What's in this PR
Adds the session-scoped editor intent state (private setEditorIntent
action / getEditorIntent selector), the Edit / Suggest / View switcher in
the editor options menu, Google Docs convention keyboard shortcuts, and a
read-only view intent via isPreviewMode. The Suggestion Mode experiment
flag and the gate helpers (isSuggestionModeEnabled / useCanSuggest) land
here so every later layer gates on the same predicate. No suggestion
capture or storage yet.
The
viewintent's read-only contract is enforced here too, in the layerthat promises it: preview mode is added to the memoized insertion
selectors' dependants so flipping it at runtime invalidates their cached
answers, the writing flow's cross-block input handling bails out while
the canvas is a preview, and the Block Inserter toggle is disabled (an
open inserter is closed on the way in). This was originally #81661 on top
of the stack and moved down here so it can be reviewed next to the intent
it belongs to.
Screenshot
The Edit / Suggest / View switcher in the editor Options menu, with the Google Docs style shortcuts alongside each mode:
Mode group in the editor Options menu showing Editing, Suggesting and Viewing
Testing
This is one layer of the stack. To exercise the whole feature, #78994 bundles every layer 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 9 small, independently reviewable PRs, each building on the one below it:
Each follow up fix now sits in the layer that owns the code it changes, rather than piling onto the top of the stack. The whole feature can be exercised end-to-end via the combined testing branch #78994 (Playground). Behind the "Suggestion Mode" experiment (Gutenberg > Experiments).
AI Use
Code and description both written with 🤖 Claude Code. I will review and test.