Media: Trim whitespace in URLs provided for external embeds.

Also avoid showing error notice in media widget when URL field is empty.

Props timmydcrawford, westonruter.
Fixes #40771.

Built from https://develop.svn.wordpress.org/trunk@40772


git-svn-id: http://core.svn.wordpress.org/trunk@40630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-05-17 01:59:42 +00:00
parent 509e706c13
commit 764d8b521f
5 changed files with 10 additions and 7 deletions

View File

@ -142,9 +142,6 @@ wp.mediaWidgets = ( function( $ ) {
/**
* Fetch media.
*
* This is a TEMPORARY measure until the WP API supports an oEmbed proxy endpoint. See #40450.
*
* @see https://core.trac.wordpress.org/ticket/40450
* @returns {void}
*/
fetch: function() {
@ -154,6 +151,12 @@ wp.mediaWidgets = ( function( $ ) {
embedLinkView.dfd.abort();
}
// Abort if the URL field was emptied out.
if ( ! embedLinkView.model.get( 'url' ) ) {
embedLinkView.setErrorNotice( '' );
return;
}
fetchSuccess = function( response ) {
embedLinkView.renderoEmbed({
data: {

File diff suppressed because one or more lines are too long

View File

@ -4739,7 +4739,7 @@ EmbedUrl = View.extend({
},
url: function( event ) {
this.model.set( 'url', event.target.value );
this.model.set( 'url', $.trim( event.target.value ) );
},
/**

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-beta1-40771';
$wp_version = '4.8-beta1-40772';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.