Creating zillions of content classes in CMS for every type of imaginable widget an author may want seems like a fabulous idea at first, but it isn’t. You make the CMS do much more work during publishing, and adding “pages” in CMS just to get a correctly formatted table in the body of your content is silly. Snippets are the right answer and they’re supported right out-of-the-box with telerik. They’re just off, so turn them on – this is how.
This file controls the global configuration of the RadEditor. You will need to add a tool to one of the toolbars with the name InsertSnippet which (obviously) adds the drop-down list of snippets where you want it. Then you add the snippets themselves by adding a new element, snippets, and putting the code you want for the snippet inside. See below.
<root> <tools> <tool name="InsertSnippet" /> </tools> <tools> ... </tools> <contextMenus> ... </contextMenus> <snippets> <snippet name="Standard Table"> <![CDATA[ <table summary="[Insert a table summary here for WCAG compliance]" class="nolines"> <thead> <tr> <th>Column 1</th> <th>Column 2</th> </tr> </thead> <tbody> <tr> <td>Digital Home</td> <td>Consumer electronics</td> </tr> </tbody> </table> ]]> </snippet> </snippets> </root>
You can put icons in the snippet title, which is cool I reckon.
Just do this:
<snippet name="<img src='images/Table.gif' /> Standard Table">
Instead of this:
<snippet name="Standard Table">
The image doesn’t have to go at the front but it probably should. Keep them small and remember the path is relative to the RadEditor.Net folder and not the CMS app itself. And be careful when mixing single and double quotes. Lastly I have tried to use images from inside the Asset Manager for the icons but the URL seems to be too complicated. Particularly in the escaping of &. It can probably be done but I ran out of patience.
PS. Before you ask there is no easy way to do this on a placeholder-by-placeholder basis without multiple ToolsFile.xml files or some tricky hacked-in server-side code. Go there at your own risk (it does work but it’s harder than described above).
No related posts.