Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Craig O'Mahony 364 posts 918 karma points
    Jun 13, 2013 @ 18:14
    Craig O'Mahony
    0

    Inserting HTML tags using the RTE

    Hi Folks,

    I could be being silly here but how do you go about inserting standard HTML tags using the rich text editor?

    For instance if I wanted to give the user the ability to insert a <hr/> tag in the middle of the page?

    I can't seem seem to find anyway that that's done!

    Thanks,

    Craig

  • Dan 1288 posts 3921 karma points c-trib
    Jun 13, 2013 @ 18:41
    Dan
    100

    Hi Craig,

    Go to the 'developer' section and expand 'data types'.  In there find the data type on which your WYSIWYG editor is based (it may be called 'Richtext editor') and you should see an option to enable the HTML button for the WYSIWYG editor.  Save this then go back to your content section and you should now see the HTML button which you can click to edit the HTML.

    Hope this helps.

  • Craig O'Mahony 364 posts 918 karma points
    Jun 13, 2013 @ 22:36
    Craig O'Mahony
    0

    Hi Dan,

    Sorry I should have explained a bit better, I know how to configure the editor to show on the content page (how to associate classes in the 'style' dropdown etc). What I'm actually trying to do is allow the users to be able to insert, for example, a horizontal rule in the content without exposing them directly to the raw HTML of the page. Most of the users aren't going to know or want to know (!) anything about HTML they just want to be able to bash content in!!

    Thanks,

    Craig

  • Funka! 398 posts 661 karma points
    Jun 13, 2013 @ 22:51
    Funka!
    0

    In the exact same place Dan described where you can add or remove the "HTML" button, there is also a horizontal rule button so you can add this to your toolbar. It's about halfway down the last column.

    Best of luck to you!

  • Dan 1288 posts 3921 karma points c-trib
    Jun 13, 2013 @ 23:50
    Dan
    1

    Hi Craig,

    Is it just a horizontal rule you're looking to add or something more complex?  If more complex then I think the only way to achieve this in the richtext editor is via macros.  So you'd create an XSLT or Razor macro for each of the HTML 'snippets' you want to be insertable, and make sure the checkbox in the macro settings is set to 'allow in editor'.  Then enable the macro edit button on the editor and the user can then pick the type of macro they want to embed.

    Personally I really try to avoid using macros in the WYSIWYG editor as they're slightly flakey and clients always seem to make a hash of them.  Sometimes I realise though there's no choice :)

  • Craig O'Mahony 364 posts 918 karma points
    Jun 14, 2013 @ 11:22
    Craig O'Mahony
    0

    At this stage of the game it's just the standard HTML garb that I need to be able to insert (I must have had a serious case of blindness cos I completely missed that horizontal rule!). Ultimately I want to give the users the ability to add multiple classes to a single element which I've always had trouble with....so maybe put that in a Macro you think? 

  • Dan 1288 posts 3921 karma points c-trib
    Jun 14, 2013 @ 11:36
    Dan
    0

    Hmm, multiple classes with the WYSIWYG can be done but it's very hit or miss.  It's quite a fine art determining how much can be done through the WYSIWYG tools, how much can be done through macros and whether it just needs a different design approach to tackle the problem.

    As a very broad rule of thumb, if you have complex block elements, and you really need to do this through the WYSIWYG (as opposed to building the page elements through content-tree nodes) then macros are probably best.  If you want to assign combinations of classes freely and this stuff can't be bundled easily into macros then I can't think of a sure-fire way to do it without either getting into the HTML or fending off lots of calls from the customer when then end up in span-tag soup.

    Try to structure the CSS so that multiple classes aren't required if possible otherwise I think you're facing an up-hill struggle, unfortunately.  I've been there and feel your pain ;)

Please Sign in or register to post replies

Write your reply to:

Draft