Skip to content

Add support for SVG rendering in design management

What does this MR do and why?

SVGs without dimension attributes were spanning in the design list. To keep image inside the container, set a fixed height for image. Also, the offset dimensions are zero thus dimension calculation was breaking. If offset dimensions are zero, calculate the image base dimensions from natural dimensions. Set the dimension on mount so that zoom works properly.

Screenshots or screen recordings

Before screenshot After screenshot
affected_svg_image Screenshot_2023-02-02_at_3.12.58_PM
Screenshot_2023-02-02_at_3.16.14_PM Screenshot_2023-02-02_at_3.14.00_PM

How to set up and validate locally

  1. In rails console enable the feature flag Feature.enable(:design_management_allow_dangerous_images)
  2. Go to Group > Project > Issues
  3. Create a Issue
  4. Upload an SVG image without height and width dimensions
  5. Check if the SVG is rendering in the list
  6. Click on the SVG image
  7. Check if the SVG is rendering on screen

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #388711 (closed)

Edited by Rajan Mistry

Merge request reports

Loading