More in this section
Categories
Bloggers
Blogs RSS feed

Forcing authors to use your predefined CSS classes to style their content in Sitefinity 5

by Grigori Karanikolov

Coming from this blog post, I wanted to highlight the way the Sitefinity team made it easier to change the configuration of the WYSIWYG editor that is used in various places throughout the CMS.
You don’t even have to enter the “Advanced” section of the administration of Sitefinity, as I described in the blog post above. Now, you can simply go to Administration->Settings and open the Text Editor section to customize the default toolset, used through all the backend of Sitefinity:
image

You are able to edit the tools that show up in your editor’s toolbox right inside Sitefinity now. And of course, if you want to have separate configurations for the editors inside different modules of Sitefinity, you are absolutely able to achieve that by setting different toolbox configuration files in the options for each module.

  • As explained in the aforementioned blog post, this is extremely useful if you’d like to customize the number of tools content authors will have access to. This way you can enforce consistency for the content all over your website by enforcing authors to use only your CSS styles to format their content and removing tools that allow adding custom inline CSS.
    There are just 3 things you need to do:
    Edit the tool set and remove any tools you wouldn’t want to appear in there;
  • Add the ApplyClass tool, which would provide a dropdown with your own classes. Add it by simply including this: <tool name=”ApplyClass”/> between the <tools></tools> tags in the toolset configuration.
  • Specify which CSS files the ApplyClass should use and map which classes from these files it should be able to apply:

image

Save and you’re done!
Remember to clean your browser cache, so that the all the CSS files are refreshed! Otherwise you’ll end up with an empty ApplyClass dropdown menu.

image

Comments and thoughts are welcome!

27 comments

Leave a comment
  1. Michael Apr 13, 2012
    Thank you, this works. But now my editor is picking up my overall page background image within the editor.  This makes editing very difficult as the body has a very dark blue background and the text is a dark color.  How do you make the editor ignore the body's background?
  2. Grisha 'Greg' Karanikolov Apr 17, 2012
    Michael, have you created a separate CSS file for your RadEditor classes? I would recommend that you put the classes you need to use within RadEditor in a separate CSS file for easier management and to avoid such hurdles.
    Did this help?
  3. Martin Sahuc Jun 19, 2012
    Did someone know how to specify the css tu use in admin's preview pages ?
    Because styles are not applied in that case.
  4. Nancy Rackleff Jun 21, 2012
    This works fine for me up until the point that I add the "classes". If I add the apply class tool and the css file, it works fine, but displays everything in that file. So, I attempt to add the classes in order to narrow it down then it reverts back to nothing but the clear class. Here is my classes declaration:
    <classes>
        <class name="Green Button" value=".btn-grn"/>
        <class name="Blue Button" value=".btn-blu"/>
    </classes>
    Any idea what might be causing this? I don't want to have to duplicate all of the classes I need in a different file. I would like to be able to use the full file and just narrow it down with the class list.
  5. Nancy Rackleff Jun 21, 2012
    This works fine for me up until the point that I add the "classes". If I add the apply class tool and the css file, it works fine, but displays everything in that file. So, I attempt to add the classes in order to narrow it down then it reverts back to nothing but the clear class. Here is my classes declaration:
    <classes>
        <class name="Green Button" value=".btn-grn"/>
        <class name="Blue Button" value=".btn-blu"/>
    </classes>
    Any idea what might be causing this? I don't want to have to duplicate all of the classes I need in a different file. I would like to be able to use the full file and just narrow it down with the class list.
  6. Nancy Rackleff Jun 21, 2012
    Sorry about the double post there. Also, I forgot to mention that I am using Sitefinity 5.
  7. Nancy Rackleff Jun 21, 2012
    I think I've got this figured out....sort of. I read on http://www.telerik.com/help/aspnet-ajax/editor-css-styles.html "Please, note that if you have css classes defined with the following syntax: .Emphasis, p em{color: #A4CE3A; font-style: normal; } then the editor will parse and read only the .Emphasis class and will populate the "Apply Class" dropdown only with this class. If RadEditor starts to parse the strings after the comma, this will drastically decrease the editor performance and it will be loaded slower on the page."
    My blue and green button classes are part of a comma separated list of classes, so that could be part of it. Also, the classes in question appear in multiple declarations, so it may have just not been able to grasp them.
    I think I will end up creating a simplified stylesheet to use in the editor. It will probably be the easiest in the long run. I can simplify it by not including the hover or visited states for links and things like that.
  8. seogroup Nov 01, 2017
    A debt of gratitude is in order for sharing the post.. folks are universes best individual in every existences of individual..they need or must succeed to manage needs of the crew.  mink lash
  9. smith Nov 02, 2017
    I think this is a really good article.  You make this information interesting and engaging.  You give readers a lot to think about and I appreciate that kind of writing. mydownloadtube
  10. sonia Nov 03, 2017
    This web journal is so decent to me. I will continue coming here over and over. Visit my connection too..  gamer home
  11. seogroup Nov 03, 2017
    i was simply scanning along and happened upon your site. simply needed to say great site and this article truly helped me.  SNZ HB 167-2006
  12. Robinjack Nov 05, 2017
    I'm glad I found this web site, I couldn't find any knowledge on this matter prior to.Also operate a site and if you are ever interested in doing some visitor writing for me if possible feel free to let me know, im always look for people to check out my web site. escorts lebanon
  13. seogroup Nov 05, 2017
    Incredible data! I as of late went over your online journal and have been perusing along. I thought I would leave my first remark. I don't realize what to say with the exception of that I have.  lice eggs
  14. sonia Nov 06, 2017
    I have been looking at a couple of your stories and i can state really well done. I will bookmark your website  industrial stickers
  15. seogroup Nov 09, 2017
    This is a savvy blog. I would not joke about this. You have such a great amount of learning about this issue, thus much enthusiasm. You additionally know how to make individuals rally behind it, clearly from the reactions.  showbox online
  16. Robinjack Nov 09, 2017
    Thank you for very usefull information.. beirut escort
  17. seo Nov 10, 2017
    Doubtlessly this is an amazing post I got a great deal of learning in the wake of perusing good fortunes. Topic of online journal is phenomenal there is very nearly everything to peruse, Brilliant post.  https://cinemabox.club/mobdro-apk/
  18. jk Nov 11, 2017
    With the addition of wild yam root as an factor, the supplement provides the potential to push your exercises to the restrict and past. trenorol
  19. seo Nov 13, 2017
    Much obliged to you for extremely usefull data..  Kadıköy Nakliyat
  20. Robinjack Nov 14, 2017
    You have done a great job on this article.  It’s very readable and highly intelligent.  You have even managed to make it understandable and easy to read.  You have some real writing talent. Thank you. Fennel Essential Oil
  21. Olivia Nov 16, 2017
    I respect this article for the all around looked into substance and magnificent wording. I got so included in this material that I couldn't quit perusing. I am awed with your work and ability. Much thanks to you to such an extent. Hair transplant
  22. robinjack Nov 18, 2017
    Your online journal furnished us with profitable data to work with. Each and every tips of your post are great. Much obliged for sharing. Continue blogging,  casinodunya
  23. Robinjack Nov 18, 2017
    The post is composed in exceptionally a decent way and it contains numerous valuable data for me. Hero Instinct
  24. Robinjack Nov 18, 2017
    Simply a grinning visitant here to share the affection (:, btw remarkable  iddaa siteleri
  25. amelia Nov 19, 2017
    Whether you already have a financial advisor or are now looking to hire one, you want someone who has your best financial interest at heart. Comprehensive financial planning for an individual or couple generally involves tax planning, risk management, investment planning, retirement planning and gift and estate planning. We help clients create a financial plan that aligns with their life goals and we can help you too. port arthur wealth management
  26. robinjack Nov 19, 2017
    This is extremely instructive substance and composed well for a change. It's pleasant to see that a few individuals still see how to compose a quality post!  mobil bahis
  27. robinjack Nov 22, 2017
    I can set up my new thought from this post. It gives top to bottom data. A debt of gratitude is in order for this significant data for all,..  canli blackjack

    Leave a comment