Custom CSS in TinyMCE
-
I am trying to add custom CSS code to a menu in TinyMCE. I have attempted to use TinyMCE Advanced, only to have experienced problems in text selection. I can get Advanced TinyMCE Configuration to work after a fashion, but there are still problems.
I entered the following under style_formats:
[ { title: 'Prose', inline: 'span', styles: { "line-height": '1.4', "font-size": '120%', "text-indent": '30px', "margin-bottom": '0px', "color": '#000000', "font-family": 'georgia'} }, { title: 'Center', inline: 'span', styles: { "line-height": '1.4', "font-size": '120%', "margin-bottom": '0px', "color": '#000000', "font-family": 'georgia', "text-align": 'center' } }, { title: 'Flatline', inline: 'span', styles: { "line-height": '1.4', "font-size": '120%', "margin-bottom": '0px', "color": '#000000', "font-family": 'georgia'} } ]The ‘Formats’ menu now displays my styles. However, for some reason, it is ignoring “text-indent”: ’30px’ and not indenting the start of the paragraph. Further experimentation led me to enter the following under style_formats through the plugin:
[ { title: 'Prose', block: 'p', classes: 'prose' }, { title: 'Center', block: 'p', classes: 'center' }, { title: 'Flatline', block: 'p', classes: 'flatline' } ]which caused it to behave exactly the way it did under TinyMCE Advanced. It indented, but it inserted the </p> in the wrong location. However, when I tried
[ { title: 'Prose', inline: 'span', classes: 'prose' }, { title: 'Center', inline: 'span', classes: 'center'}, { title: 'Flatline', inline: 'span', classes: 'flatline'} ]The TinyMCE visual editor would load, only without the ‘Formats’ menu. Once, I did see the contents of the ‘Formats’ menu appear at the upper left corner of my WordPress dashboard, but I haven’t been able to replicate that.
I am so close to a solution, but am not quite there yet. Any assistance would be appreciated.
I am running WordPress 4.9.5, and TinyMCE 4.6.7 hosted through HostGator. My browser is Firefox 59.0.2 (64-bit), running on OSX 10.11.6.
The page I need help with: [log in to see the link]
The topic ‘Custom CSS in TinyMCE’ is closed to new replies.