Fixed false update state for API feature image captions#28107
Merged
aileen merged 2 commits intoMay 28, 2026
Conversation
Contributor
WalkthroughThis PR adds caption HTML normalization and comparison logic to the feature image editor. New utility functions ( Possibly related issues
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
mike182uk
reviewed
May 27, 2026
mike182uk
approved these changes
May 27, 2026
closes [ONC-1765]([https://linear.app/ghost/issue/ONC-1765/oss-issue-update-button-incorrectly-enabled-on-load-when-feature-image](https://linear.app/ghost/issue/ONC-1765/oss-issue-update-button-incorrectly-enabled-on-load-when-feature-image)) The feature image caption editor was writing Lexical hydration markup back to `featureImageCaption` when API-created posts with plain text captions were opened, which marked the post as dirty before any user edit. Normalizing generated plain-text spans before comparing caption HTML keeps the loaded record clean while preserving real caption edits, and the regression test verifies the `Update` button remains disabled on load.
Documented why the feature image caption comparison ignores Lexical plain-text wrappers, matching the review request before merge.
0245d1b to
97b820d
Compare
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.
Summary
featureImageCaptionwhen opening API-created posts.Updatebutton remains disabled when a plain text feature image caption is loaded from the API.Root cause
The nested caption editor normalizes plain text captions into Lexical-generated HTML on initialization. That initial normalization was written directly back to the Ember Data post model, marking published posts as dirty before any user edit.
Validation
pnpm --dir ghost/admin exec eslint app/components/gh-editor-feature-image.js tests/acceptance/editor/feature-image-test.jspnpm --dir ghost/admin exec ember exam --split 1 --parallel=1 --filter='Acceptance: Feature Image'closes ONC-1765
closes #28094