M4tx has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/183989

Change subject: Fix gallery rearrange on resize with missing images
......................................................................

Fix gallery rearrange on resize with missing images

Bug: T55664
Follow-ups I286e0a4c8230c11619ca30f8f3b66778de835a33

Change-Id: I95cc64de11df3197378f4873d62a76333d55b452
---
M resources/src/mediawiki.page/mediawiki.page.gallery.js
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/89/183989/1

diff --git a/resources/src/mediawiki.page/mediawiki.page.gallery.js 
b/resources/src/mediawiki.page/mediawiki.page.gallery.js
index ba1f323..5be1fea 100644
--- a/resources/src/mediawiki.page/mediawiki.page.gallery.js
+++ b/resources/src/mediawiki.page/mediawiki.page.gallery.js
@@ -221,12 +221,14 @@
                                var imgWidth = $( this ).data( 'imgWidth' ),
                                        imgHeight = $( this ).data( 'imgHeight' 
),
                                        width = $( this ).data( 'width' ),
-                                       captionWidth = $( this ).data( 
'captionWidth' );
+                                       captionWidth = $( this ).data( 
'captionWidth' ),
+                                       $innerDiv = $( this ).children( 'div' 
).first(),
+                                       $imageDiv = $innerDiv.children( 
'div.thumb' );
 
                                // Restore original sizes so we can arrange the 
elements as on freshly loaded page
                                $( this ).width( width );
-                               $( this ).children( 'div' ).first().width( 
width );
-                               $( this ).children( 'div' ).first().children( 
'div.thumb' ).width( imgWidth );
+                               $innerDiv.width( width );
+                               $imageDiv.width( imgWidth );
                                $( this ).find( 'div.gallerytextwrapper' 
).width( captionWidth );
 
                                var $imageElm = $( this ).find( 'img' ).first(),
@@ -234,6 +236,8 @@
                                if ( imageElm ) {
                                        imageElm.width = imgWidth;
                                        imageElm.height = imgHeight;
+                               } else {
+                                       $imageDiv.height( imgHeight );
                                }
                        } );
                } ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/183989
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I95cc64de11df3197378f4873d62a76333d55b452
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: M4tx <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to