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:
parent
6aaad4785a
commit
b33135c08d
|
@ -31,6 +31,7 @@ final class _WP_Editors {
|
||||||
$set = wp_parse_args( $settings, array(
|
$set = wp_parse_args( $settings, array(
|
||||||
'wpautop' => true, // use wpautop?
|
'wpautop' => true, // use wpautop?
|
||||||
'media_buttons' => true, // show insert/upload button(s)
|
'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_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
|
||||||
'textarea_rows' => 20,
|
'textarea_rows' => 20,
|
||||||
'tabindex' => '',
|
'tabindex' => '',
|
||||||
|
@ -100,12 +101,15 @@ final class _WP_Editors {
|
||||||
if ( !current_user_can( 'upload_files' ) )
|
if ( !current_user_can( 'upload_files' ) )
|
||||||
$set['media_buttons'] = false;
|
$set['media_buttons'] = false;
|
||||||
|
|
||||||
if ( self::$this_quicktags && self::$this_tinymce ) {
|
if ( ! self::$this_quicktags && self::$this_tinymce ) {
|
||||||
$switch_class = 'html-active';
|
$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.
|
// 'html' is used for the "Text" editor tab.
|
||||||
if ( 'html' == wp_default_editor() ) {
|
if ( 'html' === $default_editor ) {
|
||||||
add_filter('the_editor_content', 'wp_htmledit_pre');
|
add_filter('the_editor_content', 'wp_htmledit_pre');
|
||||||
|
$switch_class = 'html-active';
|
||||||
} else {
|
} else {
|
||||||
add_filter('the_editor_content', 'wp_richedit_pre');
|
add_filter('the_editor_content', 'wp_richedit_pre');
|
||||||
$switch_class = 'tmce-active';
|
$switch_class = 'tmce-active';
|
||||||
|
|
Loading…
Reference in New Issue