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:
<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?
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.
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...
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:
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?
Might help? https://our.umbraco.com/forum/using-umbraco-and-getting-started/101363-my-solution-to-inline-macro-in-grid-feedback-wanted
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!
Also, it would be great to have your voice added to this: https://github.com/umbraco/Umbraco-CMS/discussions/11918
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...
This is supported from Umbraco 11 and on. https://docs.umbraco.com/umbraco-cms/reference/templating/macros/managing-macros#enable-inline-macro
is working on a reply...