diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
index 1226a9e53e..20ef07e2ac 100644
--- a/src/wp-admin/includes/ajax-actions.php
+++ b/src/wp-admin/includes/ajax-actions.php
@@ -3004,7 +3004,6 @@ function wp_ajax_parse_embed() {
$parsed = $styles . $html . $scripts;
}
-
if ( ! empty( $no_ssl_support ) || ( is_ssl() && ( preg_match( '%<(iframe|script|embed) [^>]*src="http://%', $parsed ) ||
preg_match( '%]*href="http://%', $parsed ) ) ) ) {
// Admin is ssl and the embed is not. Iframes, scripts, and other "active content" will be blocked.
@@ -3014,10 +3013,23 @@ function wp_ajax_parse_embed() {
) );
}
- wp_send_json_success( array(
+ $return = array(
'body' => $parsed,
'attr' => $wp_embed->last_attr
- ) );
+ );
+
+ if ( strpos( $parsed, 'class="wp-embedded-content' ) ) {
+ if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
+ $script_src = includes_url( 'js/wp-embed.js' );
+ } else {
+ $script_src = includes_url( 'js/wp-embed.min.js' );
+ }
+
+ $return['head'] = '';
+ $return['sandbox'] = true;
+ }
+
+ wp_send_json_success( $return );
}
/**
diff --git a/src/wp-includes/class-wp-editor.php b/src/wp-includes/class-wp-editor.php
index 1d2c75c113..83777cfd8c 100644
--- a/src/wp-includes/class-wp-editor.php
+++ b/src/wp-includes/class-wp-editor.php
@@ -417,7 +417,6 @@ final class _WP_Editors {
'wpdialogs',
'wptextpattern',
'wpview',
- 'wpembed',
);
if ( ! self::$has_medialib ) {
diff --git a/src/wp-includes/js/mce-view.js b/src/wp-includes/js/mce-view.js
index 16d860d470..21b2c87b6a 100644
--- a/src/wp-includes/js/mce-view.js
+++ b/src/wp-includes/js/mce-view.js
@@ -468,7 +468,7 @@
* @param {Boolean} rendered Only set for (un)rendered nodes. Optional.
*/
setContent: function( content, callback, rendered ) {
- if ( _.isObject( content ) && content.body.indexOf( '