Copied to clipboard

Flag this post as spam?

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


  • Yoni 49 posts 118 karma points
    Nov 29, 2016 @ 13:48
    Yoni
    0

    TinyMce and extra <p>'s problem

    I have tried everything to get the RTE to stop giving me extra <p>s.

    Here is the code that I want :

     The password is case sensitive.<br />
     You may login in <div class="umb-macro-holder GetLoginLink mceNonEditable umb-macro-mce_0"><!-- <?UMBRACO_MACRO macroAlias="GetLoginLink" anchorText="here" /> --><ins>Macro alias: GetLoginLink</ins></div>.<br /><br />
    As this email is not secure, we highly suggest that after you log in you change your password. If for some reason you still can't log in, please 
    <div class="umb-macro-holder mceNonEditable"><!-- <?UMBRACO_MACRO macroAlias="EmailLink" emailAddress="[email protected]" emailText="email us" /> --> <ins>Macro alias: EmailLink</ins></div>
    for further support.<br /><br />
     Thank you for using our services.
    

    But instead, If I use the Enter key in the RTE, this is the code that I get..

    <p>The password is case sensitive.</p>
    <p>You may login </p>
    <div class="umb-macro-holder mceNonEditable"><!-- <?UMBRACO_MACRO macroAlias="GetLoginLink" anchorText="here" /> --> <ins>Macro alias: GetLoginLink</ins></div>
    <p>.</p>
    <p>As this email is not secure, we highly suggest that after you log in you change your password.If for some reason you still can't log in, please </p>
    <div class="umb-macro-holder mceNonEditable"><!-- <?UMBRACO_MACRO macroAlias="EmailLink" emailAddress="[email protected]" emailText="email us" /> --> <ins>Macro alias: EmailLink</ins></div>
    <p>for further support. Thank you for using our services.</p>
    <p> </p>
    

    While, if I was only using this for output on my website, I could deal with it in CSS, but now I want to use the RTE to create an email and in the email, I have no control over the styling.

    Running 7.5.4

    Thanks

  • Kerri Mallinson 113 posts 497 karma points
    Nov 29, 2016 @ 14:29
    Kerri Mallinson
    0

    Have you tried just pasting the code you want in to the source code box on the RTE?

    It may still put start and end tags around the whole text, this can be stripped out using in views @Umbraco.Field("bodyText", removeParagraphTags: true) but i'm not sure about emails, what are you using to generate the emails?

  • Yoni 49 posts 118 karma points
    Nov 29, 2016 @ 14:50
    Yoni
    0

    I have tried to manually change the source, but then whenever a user changes the content (hits Enter) then the source code gets messed up again.

    I use library.RenderMacroContent(library.GetItem(thisnode.Id, <propertyName>), thisnode.Id) to extract the information saved in the property.

  • Kerri Mallinson 113 posts 497 karma points
    Nov 29, 2016 @ 15:10
    Kerri Mallinson
    0

    Sorry, I cant think of a way to stop the enter giving a new paragraph.

    You could try some kind of replace function on the output. For example I use @Html.Raw(result["copy"].Replace(searchTerm, "<strong>" + searchTerm + "</strong>")) to add markup to an output on my search results, perhaps you could do something similar to replace <p> with "". Obviously this would mean you could never have paragraphs and the RTE also seems to be stripping out your <br />. If you need complete control over the markup perhaps it would be better giving the user separate textstring fields for the text and you can compile it from that?

Please Sign in or register to post replies

Write your reply to:

Draft