From dd45b9c2cab9eba2bd960ede6545b348aa823eb6 Mon Sep 17 00:00:00 2001 From: azaozz Date: Thu, 1 Mar 2012 00:18:26 +0000 Subject: [PATCH] Don't pass non-existing rtl stylesheet to TinyMCE, update phpdoc for add_editor_style(), see #19437 git-svn-id: http://svn.automattic.com/wordpress/trunk@20059 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-editor.php | 21 +++++++++++---------- wp-includes/theme.php | 8 ++++++-- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php index af69b0870..fdd4fbf91 100644 --- a/wp-includes/class-wp-editor.php +++ b/wp-includes/class-wp-editor.php @@ -328,24 +328,25 @@ final class _WP_Editors { $mce_css = array(); $editor_styles = array_unique($editor_styles); $style_uri = get_stylesheet_directory_uri(); - if ( ! is_child_theme() ) { - foreach ( $editor_styles as $file ) + $style_dir = get_stylesheet_directory(); + + foreach ( $editor_styles as $key => $file ) { + if ( $file && file_exists( "$style_dir/$file" ) ) { $mce_css[] = "$style_uri/$file"; - } else { - $style_dir = get_stylesheet_directory(); + $editor_styles[$key] = ''; + } + } + + if ( is_child_theme() ) { $template_uri = get_template_directory_uri(); $template_dir = get_template_directory(); foreach ( $editor_styles as $file ) { - if ( file_exists( "$template_dir/$file" ) ) + if ( $file && file_exists( "$template_dir/$file" ) ) $mce_css[] = "$template_uri/$file"; } - - foreach ( $editor_styles as $file ) { - if ( file_exists( "$style_dir/$file" ) ) - $mce_css[] = "$style_uri/$file"; - } } + $mce_css = implode( ',', $mce_css ); } else { $mce_css = ''; diff --git a/wp-includes/theme.php b/wp-includes/theme.php index fcc1f6155..c1b2220d6 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1334,10 +1334,14 @@ body.custom-background { } * the theme root. It also accepts an array of stylesheets. * It is optional and defaults to 'editor-style.css'. * - * Supports RTL stylesheets automatically by searching for the -rtl prefix, e.g. - * editor-style-rtl.css. If an array of stylesheets is passed to add_editor_style(), + * This function automatically adds another stylesheet with -rtl prefix, e.g. editor-style-rtl.css. + * If that file doesn't exist, it is removed before adding the stylesheet(s) to TinyMCE. + * If an array of stylesheets is passed to add_editor_style(), * RTL is only added for the first stylesheet. * + * Since version 3.4 the TinyMCE body has .rtl CSS class. + * It is a better option to use that class and add any RTL styles to the main stylesheet. + * * @since 3.0.0 * * @param mixed $stylesheet Optional. Stylesheet name or array thereof, relative to theme root.