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();
$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 = '';

View File

@ -1334,10 +1334,14 @@ body.custom-background { <?php echo trim( $style ); ?> }
* 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.