When using wp_editor(), make it easier to specify which editor is shown first, fixes #20822

git-svn-id: https://develop.svn.wordpress.org/trunk@27093 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-02-05 00:33:49 +00:00
parent 6aaad4785a
commit b33135c08d
1 changed files with 8 additions and 4 deletions

View File

@ -31,6 +31,7 @@ final class _WP_Editors {
$set = wp_parse_args( $settings, array(
'wpautop' => true, // use wpautop?
'media_buttons' => true, // show insert/upload button(s)
'default_editor' => '', // When both TinyMCE and Quicktags are used, set which editor is shown on loading the page
'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
'textarea_rows' => 20,
'tabindex' => '',
@ -100,12 +101,15 @@ final class _WP_Editors {
if ( !current_user_can( 'upload_files' ) )
$set['media_buttons'] = false;
if ( self::$this_quicktags && self::$this_tinymce ) {
$switch_class = 'html-active';
if ( ! self::$this_quicktags && self::$this_tinymce ) {
$switch_class = 'tmce-active';
} elseif ( self::$this_quicktags && self::$this_tinymce ) {
$default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
// 'html' and 'switch-html' are used for the "Text" editor tab.
if ( 'html' == wp_default_editor() ) {
// 'html' is used for the "Text" editor tab.
if ( 'html' === $default_editor ) {
add_filter('the_editor_content', 'wp_htmledit_pre');
$switch_class = 'html-active';
} else {
add_filter('the_editor_content', 'wp_richedit_pre');
$switch_class = 'tmce-active';