Make WordPress Core

Ticket #29114: 29114.2.patch

File 29114.2.patch, 2.1 KB (added by iseulde, 12 years ago)
  • src/wp-includes/js/mce-view.js

     
    561561                        setNodes: function () {
    562562                                if ( this.parsed ) {
    563563                                        this.setIframes( this.parsed );
    564                                 } else if ( this.parsed === false ) {
    565                                         this.setContent( '<p>' + this.original + '</p>', 'replace' );
     564                                } else {
     565                                        this.fail();
    566566                                }
    567567                        },
    568568
     
    576576                                                shortcode: this.shortcode.string()
    577577                                        }
    578578                                } )
    579                                 .always( function() {
    580                                         self.parsed = false;
    581                                 } )
    582579                                .done( function( response ) {
    583580                                        if ( response ) {
    584581                                                self.parsed = response;
    585582                                                self.setIframes( response );
     583                                        } else {
     584                                                self.fail( true );
    586585                                        }
    587586                                } )
    588587                                .fail( function( response ) {
    589                                         if ( response && response.message ) {
    590                                                 if ( ( response.type === 'not-embeddable' && self.type === 'embed' ) ||
    591                                                         response.type === 'not-ssl' ) {
    592 
    593                                                         self.setError( response.message, 'admin-media' );
    594                                                 } else {
    595                                                         self.setContent( '<p>' + self.original + '</p>', 'replace' );
    596                                                 }
    597                                         } else if ( response && response.statusText ) {
    598                                                 self.setError( response.statusText, 'admin-media' );
    599                                         }
     588                                        self.fail( response || true );
     589                                } )
     590                                .always( function() {
     591                                        self.fail( ! self.parsed );
    600592                                } );
    601593                        },
    602594
     595                        fail: function( error ) {
     596                                if ( ! this.error ) {
     597                                        if ( error ) {
     598                                                this.error = error
     599                                        } else {
     600                                                return;
     601                                        }
     602                                }
     603
     604                                if ( this.error.message ) {
     605                                        if ( ( this.error.type === 'not-embeddable' && this.type === 'embed' ) || this.error.type === 'not-ssl' ) {
     606                                                this.setError( this.error.message, 'admin-media' );
     607                                        } else {
     608                                                this.setContent( '<p>' + this.original + '</p>', 'replace' );
     609                                        }
     610                                } else if ( this.error.statusText ) {
     611                                        this.setError( this.error.statusText, 'admin-media' );
     612                                } else if ( this.original ) {
     613                                        this.setContent( '<p>' + this.original + '</p>', 'replace' );
     614                                }
     615                        },
     616
    603617                        stopPlayers: function( remove ) {
    604618                                var rem = remove === 'remove';
    605619