Image cropper: Modal import missing component#20651
Image cropper: Modal import missing component#20651leekelleher merged 11 commits intoumbraco:mainfrom
Conversation
|
Hi there @bjarnef, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a missing component import that was causing the image cropper modal to fail. The fix adds an explicit import for the file upload preview component and addresses related TypeScript non-null assertion issues where the mimeType is guaranteed to be defined.
Key Changes:
- Added missing import for
file-upload-preview.element.jsin the image cropper editor modal - Added non-null assertions for mimeType usage to satisfy TypeScript checks
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Umbraco.Web.UI.Client/src/packages/media/media/modals/image-cropper-editor/image-cropper-editor-modal.element.ts | Adds missing import statement for file upload preview component |
| src/Umbraco.Web.UI.Client/src/packages/media/media/components/input-upload-field/file-upload-preview.element.ts | Adds non-null assertions for mimeType variable usage |
...Client/src/packages/media/media/components/input-upload-field/file-upload-preview.element.ts
Outdated
Show resolved
Hide resolved
...Client/src/packages/media/media/components/input-upload-field/file-upload-preview.element.ts
Outdated
Show resolved
Hide resolved
745b6a2 to
eb0b2f4
Compare
|
Hi @bjarnef Thanks again for the PR to fix #20596, where a missing component import was causing the image cropper modal to fail. One of the team will check and make sure all is good (I have a new computer setup so I don't have it handy to check right now). PS I've taken the liberty to rebase to get the latest changes from `main1 into this branch, hope that is ok. Best regards Emma |
|
@nielslyngsoe I think this is also at issue with latest changes for v17 :) |
leekelleher
left a comment
There was a problem hiding this comment.
Thanks @bjarnef. I've tested this out and it works great. 🙏
|
Okay, fixed the circular dependency! 👍 |
* Import missing component * Handle nullable type * Vertically center image * Add minimum width for SVG without dimensions * 100% height until max height * 100% height minus top/bottom padding * Revert "100% height minus top/bottom padding" This reverts commit 67ada4c. * Revert "Handle nullable type" This reverts commit 3130e11. * Removed flexbox style * Fixed circular dependency --------- Co-authored-by: leekelleher <leekelleher@gmail.com>
|
Picked for 16.5 with 9485a95 |
Prerequisites
If there's an existing issue for this PR then this fixes #20596
Description
The SVG preview didn't work in image cropper modal because the component wasn't imported in modal, so it only rendered
<umb-file-upload-preview></umb-file-upload-preview>in DOM.This includes the missing component.
Furthermore a SVG without dimensions also need a width/minimum width, otherwise the width was calculated to zero.
SVG image with width/height
SVG image without width/height
We can possible make
<umb-input-upload-field-svg>fill more of width/height - at least in image cropper modal even SVG contains dimensions as we know this is used specific for SVG files.. furthermore icons uploaded by content editor often may contain a small size like 16x16, 24x24 or 32x32 .. so it would be nicer with a larger preview.with
height: 100%onumb-input-upload-field-svgelement.