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
This commit is contained in:
azaozz 2012-03-01 00:18:26 +00:00
parent db721d86c7
commit dd45b9c2ca
2 changed files with 17 additions and 12 deletions

View File

@ -328,24 +328,25 @@ final class _WP_Editors {
$mce_css = array(); $mce_css = array();
$editor_styles = array_unique($editor_styles); $editor_styles = array_unique($editor_styles);
$style_uri = get_stylesheet_directory_uri(); $style_uri = get_stylesheet_directory_uri();
if ( ! is_child_theme() ) { $style_dir = get_stylesheet_directory();
foreach ( $editor_styles as $file )
foreach ( $editor_styles as $key => $file ) {
if ( $file && file_exists( "$style_dir/$file" ) ) {
$mce_css[] = "$style_uri/$file"; $mce_css[] = "$style_uri/$file";
} else { $editor_styles[$key] = '';
$style_dir = get_stylesheet_directory(); }
}
if ( is_child_theme() ) {
$template_uri = get_template_directory_uri(); $template_uri = get_template_directory_uri();
$template_dir = get_template_directory(); $template_dir = get_template_directory();
foreach ( $editor_styles as $file ) { foreach ( $editor_styles as $file ) {
if ( file_exists( "$template_dir/$file" ) ) if ( $file && file_exists( "$template_dir/$file" ) )
$mce_css[] = "$template_uri/$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 ); $mce_css = implode( ',', $mce_css );
} else { } else {
$mce_css = ''; $mce_css = '';

View File

@ -1334,10 +1334,14 @@ body.custom-background { <?php echo trim( $style ); ?> }
* the theme root. It also accepts an array of stylesheets. * the theme root. It also accepts an array of stylesheets.
* It is optional and defaults to 'editor-style.css'. * It is optional and defaults to 'editor-style.css'.
* *
* Supports RTL stylesheets automatically by searching for the -rtl prefix, e.g. * This function automatically adds another stylesheet with -rtl prefix, e.g. editor-style-rtl.css.
* editor-style-rtl.css. If an array of stylesheets is passed to add_editor_style(), * 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. * 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 * @since 3.0.0
* *
* @param mixed $stylesheet Optional. Stylesheet name or array thereof, relative to theme root. * @param mixed $stylesheet Optional. Stylesheet name or array thereof, relative to theme root.