6

TinyMCE4 in WordPress 3.9 has some cool changes, but it seems to have only one "theme" included.

Is there any way to make a sub-theme of the theme defined by CSS, and theme.js in wp-includes/js/tinymce/themes/modern ? Or a way to dequeue and enqueue a custom theme from somewhere else? Where can I find these MCE4 themes, if it's a common pluggable option?

I'm also really curious what the tinymce.ThemeManager.get('modern') is meant for, since it only gives you the function(editor) {... } containing private variables and functions from theme.js, but gives you no way to "monkey patch" the reposition or add-toolbar functions, etc. that are within that function.

1 Answer 1

2

I'm not sure if this question is still relevant or not (so I'm posting for future reference for people), but there is a way to define a css file for the TinyMCE editor in your plugin by using the mce_css filter. For a quick example, I'll take an excerpt from the WordPress documentation:

function plugin_mce_css( $mce_css ) {
    if ( ! empty( $mce_css ) )
        $mce_css .= ',';

    $mce_css .= plugins_url( 'editor.css', __FILE__ );

    return $mce_css;
}
add_filter( 'mce_css', 'plugin_mce_css' );

For reference on this filter, you can check out these pages:

mce_css @ wpseek.com

mce_css @ codex.wordpress.org

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.