Make WordPress Core


Ignore:
Timestamp:
02/05/2014 12:33:49 AM (13 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-editor.php

    r27060 r27093  
    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,
     
    101102                        $set['media_buttons'] = false;
    102103
    103                 if ( self::$this_quicktags && self::$this_tinymce ) {
    104                         $switch_class = 'html-active';
    105 
    106                         // 'html' and 'switch-html' are used for the "Text" editor tab.
    107                         if ( 'html' == wp_default_editor() ) {
     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();
     108
     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');
Note: See TracChangeset for help on using the changeset viewer.