TinyMCE gallery preview: fix errors when an image doesn't have/is smaller than thumbnail size, props gcorne, see #26959

git-svn-id: https://develop.svn.wordpress.org/trunk@27580 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2014-03-18 03:24:17 +00:00
parent 30a83e48e2
commit 8e403519db
2 changed files with 14 additions and 11 deletions
+13 -2
View File
@@ -268,14 +268,25 @@ window.wp = window.wp || {};
getHtml: function() {
var attrs = this.shortcode.attrs.named,
options;
options,
attachments;
if ( ! this.attachments.length ) {
return;
}
attachments = this.attachments.toJSON();
_.each( attachments, function( attachment ) {
if ( attachment.sizes.thumbnail ) {
attachment.thumbnail = attachment.sizes.thumbnail;
} else {
attachment.thumbnail = attachment.sizes.full;
}
} );
options = {
attachments: this.attachments.toJSON(),
attachments: attachments,
columns: attrs.columns ? parseInt( attrs.columns, 10 ) : 3
};