Copied to clipboard

Flag this post as spam?

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


  • David Amri 195 posts 700 karma points
    Nov 06, 2017 @ 08:49
    David Amri
    0

    StripHtml

    Hi,

    I have a rte property with <p> tags with nested <a> tags. Now I'm trying to remove the <p> tags from that property.

    If I use:

    Umbraco.StripHtml(item.propertyAlias, "a");
    

    the <a> tag is removed and the <p> tags are still rendered as expected.

    But if I use:

    Umbraco.StripHtml(item.propertyAlias, "p");
    

    the <p> and the <a> tags are removed? Shouldn't this only remove the <p> tag? Or will this simply remove the <p> tag and all the html within the paragraph?

    Best regard David

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Nov 06, 2017 @ 09:40
    Alex Skrypnyk
    0

    Hi David

    What property editor are you using?

    Thanks,

    Alex

  • David Amri 195 posts 700 karma points
    Nov 06, 2017 @ 09:40
    David Amri
    0

    Sorry... Rich text editor

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Nov 06, 2017 @ 09:42
    Alex Skrypnyk
    0

    Try to use RemoveParagraphTags method:

    library.RemoveParagraphTags(value)
    
  • David Amri 195 posts 700 karma points
    Nov 08, 2017 @ 13:05
    David Amri
    0

    Thanks Alex,

    When trying out "RemoveParagraphTags" an error is thrown due to "library does not contain a definition for RemoveParagraphTags".

    I'm trying to display the rich text editor data inside a partial view with razor.

    / Regards David

  • Ben Palmer 166 posts 811 karma points c-trib
    Nov 13, 2017 @ 23:40
    Ben Palmer
    0

    Not exactly clean but you could get away with a couple of simple replacements here:

    item.propertyAlias.Replace("<p>", "").Replace("</p>", "")

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies