summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-06-09 01:19:06 +0800
committerGitHub <noreply@github.com>2022-06-08 18:19:06 +0100
commit8fee7c46c16cbc1b46477cf600160f9668b9f5d0 (patch)
tree0f81711a3632484be33dc893750522ceab3ac3d6 /web_src
parentcdb81f32ac3c4c93daddcb0b4d87b48a3eb90598 (diff)
downloadgitea-8fee7c46c16cbc1b46477cf600160f9668b9f5d0.tar.gz
gitea-8fee7c46c16cbc1b46477cf600160f9668b9f5d0.zip
Fix viewed images not loading in a PR (#19919)
Close #19651
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/features/imagediff.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/web_src/js/features/imagediff.js b/web_src/js/features/imagediff.js
index 1745331768..0b021d070f 100644
--- a/web_src/js/features/imagediff.js
+++ b/web_src/js/features/imagediff.js
@@ -67,7 +67,8 @@ export default function initImageDiff() {
$('.image-diff').each(function() {
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 pathBefore = $container.data('path-before');