Skip to content

Commit 8fee7c4

Browse files
authored
Fix viewed images not loading in a PR (#19919)
Close #19651
1 parent cdb81f3 commit 8fee7c4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

web_src/js/features/imagediff.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ export default function initImageDiff() {
6767
$('.image-diff').each(function() {
6868
const $container = $(this);
6969

70-
const diffContainerWidth = $container.width() - 300;
70+
// the container may be hidden by "viewed" checkbox, so use the parent's width for reference
71+
const diffContainerWidth = Math.max($container.closest('.diff-file-box').width() - 300, 100);
7172
const pathAfter = $container.data('path-after');
7273
const pathBefore = $container.data('path-before');
7374

0 commit comments

Comments
 (0)