Make WordPress Core

Ticket #20822: 20822.patch

File 20822.patch, 1.5 KB (added by azaozz, 12 years ago)
  • src/wp-includes/class-wp-editor.php

     
    3131                $set = wp_parse_args( $settings,  array(
    3232                        'wpautop' => true, // use wpautop?
    3333                        'media_buttons' => true, // show insert/upload button(s)
     34                        'default_editor' => '', // When both TinyMCE and Quicktags are used, set which editor is shown on loading the page
    3435                        'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
    3536                        'textarea_rows' => 20,
    3637                        'tabindex' => '',
     
    100101                if ( !current_user_can( 'upload_files' ) )
    101102                        $set['media_buttons'] = false;
    102103
    103                 if ( self::$this_quicktags && self::$this_tinymce ) {
    104                         $switch_class = 'html-active';
     104                if ( ! self::$this_quicktags && self::$this_tinymce ) {
     105                        $switch_class = 'tmce-active';
     106                } elseif ( self::$this_quicktags && self::$this_tinymce ) {
     107                        $default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
    105108
    106                         // 'html' and 'switch-html' are used for the "Text" editor tab.
    107                         if ( 'html' == wp_default_editor() ) {
     109                        // 'html' is used for the "Text" editor tab.
     110                        if ( 'html' === $default_editor ) {
    108111                                add_filter('the_editor_content', 'wp_htmledit_pre');
     112                                $switch_class = 'html-active';
    109113                        } else {
    110114                                add_filter('the_editor_content', 'wp_richedit_pre');
    111115                                $switch_class = 'tmce-active';