Make WordPress Core

Ticket #31669: 31669.patch

File 31669.patch, 1.8 KB (added by iseulde, 10 years ago)
  • src/wp-includes/js/mce-view.js

     
    7777                 */
    7878                unbind: function() {
    7979                        _.each( instances, function( instance ) {
    80                                 instance.unbind();
     80                                instance.unbindAll();
    8181                        } );
    8282                },
    8383
     
    307307                        }
    308308
    309309                        // We're about to rerender all views of this instance, so unbind rendered views.
    310                         force && this.unbind();
     310                        force && this.unbindAll();
    311311
    312312                        // Replace any left over markers.
    313313                        this.replaceMarkers();
    314314
    315315                        if ( this.getContent() ) {
    316316                                this.setContent( this.getContent(), function( editor, node ) {
    317                                         $( node ).data( 'rendered', true ).trigger( 'wp-mce-view-bind' );
     317                                        $( node ).data( 'rendered', true );
     318                                        this.bind.apply( this, arguments );
    318319                                }, force ? null : false );
    319320                        } else {
    320321                                this.setLoader();
     
    322323                },
    323324
    324325                /**
     326                 * Binds a given node after its content is added to the DOM.
     327                 */
     328                bind: function() {},
     329
     330                /**
     331                 * Unbinds a given node before its content is removed from the DOM.
     332                 */
     333                unbind: function() {},
     334
     335                /**
    325336                 * Unbinds all view nodes tied to this view instance.
    326337                 * Runs before their content is removed from the DOM.
    327338                 */
    328                 unbind: function() {
     339                unbindAll: function() {
    329340                        this.getNodes( function( editor, node ) {
     341                                this.unbind.apply( this, arguments );
    330342                                $( node ).trigger( 'wp-mce-view-unbind' );
    331343                        }, true );
    332344                },
     
    663675                 * @param {HTMLElement}    node   The view node to remove.
    664676                 */
    665677                remove: function( editor, node ) {
     678                        this.unbind.call( this, editor, node, $( node ).find( '.wpview-content' ).get( 0 ) );
    666679                        $( node ).trigger( 'wp-mce-view-unbind' );
    667680                        editor.dom.remove( node );
    668681                }