Ticket #32035: 32035.diff
File 32035.diff, 2.8 KB (added by , 9 years ago) |
---|
-
src/wp-includes/js/media/views/embed/link.js
45 45 return; 46 46 } 47 47 48 if ( this.dfd && 'pending' === this.dfd.state() ) { 49 this.dfd.abort(); 50 } 51 48 52 embed = new wp.shortcode({ 49 53 tag: 'embed', 50 54 attrs: _.pick( this.model.attributes, [ 'width', 'height', 'src' ] ), … … 51 55 content: this.model.get('url') 52 56 }); 53 57 54 wp.ajax.send( 'parse-embed', { 55 data : { 58 this.dfd = $.ajax({ 59 type: 'POST', 60 url: wp.ajax.settings.url, 61 context: this, 62 data: { 63 action: 'parse-embed', 56 64 post_ID: wp.media.view.settings.post.id, 57 65 shortcode: embed.string() 58 66 } 59 } 60 .done( _.bind( this.renderoEmbed, this ))61 .fail( _.bind( this.renderFail, this ));67 }) 68 .done( this.renderoEmbed ) 69 .fail( this.renderFail ); 62 70 }, 63 71 64 renderFail: function () { 72 renderFail: function ( response, status ) { 73 if ( 'abort' === status ) { 74 return; 75 } 65 76 this.$( '.link-text' ).show(); 66 77 }, 67 78 68 79 renderoEmbed: function( response ) { 69 var html = ( response && response. body ) || '';80 var html = ( response && response.data && response.data.body ) || ''; 70 81 71 82 if ( html ) { 72 83 this.$('.embed-container').show().find('.embed-preview').html( html ); -
src/wp-includes/js/media-views.js
4561 4561 return; 4562 4562 } 4563 4563 4564 if ( this.dfd && 'pending' === this.dfd.state() ) { 4565 this.dfd.abort(); 4566 } 4567 4564 4568 embed = new wp.shortcode({ 4565 4569 tag: 'embed', 4566 4570 attrs: _.pick( this.model.attributes, [ 'width', 'height', 'src' ] ), … … 4567 4571 content: this.model.get('url') 4568 4572 }); 4569 4573 4570 wp.ajax.send( 'parse-embed', { 4571 data : { 4574 this.dfd = $.ajax({ 4575 type: 'POST', 4576 url: wp.ajax.settings.url, 4577 context: this, 4578 data: { 4579 action: 'parse-embed', 4572 4580 post_ID: wp.media.view.settings.post.id, 4573 4581 shortcode: embed.string() 4574 4582 } 4575 } 4576 .done( _.bind( this.renderoEmbed, this ))4577 .fail( _.bind( this.renderFail, this ));4583 }) 4584 .done( this.renderoEmbed ) 4585 .fail( this.renderFail ); 4578 4586 }, 4579 4587 4580 renderFail: function () { 4588 renderFail: function ( response, status ) { 4589 if ( 'abort' === status ) { 4590 return; 4591 } 4581 4592 this.$( '.link-text' ).show(); 4582 4593 }, 4583 4594 4584 4595 renderoEmbed: function( response ) { 4585 var html = ( response && response. body ) || '';4596 var html = ( response && response.data && response.data.body ) || ''; 4586 4597 4587 4598 if ( html ) { 4588 4599 this.$('.embed-container').show().find('.embed-preview').html( html );