Fix viewed images not loading in a PR (#19919)

Close #19651
This commit is contained in:
wxiaoguang 2022-06-09 01:19:06 +08:00 committed by GitHub
parent cdb81f32ac
commit 8fee7c46c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -67,7 +67,8 @@ export default function initImageDiff() {
$('.image-diff').each(function() { $('.image-diff').each(function() {
const $container = $(this); const $container = $(this);
const diffContainerWidth = $container.width() - 300; // the container may be hidden by "viewed" checkbox, so use the parent's width for reference
const diffContainerWidth = Math.max($container.closest('.diff-file-box').width() - 300, 100);
const pathAfter = $container.data('path-after'); const pathAfter = $container.data('path-after');
const pathBefore = $container.data('path-before'); const pathBefore = $container.data('path-before');