fix: enable link search in feature image caption and center caption text#28730
fix: enable link search in feature image caption and center caption text#28730Dikshant0Git wants to merge 5 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Walkthrough
Possibly related issues
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
ghost/admin/app/components/koenig-lexical-editor-input.js (1)
71-74: ⚡ Quick winRemove unused
sessionservice injection.
@service sessionis injected but never used in this component. The other injected services (search,settings,store) are all used insearchLinks, butsessionhas no references.♻️ Proposed fix
`@service` search; -@service session; `@service` settings; `@service` store;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ghost/admin/app/components/koenig-lexical-editor-input.js` around lines 71 - 74, The `@service session` injection in the koenig-lexical-editor-input component is never referenced or used anywhere in the component code, unlike the `search`, `settings`, and `store` services which are all utilized. Remove the `@service session` line from the service injections to clean up the unused dependency and improve code clarity.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ghost/admin/app/components/koenig-lexical-editor-input.js`:
- Around line 134-140: In the catch block where the task cancellation is checked
using didCancel(error), the function currently returns undefined when a
cancellation error occurs. Change the bare return statement to return an empty
array instead, so that the function consistently returns an array type
regardless of whether it completes successfully or is cancelled.
---
Nitpick comments:
In `@ghost/admin/app/components/koenig-lexical-editor-input.js`:
- Around line 71-74: The `@service session` injection in the
koenig-lexical-editor-input component is never referenced or used anywhere in
the component code, unlike the `search`, `settings`, and `store` services which
are all utilized. Remove the `@service session` line from the service injections
to clean up the unused dependency and improve code clarity.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3daab821-e4b9-4973-a36d-146e2975c142
📒 Files selected for processing (2)
ghost/admin/app/components/koenig-lexical-editor-input.jsghost/admin/app/styles/layouts/editor.css
Context
#28359
Problem
The feature image caption editor in Ghost Admin runs as an isolated instance separate from the main editor canvas. This isolation introduced two specific UI/UX issues:
cardConfig.searchLinkswas missing, the editor was forced to drop back to a basic text input fallback that lacked autocomplete capabilities and collapsed heavily under short character selections.Fix
ghost/admin/app/components/koenig-lexical-editor-input.js: Injects Ember'ssearch,settings, andstoreservices directly into the component. It implements a robust, cached, and filtered asynchronoussearchLinksmethod within the React wrapper and threads it directly into the caption editor as a structuredcardConfigprop. This restores the full autocomplete suggestion list when users format links.ghost/admin/app/styles/layouts/editor.css: Adds a clean CSS rule targeting.gh-editor-feature-image-captionspecifyingtext-align: centerto ensure uniform layout alignment.Tests
Added local unit and static validation tests covering the new behavior (
test_search_links.js):searchLinkscontext layer.Scope
The underlying layout collapse symptom—where the fallback input box shrinks tightly around a small text range when a configuration is absent—is caused by the basic input field layout inside the engine package and is handled directly in the Koenig repository workspace.
This PR fixes the root problem inside Ghost Admin by ensuring the correct configuration context is always provided to the composer.
However, the visual symptom of that bug—where the fallback input box shrank so tightly around small text selections that it became unusable—lives inside the core editor package. To address this comprehensively, a companion PR has been submitted to the Koenig repository:
cardConfigcontext so the advanced link autocomplete toolbar works seamlessly.min-w-[240px]rule toLinkInput.jsxto ensure that even if a fallback input is triggered anywhere else in the ecosystem, the UI remains resilient and usable.By decoupling these fixes, we ensure immediate feature availability in Ghost Admin while contributing a permanent UI safety layer to the shared Koenig codebase.
fix-snippet.md