TinyMCE-默认情况下显示高级选项(第二行)

时间:2013-10-10 作者:Howdy_McGee

因此,我对tinyMCE进行了一些定制,添加了一些按钮并重新安排了一些内容:

function myformatTinyMCE($in)
{
    $in[\'theme_advanced_buttons1\']=\'bold,italic,underline,bullist,numlist,hr,blockquote,link,unlink,justifyleft,justifycenter,justifyright,justifyfull,outdent,indent\';
    $in[\'theme_advanced_buttons2\']=\'formatselect,pastetext,pasteword,charmap,undo,redo\';
    return $in; 
}
add_filter(\'tiny_mce_before_init\', \'myformatTinyMCE\' );
我想通过不添加wp_adv 在第一个按钮列表的末尾,默认情况下会显示第二行,但事实并非如此-我只是完全丢失了第二行。我想显示第二行-始终,不按或显示wp_adv 按钮

默认情况下,如何显示TinyMCE中的第二行?

1 个回复
最合适的回答,由SO网友:birgire 整理而成

如果您检查$in 您应该得到如下信息:

Array
(
    [mode] => exact
    [width] => 100%
    [theme] => advanced
    [skin] => wp_theme
    [language] => en
    [theme_advanced_toolbar_location] => top
    [theme_advanced_toolbar_align] => left
    [theme_advanced_statusbar_location] => bottom
    [theme_advanced_resizing] => 1
    [theme_advanced_resize_horizontal] => 
    [dialog_type] => modal
    [formats] => {
                        alignleft : [
                            {selector : \'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li\', styles : {textAlign : \'left\'}},
                            {selector : \'img,table\', classes : \'alignleft\'}
                        ],
                        aligncenter : [
                            {selector : \'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li\', styles : {textAlign : \'center\'}},
                            {selector : \'img,table\', classes : \'aligncenter\'}
                        ],
                        alignright : [
                            {selector : \'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li\', styles : {textAlign : \'right\'}},
                            {selector : \'img,table\', classes : \'alignright\'}
                        ],
                        strikethrough : {inline : \'del\'}
                    }
    [relative_urls] => 
    [remove_script_host] => 
    [convert_urls] => 
    [remove_linebreaks] => 1
    [gecko_spellcheck] => 1
    [fix_list_elements] => 1
    [keep_styles] => 
    [entities] => 38,amp,60,lt,62,gt
    [accessibility_focus] => 1
    [media_strict] => 
    [paste_remove_styles] => 1
    [paste_remove_spans] => 1
    [paste_strip_class_attributes] => all
    [paste_text_use_dialog] => 1
    [webkit_fake_resize] => 
    [preview_styles] => font-family font-weight text-decoration text-transform
    [schema] => html5
    [wpeditimage_disable_captions] => 
    [wp_fullscreen_content_css] => http://example.com/wp-includes/js/tinymce/plugins/wpfullscreen/css/wp-fullscreen.css
    [plugins] => inlinepopups,tabfocus,paste,media,fullscreen,wordpress,wpeditimage,wpgallery,wplink,wpdialogs,wpfullscreen
    [content_css] => http://example.com/wp-content/themes/twentytwelve/editor-style.css,http://fonts.googleapis.com/css?family=Open+Sans:400italic%2C700italic%2C400%2C700&subset=latin%2Clatin-ext
    [elements] => content
    [wpautop] => 1
    [apply_source_formatting] => 
    [theme_advanced_buttons1] => bold,italic,strikethrough,bullist,numlist,blockquote,justifyleft,justifycenter,justifyright,link,unlink,wp_more,spellchecker,wp_fullscreen,wp_adv
    [theme_advanced_buttons2] => formatselect,underline,justifyfull,forecolor,pastetext,pasteword,removeformat,charmap,outdent,indent,undo,redo,wp_help
    [theme_advanced_buttons3] => 
    [theme_advanced_buttons4] => 
    [tabfocus_elements] => insert-media-button,save-post
    [body_class] => content post-type-post post-status-publish post-format-standard
    [theme_advanced_resizing_use_cookie] => 
    [wordpress_adv_hidden] => 
)
最后一项wordpress_adv_hidden 您可以隐藏/显示厨房水槽

Open Kitchen Sink by default

/**
 * Modify TinyMCE 
 *
 * @param array $in
 * @return array $in
 */
function my_tiny_mce_before_init( $in ) {

    // customize the buttons
    $in[\'theme_advanced_buttons1\'] = \'bold,italic,underline,bullist,numlist,hr,blockquote,link,unlink,justifyleft,justifycenter,justifyright,justifyfull,outdent,indent\';         
    $in[\'theme_advanced_buttons2\'] = \'formatselect,pastetext,pasteword,charmap,undo,redo\';

    // Debug:
    // print_r( $in );
    // exit();

    // Keep the "kitchen sink" open:   
    $in[ \'wordpress_adv_hidden\' ] = FALSE;

    return $in;
}
add_filter( \'tiny_mce_before_init\', \'my_tiny_mce_before_init\' );

结束

相关推荐

使用可用的WP参数更改TinyMCE编辑器的背景

我正在插件表单中使用TinyMCE编辑器的一个实例,如果字段填写不正确,我需要突出显示编辑器(浅红色背景)。如果我的代码评估编辑器未按要求填写,我可以添加自定义类“error”,但添加该类只会影响“Text”模式的背景,而不会影响“Visual”模式。有没有一种方法可以通过WP选项来实现这一点?谢谢下面是我如何声明编辑器-/** Set up the editor arguments */ $wp_editor_args = array( \'media_buttons\' =&g