• Resolved jpegtobbe

    (@jpegtobbe)


    Cant get my styles from editor-style.css to show up in the Format dropdown. It worked earlier, but after i added the font size-button in Tinymce admin and saved the styles is gone.

    The styles is visible in the editor. I.e. if i do -> p {background-color:#f00} it shows in the editor.

    I have tried empty the browser cache.
    I have tried this two solutions but no one of them worked:

    function cm_styles(){
    add_editor_style();
    }
    add_action( ‘init’, ‘cm_styles’);

    function my_theme_add_editor_styles() {
    add_editor_style( ‘editor-style.css’ );
    }
    add_action( ‘init’, ‘my_theme_add_editor_styles’ );

    Also tried resetting the settings in tinymce advanced and then put the format-dropdown in the toolbar again.

    Any ideas?

    WordPress 4.5
    Tinymce Advanced 4.3.8

    https://wordpress.org/plugins/tinymce-advanced/

Viewing 15 replies - 1 through 15 (of 19 total)
  • Plugin Author Andrew Ozz

    (@azaozz)

    When you enable this TinyMCE Advanced looks for a stylesheet named editor-style.css in the iframe head. Have a look in the browser console (right-ckick inside the editor and inspect) if that exists.

    In some cases this is caused by some “unexplained” caching in the browsers. Reloading the page, quitting the browser then starting it again is known to have helped.

    Thread Starter jpegtobbe

    (@jpegtobbe)

    Yes, its actually loaded, i can visually see that the styles are loaded in the texteditor frame, but the formats-dropdown in the toolbar isnt populated with the classes, instead it shows “Headline, inline … ” in the dropbox.

    Thread Starter jpegtobbe

    (@jpegtobbe)

    Also, i’ve tried reinstalling TinyMCE advanced, and tried in a browser on another computer that hasnt accessed the site before. Same problem. No styles in the formats-menu.

    sjc

    (@stevielovegun)

    I also have this issue since WordPress upgrade – the Formats menu no longer shows the custom styles I’ve created for my users, rather a two-level list of generic elements and inline styles.

    Example

    Looks like a change in the TinyMCE version shipped with WP4.5. Hoping there’s a way of overriding this and allowing the options in here to come from editor-styles.css again.

    ps TinyMCE Advanced rocks!

    sjc

    (@stevielovegun)

    EDIT:

    Apologies, this is completely user error on my part – hadn’t checked the
    Create CSS classes menu /
    Load the CSS classes used in editor-style.css and replace the Formats button and sub-menu
    checkbox under Advanced Options on Settings > TinyMCE Advanced

    With this done all working as it should and loading custom styles.

    jpegtobbe have you tried this?

    @steve,

    I don’t have the Load The CSS option under the Advanced Options anymore now that I have updated WP to 4.5. I only have the option for Keeping paragraph styles and Pasting image sources. The Loading of CSS editor styles have been removed? I still can’t see my styles in the formats Dropdown.

    Thanks,
    Josh

    Thread Starter jpegtobbe

    (@jpegtobbe)

    Okay, yes, i think that is my problem too. No option in settings for me either.

    Update:

    So I think it has something to do with my custom theme. I’m not sure yet what it is but, when I activate the Twenty Sixteen theme the option shows up again. Hopefully TinyMCE Advanced will know what the issue is cause I can’t even begin to think what it could be within my custom theme.

    Looks like this is solved by adding this line to functions.php:

    add_theme_support('editor-style');

    Something about WordPress 4.5 causes this current_theme_supports('editor-style') to return false when support has not been explicitly added.

    @clifton,

    Thanks for the help but this only half fixes the problem. It seem that this allows the option to show again but doesn’t populate the styles in the editor. I figured out the fix for this for now on this site: https://developer.wordpress.org/reference/functions/add_editor_style/.

    Just add to your functions.php:

    function wpdocs_theme_add_editor_styles() {
        add_editor_style( 'editor-style.css' );
    }
    add_action( 'admin_init', 'wpdocs_theme_add_editor_styles' );
    Thread Starter jpegtobbe

    (@jpegtobbe)

    Yepp, add_editor_style( ‘editor-style.css’ ); and then go to the TinyMCE Advanced settings page and check the box that now have appeard “Create CSS classes menu” under the advanced section.

    Solved!

    @jpegtobbe,

    I wouldn’t say that this issue is resolved as there shouldn’t be a need for this function fix in the first place. There is still a bug in the newest version of the plugin. This is just a fix until the developer can put out a real fix.

    Thread Starter jpegtobbe

    (@jpegtobbe)

    You are right!
    I have opened the thread again.

    Andrew Ozz, something you can fix in next version?

    Plugin Author Andrew Ozz

    (@azaozz)

    Sure, will look into it as soon as I get some free time.

    Plugin Author Andrew Ozz

    (@azaozz)

    This should be fixed in 4.3.10.

Viewing 15 replies - 1 through 15 (of 19 total)

The topic ‘Format selectbox isnt populated with editor-style.css’ is closed to new replies.