diff --git a/wp-includes/js/mce-view.js b/wp-includes/js/mce-view.js index 85484ef42b..c522d85e57 100644 --- a/wp-includes/js/mce-view.js +++ b/wp-includes/js/mce-view.js @@ -437,8 +437,9 @@ window.wp = window.wp || {}; * * @param view {object} being refreshed * @param text {string} textual representation of the view + * @param force {Boolean} whether to force rendering */ - refreshView: function( view, text ) { + refreshView: function( view, text, force ) { var encodedText = window.encodeURIComponent( text ), viewOptions, result, instance; @@ -454,7 +455,7 @@ window.wp = window.wp || {}; instances[ encodedText ] = instance; } - instance.render(); + instance.render( force ); }, getInstance: function( encodedText ) { @@ -525,7 +526,9 @@ window.wp = window.wp || {}; _.each( attachments, function( attachment ) { if ( attachment.sizes ) { - if ( attachment.sizes.thumbnail ) { + if ( attrs.size && attachment.sizes[ attrs.size ] ) { + attachment.thumbnail = attachment.sizes[ attrs.size ]; + } else if ( attachment.sizes.thumbnail ) { attachment.thumbnail = attachment.sizes.thumbnail; } else if ( attachment.sizes.full ) { attachment.thumbnail = attachment.sizes.full; @@ -552,9 +555,10 @@ window.wp = window.wp || {}; frame = gallery.edit( data ); frame.state('gallery-edit').on( 'update', function( selection ) { - var shortcode = gallery.shortcode( selection ).string(); + var shortcode = gallery.shortcode( selection ).string(), force; $( node ).attr( 'data-wpview-text', window.encodeURIComponent( shortcode ) ); - wp.mce.views.refreshView( self, shortcode ); + force = ( data !== shortcode ); + wp.mce.views.refreshView( self, shortcode, force ); }); frame.on( 'close', function() { diff --git a/wp-includes/js/mce-view.min.js b/wp-includes/js/mce-view.min.js index 685d42f12b..6a77e881ff 100644 --- a/wp-includes/js/mce-view.min.js +++ b/wp-includes/js/mce-view.min.js @@ -1 +1 @@ -window.wp=window.wp||{},function(a){"use strict";var b={},c={},d=wp.media,e=["encodedText"];wp.mce=wp.mce||{},wp.mce.View=function(a){a=a||{},this.type=a.type,_.extend(this,_.pick(a,e)),this.initialize.apply(this,arguments)},_.extend(wp.mce.View.prototype,{initialize:function(){},getHtml:function(){return""},loadingPlaceholder:function(){return'
',"wrap"),a(this).trigger("ready"),this.rendered(!0))},unbind:function(){},getEditors:function(a){var b=[];return _.each(tinymce.editors,function(c){c.plugins.wpview&&(a&&a(c),b.push(c))},this),b},getNodes:function(b){var c=[],d=this;return this.getEditors(function(e){a(e.getBody()).find('[data-wpview-text="'+d.encodedText+'"]').each(function(d,f){b&&b(e,f,a(f).find(".wpview-content").get(0)),c.push(f)})}),c},setContent:function(a,b){this.getNodes(function(c,d,e){var f="wrap"===b||"replace"===b?d:e,g=a;_.isString(g)&&(g=c.dom.createFragment(g)),"replace"===b?c.dom.replace(g,f):(f.innerHTML="",f.appendChild(g))})},setIframes:function(b,c){var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,e="video"===this.type||"audio"===this.type||"playlist"===this.type;b||-1!==c.indexOf("