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

Built from https://develop.svn.wordpress.org/trunk@27580


git-svn-id: http://core.svn.wordpress.org/trunk@27423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz
2014-03-18 03:25:14 +00:00
parent a322a0cd3d
commit 46a471489e
3 changed files with 15 additions and 12 deletions

View File

@@ -897,12 +897,6 @@ function wp_print_media_templates() {
</div>
</div>
</script>
<?php
//TODO: do we want to deal with the fact that the elements used for gallery items are filterable and can be overriden via shortcode attributes
// do we want to deal with the difference between display and edit context at all? (e.g. wptexturize() being applied to the caption.
?>
<script type="text/html" id="tmpl-editor-gallery">
<div class="toolbar">
<div class="dashicons dashicons-edit edit"></div>
@@ -912,14 +906,12 @@ function wp_print_media_templates() {
<# _.each( data.attachments, function( attachment, index ) { #>
<dl class="gallery-item">
<dt class="gallery-icon">
<?php // TODO: need to figure out the best way to make sure that we have thumbnails ?>
<img src="{{{ attachment.sizes.thumbnail.url }}}" />
<img src="{{{ attachment.thumbnail.url }}}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" />
</dt>
<dd class="wp-caption-text gallery-caption">
{{ attachment.caption }}
</dd>
</dl>
<?php // this is kind silly, but copied from the gallery shortcode. Maybe it should be removed ?>
<# if ( index % data.columns === data.columns - 1 ) { #>
<br style="clear: both;">
<# } #>