Copied to clipboard

Flag this post as spam?

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


  • JGKN 26 posts 172 karma points
    Sep 22, 2021 @ 12:28
    JGKN
    0

    Inline RTE Macros

    I'm trying to use a macro in an RTE to get a certain date, and display it inline.

    But every time I insert the macro, it adds div tags into the RTE, which then breaks the paragraph tags, resulting in the macro forcing several linebreaks in the frontend text.

    What it looks like after inserting macro:

    enter image description here

    <p>Government started on the </p>
    <div class="umb-macro-holder mceNonEditable"><!-- <?UMBRACO_MACRO macroAlias="GovStartDate" selectedGovernment="umb://document/be8e40fd8f94482b816ebc580079c858" /> --> <ins>Macro alias: <strong>GovStartDate</strong></ins></div>
    <p>with a planned ending of 02/05/2024</p>
    

    The strange thing is that this situation is resolved on the frontend at least if I manually change those div tags to span tags, and then remove the closing p and opening tags.

    Since it's the automatic insertion of the div tags that's causing this, how can I prevent the RTE from inserting them in the first place, and change them all to span tags?

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jan 26, 2022 @ 23:14
  • JGKN 26 posts 172 karma points
    Jan 27, 2022 @ 15:42
    JGKN
    0

    It would be really nice if Umbraco had an option for macros to swap between inline and block in the backend too - but certainly changing the class on the frontend is probably the next best thing.

    Thanks for the link!

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jan 27, 2022 @ 18:10
    Heather Floyd
    100

    Also, it would be great to have your voice added to this: https://github.com/umbraco/Umbraco-CMS/discussions/11918

  • JGKN 26 posts 172 karma points
    Jan 27, 2022 @ 19:17
    JGKN
    1

    I think I marked this as answered too soon - as you pointed out in github, even if you can add styling to the div's class, adding in the macro still adds a p tag, resulting in an unwanted line break...

  • jomehmet 4 posts 75 karma points c-trib
    Jan 17, 2024 @ 09:15
Please Sign in or register to post replies

Write your reply to:

Draft