Visual revisions: Add a code diff view inside the editor - #80314
Visual revisions: Add a code diff view inside the editor#80314priethor wants to merge 8 commits into
Conversation
|
Size Change: +2.4 kB (+0.03%) Total Size: 7.76 MB 📦 View Changed
|
6273318 to
416f1ac
Compare
|
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. |
416f1ac to
aa7aefd
Compare
|
Flaky tests detected in aa7aefd. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/29510630171
|
aa7aefd to
119821e
Compare
454e67c to
cd34da9
Compare
| revision: getCurrentRevision(), | ||
| previousRevision: _previousRevision, | ||
| showDiff: _showDiff, | ||
| isPreviousRevisionLoading: |
There was a problem hiding this comment.
If the request for the next revisions page fails, the core-data resolver swallows the error, getPreviousRevision keeps returning null, and this condition stays true forever, so the code view shows the spinner indefinitely (turning off "Show changes" is the only way out). I think instead of inferring the loading state from null we should check the resolution status, e.g. hasFinishedResolution( 'getRevisions', … ) on core-data, and fall back to showing the revision without the diff when the previous revision cannot be loaded.
|
|
||
| // If the user moves focus while revisions load, keep it there when the | ||
| // slider mounts. | ||
| if ( ! didInteractWhileLoadingRef.current && focusHasNotMoved ) { |
There was a problem hiding this comment.
didInteractWhileLoadingRefis set on any keydown and never reset, so a key press that does not move focus (e.g. Escape while the spinner is showing) permanently skips the slider focus and keyboard focus is left on the body. SincefocusHasNotMoved` already covers the "user moved focus" case, do we need the interaction flag at all? Could we simplify the code and remove it?
|
|
||
| - The "Apply globally" control now opens a review modal so you can choose which of a block's modified styles are pushed to Global Styles, showing each style's current and new value ([#79839](https://github.com/WordPress/gutenberg/pull/79839)). | ||
|
|
||
| ### Enhancements |
There was a problem hiding this comment.
We are duplicating the ### Enhancements section, we should add the log on the existing one.
jorgefilipecosta
left a comment
There was a problem hiding this comment.
Left some comments but things look good and I think it could be merged after the comments are addressed/answred.
| /** | ||
| * Internal dependencies | ||
| */ | ||
| import { RevisionsCodeDiff, getCodeDiffRows } from '../revisions-code-diff'; |
There was a problem hiding this comment.
What do we use for the classic revisions screen? Are we using the same thing?
What
Closes #77841, part of #79120.
Adds a Code editor option to the block editor revisions screen, showing the selected revision's raw markup and highlighting the lines that were added or removed. The
Show changestoggle on the top left switches between the diff and the plain markup.Why
A visual diff can miss changes to block attributes when the rendered post still looks the same. The code view makes those changes visible in the new revisions screen instead of sending users back to the classic one.
Testing Instructions
Screen recording
Grabacion.de.pantalla.2026-07-15.a.las.15.44.12.mov
I used Codex to implement these changes. I guided the work, tested it, and reviewed the results.