Ticket #28788: 28788.2.patch
File 28788.2.patch, 3.6 KB (added by , 9 years ago) |
---|
-
src/wp-includes/js/mce-view.js
46 46 '<div class="wpview-loading"><ins></ins></div>' + 47 47 '</div>'; 48 48 }, 49 render: function() { 50 this.setContent( 51 '<p class="wpview-selection-before">\u00a0</p>' + 52 '<div class="wpview-body" contenteditable="false">' + 53 '<div class="toolbar">' + 54 ( _.isFunction( views[ this.type ].edit ) ? '<div class="dashicons dashicons-edit edit"></div>' : '' ) + 55 '<div class="dashicons dashicons-no-alt remove"></div>' + 56 '</div>' + 57 '<div class="wpview-content wpview-type-' + this.type + '">' + 58 ( this.getHtml() || this.loadingPlaceholder() ) + 49 render: function( force ) { 50 if ( force || ! this.rendered() ) { 51 this.unbind(); 52 53 this.setContent( 54 '<p class="wpview-selection-before">\u00a0</p>' + 55 '<div class="wpview-body" contenteditable="false">' + 56 '<div class="toolbar">' + 57 ( _.isFunction( views[ this.type ].edit ) ? '<div class="dashicons dashicons-edit edit"></div>' : '' ) + 58 '<div class="dashicons dashicons-no-alt remove"></div>' + 59 '</div>' + 60 '<div class="wpview-content wpview-type-' + this.type + '">' + 61 ( this.getHtml() || this.loadingPlaceholder() ) + 62 '</div>' + 63 ( this.overlay ? '<div class="wpview-overlay"></div>' : '' ) + 59 64 '</div>' + 60 ( this.overlay ? '<div class="wpview-overlay"></div>' : '' ) +61 '</div>' +62 '<p class="wpview-selection-after">\u00a0</p>',63 'wrap' 64 );65 '<p class="wpview-selection-after">\u00a0</p>', 66 'wrap' 67 ); 68 69 $( this ).trigger( 'ready' ); 65 70 66 $( this ).trigger( 'ready' ); 71 this.rendered( true ); 72 } 67 73 }, 68 74 unbind: function() {}, 69 75 getEditors: function( callback ) { … … 186 192 '<p>' + message + '</p>' + 187 193 '</div>' 188 194 ); 195 }, 196 rendered: function( value ) { 197 var notRendered; 198 199 this.getNodes( function( editor, node ) { 200 if ( value != null ) { 201 $( node ).data( 'rendered', value === true ); 202 } else { 203 notRendered = notRendered || ! $( node ).data( 'rendered' ); 204 } 205 } ); 206 207 return ! notRendered; 189 208 } 190 209 } ); 191 210 … … 386 405 instances[ encodedText ] = instance; 387 406 } 388 407 389 wp.mce.views.render();408 instance.render(); 390 409 }, 391 410 392 411 getInstance: function( encodedText ) { … … 402 421 * To generate wrapper elements, pass your content through 403 422 * `wp.mce.view.toViews( content )`. 404 423 */ 405 render: function( ) {424 render: function( force ) { 406 425 _.each( instances, function( instance ) { 407 instance.render( );426 instance.render( force ); 408 427 } ); 409 428 }, 410 429 … … 434 453 }, 435 454 436 455 fetch: function() { 456 var self = this; 457 437 458 this.attachments = wp.media.gallery.attachments( this.shortcode, this.postID ); 438 this.dfd = this.attachments.more().done( _.bind( this.render, this ) ); 459 this.dfd = this.attachments.more().done( function() { 460 self.render( true ); 461 } ); 439 462 }, 440 463 441 464 getHtml: function() { -
src/wp-includes/js/tinymce/plugins/wpview/plugin.js
205 205 removeView( selected ); 206 206 } 207 207 208 if ( ! event.initial ) {209 wp.mce.views.unbind( editor );210 }211 212 208 node = editor.selection.getNode(); 213 209 214 210 // When a url is pasted, only try to embed it when pasted in an empty paragrapgh.