Copied to clipboard

Flag this post as spam?

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


  • Bo Dudek 14 posts 84 karma points
    Apr 26, 2016 @ 07:43
    Bo Dudek
    0

    Outputting links from custom editor

    Hi

    I have a macro with a parameter using a custom rte. All works great when outputting the content, but if the user enters a link using the rte, then the output can contain something like this:

    click here

    The easy and right (!) way to handle this? At the moment I am outputting using the following:

    @{ var text = Model.MacroParameters["text"]; } @Html.Raw(Server.HtmlDecode(text.ToString()))

    Suggestions?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 26, 2016 @ 08:46
    Jan Skovgaard
    0

    Hi Bo

    Not sure I understand what the issue is? Perhaps the mark down editor formatted your example into something else than you meant to display? I only see a "Click here" link, which refers to this post...perhaps a screendump would be easier to attach and make it more clear what the issue is?

    Is it that you're not sure how you should render the link? Or does the link render weirdly?

    /Jan

  • Bo Dudek 14 posts 84 karma points
    Apr 26, 2016 @ 08:48
    Bo Dudek
    0

    Hi

    Ah, didn't realize the forum editor parsed my stuff. Anyway, it outputs html and then this http://cl.ly/3v3U461g2q47

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 28, 2016 @ 05:07
    Jan Skovgaard
    0

    Hi Bo

    Oh so the issue is that the href attribute get's the locallink stuff...not sure how you have done your implementation but perhaps some inspiration on how to deal with this can be found by having a look at the Umbraco source code? If I remember correctly there is a regex somewhere involved with getting the correct url...

    I'm think that you should somehow be able to get the id in the locallink:1082 string and then use a method like NiceUrl (if it's called this these days) to give you the correct url...but that's of course only if it's a local/internal url and not an external url - Does this make sense?

    Unfortunately I'm not a c# wizard myself so can't provide any code-samples :-/.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft