mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 16:21:26 +01:00
TinyMCE wpView: fix showing errors for non-embeddable URLs, no-ssl or no items. Props avryl, fixes #29114, see #29268.
Built from https://develop.svn.wordpress.org/trunk@29577 git-svn-id: http://core.svn.wordpress.org/trunk@29351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f2c881cf3b
commit
42258a6d89
@ -2723,7 +2723,10 @@ function wp_ajax_parse_media_shortcode() {
|
|||||||
$shortcode = do_shortcode( wp_unslash( $_REQUEST['shortcode'] ) );
|
$shortcode = do_shortcode( wp_unslash( $_REQUEST['shortcode'] ) );
|
||||||
|
|
||||||
if ( empty( $shortcode ) ) {
|
if ( empty( $shortcode ) ) {
|
||||||
wp_send_json_error( array( 'statusText' => __( 'No items found.' ) ) );
|
wp_send_json_error( array(
|
||||||
|
'type' => 'no-items',
|
||||||
|
'message' => __( 'No items found.' ),
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
@ -561,8 +561,8 @@ window.wp = window.wp || {};
|
|||||||
setNodes: function () {
|
setNodes: function () {
|
||||||
if ( this.parsed ) {
|
if ( this.parsed ) {
|
||||||
this.setIframes( this.parsed );
|
this.setIframes( this.parsed );
|
||||||
} else if ( this.parsed === false ) {
|
} else {
|
||||||
this.setContent( '<p>' + this.original + '</p>', 'replace' );
|
this.fail();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -576,30 +576,43 @@ window.wp = window.wp || {};
|
|||||||
shortcode: this.shortcode.string()
|
shortcode: this.shortcode.string()
|
||||||
}
|
}
|
||||||
} )
|
} )
|
||||||
.always( function() {
|
|
||||||
self.parsed = false;
|
|
||||||
} )
|
|
||||||
.done( function( response ) {
|
.done( function( response ) {
|
||||||
if ( response ) {
|
if ( response ) {
|
||||||
self.parsed = response;
|
self.parsed = response;
|
||||||
self.setIframes( response );
|
self.setIframes( response );
|
||||||
|
} else {
|
||||||
|
self.fail( true );
|
||||||
}
|
}
|
||||||
} )
|
} )
|
||||||
.fail( function( response ) {
|
.fail( function( response ) {
|
||||||
if ( response && response.message ) {
|
self.fail( response || true );
|
||||||
if ( ( response.type === 'not-embeddable' && self.type === 'embed' ) ||
|
|
||||||
response.type === 'not-ssl' ) {
|
|
||||||
|
|
||||||
self.setError( response.message, 'admin-media' );
|
|
||||||
} else {
|
|
||||||
self.setContent( '<p>' + self.original + '</p>', 'replace' );
|
|
||||||
}
|
|
||||||
} else if ( response && response.statusText ) {
|
|
||||||
self.setError( response.statusText, 'admin-media' );
|
|
||||||
}
|
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fail: function( error ) {
|
||||||
|
if ( ! this.error ) {
|
||||||
|
if ( error ) {
|
||||||
|
this.error = error
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( this.error.message ) {
|
||||||
|
if ( ( this.error.type === 'not-embeddable' && this.type === 'embed' ) || this.error.type === 'not-ssl' ||
|
||||||
|
this.error.type === 'no-items' ) {
|
||||||
|
|
||||||
|
this.setError( this.error.message, 'admin-media' );
|
||||||
|
} else {
|
||||||
|
this.setContent( '<p>' + this.original + '</p>', 'replace' );
|
||||||
|
}
|
||||||
|
} else if ( this.error.statusText ) {
|
||||||
|
this.setError( this.error.statusText, 'admin-media' );
|
||||||
|
} else if ( this.original ) {
|
||||||
|
this.setContent( '<p>' + this.original + '</p>', 'replace' );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
stopPlayers: function( remove ) {
|
stopPlayers: function( remove ) {
|
||||||
var rem = remove === 'remove';
|
var rem = remove === 'remove';
|
||||||
|
|
||||||
|
2
wp-includes/js/mce-view.min.js
vendored
2
wp-includes/js/mce-view.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user