Visual revisions: Add a code diff view inside the editor - #80314
Conversation
|
Size Change: +2.5 kB (+0.03%) Total Size: 7.77 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
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?
There was a problem hiding this comment.
Not sure I follow; do you mean the diffing itself?
There was a problem hiding this comment.
Yeah, just curious if we can keep the content and diffing mostly the same
There was a problem hiding this comment.
Regarding content, both compare post_content but the classic screen also diffs the title and excerpt, which this view doesn’t.
The diffing is similar, but classic revisions normalize whitespace first, collapsing blank lines and repeated spaces, and it also highlights changed words within a line, while this view highlights the whole line.
I’ll explore bringing them closer in a follow-up PR to avoid scope creep. 👍
There was a problem hiding this comment.
Follow-up to make the content diffing closer to the classic screen, with per-word highlights:
#81273
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.