Copied to clipboard

Flag this post as spam?

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


  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Sep 28, 2012 @ 12:10
    Dave Woestenborghs
    0

    Add div with class to TinyMce styles dropdown

    Hi,

    I'm setting up my TinyMce styles dropdown. I need a style that would generate the markup the following markup.

    <div class="segment">Some content</div>

    I created a style with the alias div.segment

    However this doesn't seem to work. Nothing get's added to the content.

    Any ideas how to get this to work ?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 28, 2012 @ 19:19
    Jan Skovgaard
    0

    Hi Dawoe

    Why would you want to create a <div> element inside the rich text editor? Could you ellaborate a bit on what you need to do and why you have chosen to use the rich text editor? Perhaps the issue can be handled in another way that is perhaps an even better solution.

    When you define a style that can be chosen from the "style" dropdown then the class will be added to the marked element. That means that the style will either be added directly a paragraph or a span. (Sometimes a span is inserted with the class for some reason)...It's not possible to add elements by using the dropdown styles.

    You can add the <div> by clicking the HTML button and adding it manually. If it's not being saved then you need to set tidy to false in the umbracoSettings.config file.

    Looking forward to hear more from you.

    /Jan

  • Essy 74 posts 96 karma points
    Feb 10, 2013 @ 09:31
    Essy
    0

    I'd like to do this too ... for example so that the editor (who may not be html fluent) to be able to put a section of text/headings etc within a styled box ... does anyone have a solution?

  • Craig Agnew 22 posts 138 karma points
    Feb 21, 2013 @ 18:46
    Craig Agnew
    0

    Also looking for a solution to this!

    Client needs to be able to add content, in the form of a header, some text and an optional image inside a styled box on various pages.

    Any ideas?

  • Asif Malik 203 posts 339 karma points
    Feb 21, 2013 @ 18:50
    Asif Malik
    0

    I have been in similiar situation before and ended up using a marco which accepts a few paramters and then returns the relevant HTML

  • Craig Agnew 22 posts 138 karma points
    Feb 21, 2013 @ 18:51
    Craig Agnew
    0

    Asif,

    Just attempting that solution when I seen your post, however I have a feeling the optional image may give me a headache as I get further into it! 

  • Asif Malik 203 posts 339 karma points
    Feb 21, 2013 @ 19:00
    Asif Malik
    0

    Hi Craig, from what i can remember you can let the user choose an item from the Media section (via macro paramters) but cant remember which paramter type it is, I suggest you create a quick temporary macro that has a long list of parameters ... one for each type of parameter type that exists .... just to see how each one of them works ....

    FYI you can even create your own custom Parameter types by inheriting from the right interface (cant remember which one it is right now)

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 21, 2013 @ 19:58
    Jan Skovgaard
    0

    It's mediaCurrent that can be used to retrieve folder or files from the media section when used in a macro.

    /Jan

  • Craig Agnew 22 posts 138 karma points
    Feb 22, 2013 @ 12:20
    Craig Agnew
    0

    Thanks guys!

    This problem has evolved. The div I need to add to the various pages needs to allow for more than just text now, so I'm at the point where I'm thinking about making something like a widget repository like this:

     

    Content

    -   Home

    -   About Us

    Widget Repository

    -   Contact Us (Call to Action)

    -   Our History (Action Box)

     

    This means I'll be able to allow the client to edit the content in these boxes, however I still need a way of getting the two widgets in my example into the About Us page embedded in the content? Can I make a macro pull in a node from the widget repository to the TinyMCE?

  • Asif Malik 203 posts 339 karma points
    Feb 22, 2013 @ 17:02
    Asif Malik
    0

    Hi Craig, I have done something similair in the past where I have needed generic bits of content (as well as widgets) that shouldnt have a URL and are just used on mulitple pages (could be thought of as re-uasable content).

    From the perspective of allowing the user to choose items, i normally seperate out the fields (ie not just 1 RTE) so i end up with a picker of some type (MNTP) this ends up giving me more control over what they can actually select and use.

    The macro paramter does have a parameter type which allows for content selection, but as i mentioned i dont think you can control what they see in it (it may/should even use the users permissions to set the default node etc).

    If you continue down the 1 RTE route it will be interesting to see the results so please update this post with the solution ... once you get it :)

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 22, 2013 @ 23:09
    Jan Skovgaard
    0

    Hi Craig

    As Asif points out above it would be nice to use a MNTP for this. However if you need to place the content of the widgets into the RTE then you need to use a macro with the content picker as a parameter, which is no problem to achieve since it returns the id of the selected box so you know what content to render.

    However you should be aware that the content picker on has the disadvantage that you can't configure it to only show nodes from a certain tree in the content section. It shows all nodes in the top level of the tree. Using an MNTP gives you the option to to confgure the starting point so editors don't need to click through as many nodes and don't have to think that much about where to find them.

    Let us know what solution you end up using and if you need some help figuring out how to grab the content etc.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft