diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index ee2860f583..82ec147afc 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -2677,7 +2677,7 @@ function wp_ajax_parse_embed() { if ( has_shortcode( $parsed, 'audio' ) || has_shortcode( $parsed, 'video' ) ) { $styles = ''; - $mce_styles = wp_media_mce_styles(); + $mce_styles = wpview_media_sandbox_styles(); foreach ( $mce_styles as $style ) { $styles .= sprintf( '', $style ); } @@ -2728,7 +2728,7 @@ function wp_ajax_parse_media_shortcode() { ob_start(); - $styles = wp_media_mce_styles(); + $styles = wpview_media_sandbox_styles(); foreach ( $styles as $style ) { printf( '', $style ); } diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 3ac5ece8ca..f9ffc6f3c8 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -3308,11 +3308,20 @@ function attachment_url_to_postid( $url ) { * * @return array The relevant CSS file URLs. */ -function wp_media_mce_styles() { +function wpview_media_sandbox_styles() { $version = 'ver=' . $GLOBALS['wp_version']; $dashicons = includes_url( "css/dashicons.css?$version" ); $mediaelement = includes_url( "js/mediaelement/mediaelementplayer.min.css?$version" ); $wpmediaelement = includes_url( "js/mediaelement/wp-mediaelement.css?$version" ); - return array( $dashicons, $mediaelement, $wpmediaelement ); + /** + * For use by themes that need to override the styling of MediaElement based previews in the Visual editor. + * Not intended for adding editor-style.css. Ideally these styles will be applied by using + * the 'seamless' iframe attribute in the future. + * + * @since 4.0 + * + * @param array The URLs to the stylesheets that will be loaded in the sandbox iframe. + */ + return apply_filters( 'wpview_media_sandbox_styles', array( $dashicons, $mediaelement, $wpmediaelement ) ); }