Repository navigation
Conversation
Untouched posts reported changed: true when core migrated a block while parsing or a block wrote non-persistent attributes on mount. Count a content change only when core replaced the content edit, which it does for every persistent change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Guards the serialized baseline: seeding it with the raw stored markup would report these edits as a change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
XCFramework BuildThis PR's XCFramework is available for testing. Add the following to your .package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/956")Built from 3ffcc77 |
Core keeps one content edit for a run of typing, so comparing the edit with the one seen at the last read hid keystrokes typed after it. Compare with the edit at open instead, and keep comparing markup once the host has received edited content, so undoing back to the start is reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Asserting the content edit's type tied a test to how core stores it; isEditedPostDirty() proves the same precondition. The same-edit check stays, labelled so a failure points at the test rather than the bridge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Description
Fixes #943. Fixes CMM-2930.
getTitleAndContent()reportedchanged: truefor untouched posts when core migrated a block while parsing (e.g., legacy-aligned headings and paragraphs) or a block wrote attributes on mount as non-persistent changes (e.g., VideoPress caching its embed).It now compares markup only once the post's
contentedit differs from the one at open, or the host has already received edited content. Core creates that edit for persistent changes only, never for parse-time migrations or non-persistent writes, so this matches whether core considers the content edited.Additional AI-generated details
getEditedPostContent()returns the stored markup, but the baseline isserialize( parse( content ) ), so migrated blocks never match. Non-persistent writes really do change the serialized content, so no baseline can hide them.getEditedPostContent()returns serializer output, so the serialized baseline is the like-for-like comparison. A raw baseline would report edits that cancel out on migrated blocks as a change; an E2E test covers this and fails with raw seeding.contentedit for a run of typing, so comparing with the edit seen at the last read hid keystrokes typed after it.alignattribute lacks the matchinghas-text-align-*class is migrated by a non-persistent write on mount. Core groups the user's first text-alignment change on that block with that write, so it creates nocontentedit and is reported aschanged: falseuntil the next persistent edit. Core'sisEditedPostDirty()misses it too; accepted as narrow.Testing instructions
Create a post with this content:
Open it in the demo app without editing.
In the web inspector, run
window.editor.getTitleAndContent(). Expectchanged: false.Type in the paragraph and run it again. Expect
changed: true.Note: run
getTitleAndContent()once per step; eachchanged: trueresult advances the baseline.🤖 Generated with Claude Code