TinyMCE 4 - Apply format to paragraph tag

6 posts by 3 authors in: Forums > CMS Builder
Last Post: July 19, 2017   (RSS)

Hi - in the past with TM 3 I was able to select a "P" tag in the statusbar of tinymce and apply a style to that P tag.  In TM4 it appears to ignore the instruction and the "P" tag never gets the class.

This is a requirement for me as all videos and maps that need to be responsive need to have a particular class associated with it.  I can do it manually in the HTML, but it's really hard to instruct users to do it this way.

Any thoughts on the change I need to make to TM4 to allow this?

Let me know.

Thanks,

Gary.

By Toledoh - July 17, 2017

Hey Gary.

I think it's got something to do with the wysiwyg-custom.php file: example below:

{title: 'Lead Paragraph', selector: 'p', classes: 'lead'},

Cheers,

Tim (toledoh.com.au)

Thank you for the reply - I should be able to click the "P" in the status bar and then select a class from the drop-down, but this is not working and the class is not being applied to the paragraph.  I will take a look at your solution and maybe I can contrive a way to make this work.

Thank you again!

Gary.

By Dave - July 18, 2017

Hi Gary, 

Can you attached your wysiwyg_custom.php file if you've made any changes?  

Dave Edis - Senior Developer
interactivetools.com

By garyhoffmann - July 19, 2017 - edited: July 19, 2017

I might have an answer to this one...it appears that you can only have a style that applies to a P tag (or any other specific block tag) and doesn't create a span around it if you hard-code define them in the style_formats array.  If I define the style there, it seems to work.  All other class styles appear to be forced to inline span instead of applying to the selector you have specifically highlighted in the statusbar.

I can work with this.  This is the primary one I need to apply to a specific selector and it's for making videos and maps responsive.

Needless to say, Toledoh was right on - I just didn't understand what needed to be done.

Thank you for any time you have spent on this.

Gary.