feat: reposition document cover images - #1094
Open
ion-lion wants to merge 2 commits into
Open
Conversation
ion-lion
marked this pull request as ready for review
September 11, 2026 04:44
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.
Why now
Issue #906 reports that editors can change, remove, and download document covers but cannot choose the visible crop. The shared desktop/web
DocumentCoveralways used centeredobject-fit: cover, so portraits and off-center subjects could remain cropped after draft reload and publish.What changed
coverPosition: {x, y}focal point as integer percentages. Missing or partial metadata defaults to center.object-positionin both desktop and web.Why this approach
object-positionalready guarantees safe cover bounds, so the UI only needs to convert pointer movement into percentages of the rendered image overflow. Two coordinates remain correct across different viewport aspect ratios; a pixel offset or vertical-only scalar would not. Integer0…100values are required because documentSetAttributesupports integer numbers but not floats. Older clients ignore the extra metadata and older documents remain centered.The interaction previews locally and writes once on Save rather than autosaving every pointer move. Replacing/removing uses a null tombstone so the existing recursive UI attribute diff clears both nested coordinates. The CLI update path applies the same rule against the published metadata and expands the object tombstone into leaf operations; a parent-only null is not reliable for multi-child attributes.
Validation
DocumentCoverfocused tests: 9/9 passed (existing actions, position rendering, drag/clamp, keyboard Save, Escape cancel, focus entry).git diff --checkpassed.Follow-up
This slice intentionally covers the issue's document-header behavior on desktop and web. Native mobile does not currently render/edit document covers. Newspaper thumbnails and generated social images still center-crop and can adopt the same focal metadata separately if product acceptance expands beyond document covers.