TinyMCE wpView: add a filter for the stylesheet URLs loaded in the sandbox iframes. See #29048.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-08-20 21:34:15 +00:00
parent 557861446f
commit 53c047263b
2 changed files with 13 additions and 4 deletions

View File

@ -2677,7 +2677,7 @@ function wp_ajax_parse_embed() {
if ( has_shortcode( $parsed, 'audio' ) || has_shortcode( $parsed, 'video' ) ) { if ( has_shortcode( $parsed, 'audio' ) || has_shortcode( $parsed, 'video' ) ) {
$styles = ''; $styles = '';
$mce_styles = wp_media_mce_styles(); $mce_styles = wpview_media_sandbox_styles();
foreach ( $mce_styles as $style ) { foreach ( $mce_styles as $style ) {
$styles .= sprintf( '<link rel="stylesheet" href="%s"/>', $style ); $styles .= sprintf( '<link rel="stylesheet" href="%s"/>', $style );
} }
@ -2728,7 +2728,7 @@ function wp_ajax_parse_media_shortcode() {
ob_start(); ob_start();
$styles = wp_media_mce_styles(); $styles = wpview_media_sandbox_styles();
foreach ( $styles as $style ) { foreach ( $styles as $style ) {
printf( '<link rel="stylesheet" href="%s"/>', $style ); printf( '<link rel="stylesheet" href="%s"/>', $style );
} }

View File

@ -3308,11 +3308,20 @@ function attachment_url_to_postid( $url ) {
* *
* @return array The relevant CSS file URLs. * @return array The relevant CSS file URLs.
*/ */
function wp_media_mce_styles() { function wpview_media_sandbox_styles() {
$version = 'ver=' . $GLOBALS['wp_version']; $version = 'ver=' . $GLOBALS['wp_version'];
$dashicons = includes_url( "css/dashicons.css?$version" ); $dashicons = includes_url( "css/dashicons.css?$version" );
$mediaelement = includes_url( "js/mediaelement/mediaelementplayer.min.css?$version" ); $mediaelement = includes_url( "js/mediaelement/mediaelementplayer.min.css?$version" );
$wpmediaelement = includes_url( "js/mediaelement/wp-mediaelement.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 ) );
} }