Commit f864a75
committed
fix(Mime): do not set natural dimensions when embedded Handler
components (Images.vue, Videos.vue, Audios.vue) are mounted
outside of the Viewer's own modal by other apps, e.g. the Files app's
ReferenceFileWidget for Smart Picker previews. updateHeightWidth()
detected \"inside the modal\" by searching for a .modal-wrapper in the
parent DOM; anywhere else it fell through to natural image/video size,
producing hardcoded inline dimensions such as
style=\"height: 1912px; width: 2940px\" that get clipped by the
widget's overflow: hidden container.
Declare the isEmbedded prop (already passed as is-embedded by
ReferenceFileWidget.vue but previously swallowed into \$attrs) and
return early from updateHeightWidth() when set, leaving height/width
unset. Images.vue's imgStyle must return {} in that case too, since
Math.round(null * zoomRatio) would otherwise emit
style=\"height: 0px; width: 0px\" and blank the widget. Let CSS size
the element instead via a new .embedded modifier using
object-fit: contain, so the aspect ratio is preserved without
upscaling small images.
The modal path (.modal-wrapper found) and the existing \"natural
dimensions not yet measured\" fallback are unchanged.
Assisted-by: Claude Sonnet 5:claude-sonnet-5
Signed-off-by: Jos Poortvliet <jospoortvliet@gmail.com>1 parent 873c56a commit f864a75
0 file changed
0 commit comments