我曾经向TinyMCE添加自定义样式/格式,如下所示:
add_filter( 'tiny_mce_before_init', 'add_tinymce_formats', 10, 2);
function add_tinymce_formats($mceinit, $editor_id){
$new_styles = array(
array(
'title' => 'Foradori'
,'items' => array(
array(
'inline' => 'span',
'title' => 'Red',
'classes' => 'red'
)
)// end items
)// and main array
);
$mceinit['style_formats_merge'] = true;
$mceinit['style_formats'] = json_encode($new_styles);
return $mceinit;
}
add_action( 'admin_init', 'add_editor_styles' );
function add_editor_styles(){
add_editor_style('css/tinymce-editor.css');
}
但是现在有了gutenberg,它们将不会被添加到经典编辑器块中。 有什么解决办法吗?