Repository navigation
Suggestion mode 5/9: inline suggestion operations - #80431
Open
adamsilverstein wants to merge 117 commits into
Open
adamsilverstein wants to merge 117 commits into
adamsilverstein wants to merge 117 commits into
Conversation
Adds the suggestion-specific layer on top of the marker primitive: create, accept, and reject inline text (add/del) and formatting suggestions (operations.js); the pure reconcilers that turn a text edit or a format toggle into marker actions (reconcile-edit.js, reconcile-format.js); word/ line delete-range resolution; strip-markers for clean attribute snapshots; findSuggestionText/findMarkerText helpers; and the annotate-suggestions hook. Still pure modules - the keyboards and reconcilers that call them into the live editor land in the final step.
This was referenced Jul 17, 2026
|
Size Change: 0 B Total Size: 7.93 MB |
adamsilverstein
marked this pull request as ready for review
August 5, 2026 22:24
|
Flaky tests detected in d690668. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/33117688052 refuses the drop and uploads nothing in
|
Trunk switched @wordpress/dependency-group to 'never' mode, so the import group headers in these files now fail lint.
Rename the files this PR adds from .js to .ts and add types so the strict type check covers them: the edit/format reconcilers now export TextEdit, MarkerAction, and FormatPlan interfaces, and marker/op helpers carry typed signatures. No behavior changes.
# Conflicts: # packages/components/CHANGELOG.md
# Conflicts: # packages/editor/CHANGELOG.md
Trunk turned off Vitest's CommonJS globals (#85878), so __dirname is no longer defined in unit tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018vwYjThZWj6b6d3BwR27T2
…ayer The operations layer refused most gestures over another author's inline suggestion, and a later layer replaced the refusals with stacked markers that let suggestions nest and overlap, each resolving on its own in any order. Plan and resolve overlapping suggestions here instead, with the format deltas and the overlap fixtures that prove accept and reject in any order reach the same text. Claude-Session: https://claude.ai/code/session_018vwYjS1afuMwCEzNKqAxg6
Another author writes a formatting suggestion's delta, and a reviewer's decision applies its formats to the content. A stored descriptor could name a suggestion marker or an unregistered type, which serializes as an element of that name, carry a `javascript:` value in any attribute a format maps to `href`, and claim offsets large enough that expanding or rebasing the delta allocated and looped without bound. Validate a delta's runs and formats before any of them are applied, check every attribute value's protocol, and rebase run by run instead of expanding every offset a run claims. Claude-Session: https://claude.ai/code/session_018vwYjS1afuMwCEzNKqAxg6
…riment An emptied marker only survives a rich-text round trip while its format is registered, and that is the form the editor loads with the experiment off.
…utes Format deltas carried their own copy of the allowed protocols and the scheme test. Proposed block attributes are now checked the same way on accept, so the delta sanitizer uses that module and the two cannot drift.
Formatting applied to text you suggested adding is folded into that addition, so nothing recorded that the run was bold. Compare the run's formats with those of the text next to it, so a card can name them. Claude-Session: https://claude.ai/code/session_018vwYjV5xvNjZT3oL9uthV9
Formatting text you had suggested adding was folded into that addition, so a reviewer could not take the text without the formatting. Testers expect one card each, as Google Docs gives. The planner now nests a format suggestion in the author's own addition, as it does in anyone else's, and a second format on those words still revises that one suggestion. Claude-Session: https://claude.ai/code/session_018vwYjV5xvNjZT3oL9uthV9
…d it An addition typed into bold text carries its own bold format object, so once the marker was unwrapped the run serialized as three adjacent <strong> elements. Normalize the formats when a marker is unwrapped so equal formats on neighboring text share one identity again. Claude-Session: https://claude.ai/code/session_018vwYjV5xvNjZT3oL9uthV9
This branch has not been deployed
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.
Part of #73411
What's in this PR
Adds the suggestion-specific layer on top of the marker primitive. Still pure modules, nothing is wired into the live editor yet:
core/suggestion-add,-deland-format, and their canonical nesting order (format.ts)operations.ts)reconcile-edit.ts,reconcile-format.ts)overlap.ts), what a decision does to the other suggestions (resolution.ts), and how a suggestion sits among the others for the sidebar (relations.ts)format-delta.ts)test/fixtures/)marker-integrity.ts)The keyboards and reconcilers that call these from the live editor land in #80433. The rules for overlapping suggestions used to be a layer of their own (#86206, now closed) and are part of this one.
Diagram
Pure transforms over a rich-text value: write a marker, resolve it on accept or reject, strip it for output.
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.
Suggestion mode stack
This rebuilds the manually-stacked Suggestion 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. Overlapping suggestions were briefly their own layer (#86206, now closed); that code sits in the layers that own it, mainly #80431 and #80433. 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.