Phase 1: Add Edit / Suggest / View intent mode scaffolding#77403
Draft
adamsilverstein wants to merge 1 commit intotrunkfrom
Draft
Phase 1: Add Edit / Suggest / View intent mode scaffolding#77403adamsilverstein wants to merge 1 commit intotrunkfrom
adamsilverstein wants to merge 1 commit intotrunkfrom
Conversation
This was referenced Apr 16, 2026
f78a787 to
3ca48fe
Compare
Introduce an `editorIntent` preference orthogonal to the visual/code `editorMode`. The intent captures the user's editing purpose: direct editing (`edit`, default), proposing changes for the author to apply or reject (`suggest`), or a read-only preview (`view`). This is Phase 1 of the Suggest mode effort in #73411. It adds the `setEditorIntent` action, `getEditorIntent` selector, and an Intent switcher menu gated on `editor.notes` post type support. The `view` intent reuses the existing block-editor `isPreviewMode` plumbing to disable editing. Follow-up phases wire capture, diff preview, and apply / reject for the `suggest` intent. Refs #73411
3ca48fe to
4bdfdda
Compare
|
Size Change: +461 B (+0.01%) Total Size: 7.75 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Flaky tests detected in 4bdfdda. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24533515994
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This is one of 5 stacked PRs implementing Suggest mode for the WordPress editor - a Google Docs–style workflow where reviewers can propose changes that the post author can Accept or Reject. Tracked in #73411, with design direction from #73410 and jasmussen's mockups.
Architecture & Yjs readiness
The eventual long-term storage primitive for suggestions is the Yjs
AttributionManagerarriving in Yjs v14 (PR #77005), which attributes CRDT document changes to specific clients - exactly what suggested edits need. However, Yjs v14 is pre-release with an unstable API, and even with Yjs, server-side persistence is still needed for non-RTC users.Rather than block on Yjs, this series builds the full feature now with a comment-meta backend behind a swappable
SuggestionsProviderinterface shaped to match Yjs attribution semantics:attribute-set) - not HTML diffs - so they map directly to whatAttributionManagerwould emit.createSuggestion,updateSuggestion,deleteSuggestion,applySuggestion,rejectSuggestion. Today's implementation reads/writes comment meta; a futureyjs-provider.jscan drop in with the same methods.When #77005 stabilizes, the migration is: implement
yjs-provider.jsagainst the same interface, useAttributionManagerfor live-session attribution, and keep comment-meta as the fallback for users without RTC.The 5 phases
editorIntentpreference (edit/suggest/view), a mode selector in the Options kebab, read-only gating for View intent, keyboard shortcuts, and a "You're suggesting/editing/viewing" snackbar on mode change.editor.BlockEditfilter divertssetAttributesinto a React context so the user sees their edit live but the block-editor store stays at the baseline. The HOC is split so non-Suggest intents only run a singleuseSelect._wp_suggestioncomment meta, theSuggestionsProviderinterface (create/update/delete/apply/reject), and the accept/reject icon buttons in the notes sidebar.This PR (Phase 1)
editorIntentpreference (edit,suggest,view) orthogonal to the existing visual/codeeditorModesetEditorIntentaction +getEditorIntentselector in the editor store<IntentSwitcher>component: Edit / Suggest / View menu in the Options kebab, gated oneditor.notespost type support⌥⇧⌘Z/X/C, orCtrl+Alt+Shift+…on Windows/Linux)viewintent reuses the existingisPreviewModeblock-editor setting for read-only rendering - no new machineryWhat's NOT in this PR
_wp_suggestioncomment meta and accept/reject provider (Phase 3)Phase 1 test plan
contenteditable="false")npm run test:unit -- packages/editor/src/store/test/actions.js --testNamePattern=setEditorIntentnpm run test:e2e -- test/e2e/specs/editor/various/editor-intent-switcher.spec.js🗺️ PR Stack Navigation
_wp_suggestionmeta, provider, sidebar actions📋 Tracking issue: #73411