我已经将样式下拉列表添加到Wordpress中的TinyMCE编辑器中。如果我选择样式,并在前端预览它,它看起来就像我期望的那样。不过,我也想在编辑器中预览它。
通过添加my\'。blue button的类to/wp包括/js/tinymce/themes/advanced/skins/wp\\u-themes/content。css,我可以像我想的那样预览它,但这看起来很粗糙,可能会在TinyMCE更新后中断。是否有过滤器来执行此操作?
到目前为止,我有以下几点:
add_filter(\'tiny_mce_before_init\', \'customizeWYSIWYGToolbar\' );
function customizeWYSIWYGToolbar($init) {
$init[\'theme_advanced_buttons2_add_before\'] = \'styleselect\'; // Adds the buttons at the begining. (theme_advanced_buttons2_add adds them at the end)
$init[\'theme_advanced_styles\'] = \'Blue Button=blue-button\';
$init[\'theme_advanced_disable\'] = \'underline, justifyfull, charmap, pasteword\';
return $init;
}
add_filter( \'mce_css\', \'tdav_css\' );
add_editor_style(\'css/admin.css\');
add_action(\'init\', \'WYSIWYGCSS\');
function WYSIWYGCSS(){
wp_enqueue_style( \'wysiwygStyles\', get_bloginfo(\'stylesheet_directory\').\'/css/admin.css\', ",",\'all\' );
}
谢谢!