Skip to content

Conversation

@bjarnef
Copy link
Contributor

@bjarnef bjarnef commented Oct 25, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

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

image

SVG image without width/height

image

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% on umb-input-upload-field-svg element.

image

Copilot AI review requested due to automatic review settings October 25, 2025 19:42
@github-actions
Copy link

github-actions bot commented Oct 25, 2025

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:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • 💡 The contribution looks original and the contributor is presumably allowed to share it

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 🤖 🙂

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.js in 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opening SVG media from media picker doesn't show preview

1 participant