Revert editing of video embed parameters in the media modal, [31620] and [31626] for now. Plan on revisiting in 4.3.

Props iseulde. Fixes #31139, fixes #32006.

git-svn-id: https://develop.svn.wordpress.org/trunk@32258 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2015-04-21 22:40:23 +00:00
parent 312edcbc9d
commit 925682e2d1
7 changed files with 21 additions and 129 deletions
+3 -4
View File
@@ -818,12 +818,11 @@ window.wp = window.wp || {};
edit: function( text, update ) {
var media = wp.media.embed,
frame = media.edit( text, this.url ),
self = this,
events = 'change:url change:width change:height';
self = this;
this.pausePlayers();
frame.state( 'embed' ).props.on( events, function( model, url ) {
frame.state( 'embed' ).props.on( 'change:url', function( model, url ) {
if ( url && model.get( 'url' ) ) {
frame.state( 'embed' ).metadata = model.toJSON();
}
@@ -832,7 +831,7 @@ window.wp = window.wp || {};
frame.state( 'embed' ).on( 'select', function() {
var data = frame.state( 'embed' ).metadata;
if ( self.url && ! data.width ) {
if ( self.url ) {
update( data.url );
} else {
update( media.shortcode( data ).string() );
+7 -36
View File
@@ -4535,7 +4535,7 @@ EmbedLink = wp.media.view.Settings.extend({
initialize: function() {
this.spinner = $('<span class="spinner" />');
this.$el.append( this.spinner[0] );
this.listenTo( this.model, 'change:url change:width change:height', this.updateoEmbed );
this.listenTo( this.model, 'change:url', this.updateoEmbed );
},
updateoEmbed: _.debounce( function() {
@@ -4554,23 +4554,15 @@ EmbedLink = wp.media.view.Settings.extend({
}, 600 ),
fetch: function() {
var embed;
// check if they haven't typed in 500 ms
if ( $('#embed-url-field').val() !== this.model.get('url') ) {
return;
}
embed = new wp.shortcode({
tag: 'embed',
attrs: _.pick( this.model.attributes, [ 'width', 'height', 'src' ] ),
content: this.model.get('url')
});
wp.ajax.send( 'parse-embed', {
data : {
post_ID: wp.media.view.settings.post.id,
shortcode: embed.string()
shortcode: '[embed]' + this.model.get('url') + '[/embed]'
}
} )
.done( _.bind( this.renderoEmbed, this ) )
@@ -4578,38 +4570,17 @@ EmbedLink = wp.media.view.Settings.extend({
},
renderFail: function () {
this.$( '.setting' ).hide().filter( '.link-text' ).show();
this.$( '.link-text' ).show();
},
renderoEmbed: function( response ) {
var html = ( response && response.body ) || '',
attr = {},
opts = { silent: true };
var html = ( response && response.body ) || '';
this.$( '.setting' ).hide()
.filter( '.link-text' )[ html ? 'hide' : 'show' ]();
if ( response && response.attr ) {
attr = response.attr;
_.each( [ 'width', 'height' ], function ( key ) {
var $el = this.$( '.setting.' + key ),
value = attr[ key ];
if ( value ) {
this.model.set( key, value, opts );
$el.show().find( 'input' ).val( value );
} else {
this.model.unset( key, opts );
$el.hide().find( 'input' ).val( '' );
}
}, this );
if ( html ) {
this.$('.embed-container').show().find('.embed-preview').html( html );
} else {
this.model.unset( 'height', opts );
this.model.unset( 'width', opts );
this.renderFail();
}
this.$('.embed-container').show().find('.embed-preview').html( html );
}
});
+7 -36
View File
@@ -19,7 +19,7 @@ EmbedLink = wp.media.view.Settings.extend({
initialize: function() {
this.spinner = $('<span class="spinner" />');
this.$el.append( this.spinner[0] );
this.listenTo( this.model, 'change:url change:width change:height', this.updateoEmbed );
this.listenTo( this.model, 'change:url', this.updateoEmbed );
},
updateoEmbed: _.debounce( function() {
@@ -38,23 +38,15 @@ EmbedLink = wp.media.view.Settings.extend({
}, 600 ),
fetch: function() {
var embed;
// check if they haven't typed in 500 ms
if ( $('#embed-url-field').val() !== this.model.get('url') ) {
return;
}
embed = new wp.shortcode({
tag: 'embed',
attrs: _.pick( this.model.attributes, [ 'width', 'height', 'src' ] ),
content: this.model.get('url')
});
wp.ajax.send( 'parse-embed', {
data : {
post_ID: wp.media.view.settings.post.id,
shortcode: embed.string()
shortcode: '[embed]' + this.model.get('url') + '[/embed]'
}
} )
.done( _.bind( this.renderoEmbed, this ) )
@@ -62,38 +54,17 @@ EmbedLink = wp.media.view.Settings.extend({
},
renderFail: function () {
this.$( '.setting' ).hide().filter( '.link-text' ).show();
this.$( '.link-text' ).show();
},
renderoEmbed: function( response ) {
var html = ( response && response.body ) || '',
attr = {},
opts = { silent: true };
var html = ( response && response.body ) || '';
this.$( '.setting' ).hide()
.filter( '.link-text' )[ html ? 'hide' : 'show' ]();
if ( response && response.attr ) {
attr = response.attr;
_.each( [ 'width', 'height' ], function ( key ) {
var $el = this.$( '.setting.' + key ),
value = attr[ key ];
if ( value ) {
this.model.set( key, value, opts );
$el.show().find( 'input' ).val( value );
} else {
this.model.unset( key, opts );
$el.hide().find( 'input' ).val( '' );
}
}, this );
if ( html ) {
this.$('.embed-container').show().find('.embed-preview').html( html );
} else {
this.model.unset( 'height', opts );
this.model.unset( 'width', opts );
this.renderFail();
}
this.$('.embed-container').show().find('.embed-preview').html( html );
}
});