Custom CSS

4 posts by 3 authors in: Forums > CMS Builder
Last Post: November 30, 2018   (RSS)

By Dave - November 26, 2018

Hi furcat, 

The WYSIWYG we use in CMS Builder is TinyMCE: https://www.tiny.cloud/

First, make sure you're using CMSB v3.07 or better as that's when we switched to TinyMCE 4.

Here's how to add styles: 

  1. Make sure you're running CMSB v3.07 or newer
  2. Copy /lib/wysiwyg.php to /lib/wysiwyg_custom.php to ensure your changes don't get overwritten when you upgrade
  3. In wysiwyg.php, search for "toolbar1" and add "styleselect " as the first option to add a style pulldown
  4. In wysiwyg.php, search for "style_formats" and uncomment the example block of style formats
  5. Reload your CMS and confirm the new WYSIWYG menu option appears
  6. Update style_formats with whatever styles you want listed
  7. Copy /lib/wysiwyg.css to /lib/wysiwyg_custom.css to ensure your changes don't get overwritten when you upgrade
  8. Add any classes needed by style_formats to wysiwyg_custom.css
  9. See docs if needed: https://www.tinymce.com/docs/configure/content-formatting/#style_formats

Hope that helps!  Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com

By furcat - November 27, 2018

Yes! It works. Thank you very much.

Another question: I have a style for lists that I want to use: 

<ul class="list-style dots">
<li>Eam ea errem graeco vulputate mel scaevola appetere volutpat</li>
<li>Lvulputate mel scaevola appetere volutpat</li>
<li>Dappetere volutpat vix et munere</li>
<li>Rgraeco vulputate mel scaevola appetere</li>
</ul>

I put the class in wysiwyg.php as follows:

{ title: 'Bullets', selector: 'ul', classes: 'list-style dots' },

It doesn't work unless I select the bullet items and use the editor to create a list, and then select "Bullets" from the additional style menu, I'm assuming because there isn't a "<ul>" until I actually create a list.

Is there a more elegant solution for that situation?

By daniel - November 30, 2018

Hi furcat,

It doesn't work unless I select the bullet items and use the editor to create a list, and then select "Bullets" from the additional style menu, I'm assuming because there isn't a "<ul>" until I actually create a list.

Is there a more elegant solution for that situation?

Unfortunately, when dealing with something complex like a list that has nested elements, this is about the simplest method for adding CSS classes, beyond perhaps building a custom plugin solely for that function.

Let me know if I can help with anything else,

Daniel
Technical Lead
interactivetools.com