Custom styles dropdown in TinyMCE editor - not working with headings

I've added a custom style dropdown to the TinyMCE editor, but cannot get it to work with headings (h1, h2, etc..). I highlight plain text, select the style from the formats dropdown, and the text does not get wrapped in anything. However, it DOES work with span tags and div tags. The highlighted text correctly gets wrapped in the tag with the associated classes. What am I doing wrong with the H tags? Here's my code:

$style_formats = array(  
    // Each array child is a format with it's own settings
    array(  
        'title' = 'Main Headline', 
        'block' = 'h1',  
        'classes' = 'section-heading',
        'wrapper' = true,
    ),  
    array(  
        'title' = 'Main Subhead',  
        'block' = 'h3',  
        'classes' = 'subhead',
        'wrapper' = true,
    ),
    array(  
        'title' = 'Light Font Weight',  
        'block' = 'span',  
        'classes' = 'lgt',
        'wrapper' = true,
    ),
    array(  
        'title' = 'Regular Font Weight',  
        'block' = 'span',  
        'classes' = 'reg',
        'wrapper' = true,
    ),
    array(  
        'title' = 'Box',  
        'block' = 'div',  
        'classes' = 'well',
        'wrapper' = true,
    )
);  

Thank you!

Topic add-editor-style tinymce css Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.