Copied to clipboard

Flag this post as spam?

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


  • Kelsee Ishmael 71 posts 158 karma points
    Jul 29, 2020 @ 00:31
    Kelsee Ishmael
    0

    In the grid, macros placed inside the Rich Text Editor are not rendering on front-end of site

    I am trying to insert a macro that will create dynamic content within RTE content. When viewing the page on the front end of the site, it simply displays the macro name.

    Example:

    enter image description here

    I need it to be in the RTE grid component instead of a separate macro component so I can create dynamic content inline.

    Thanks!

  • Amir Khan 1186 posts 2533 karma points
    Jul 29, 2020 @ 01:05
    Amir Khan
    0

    Think you're missing the attachment.

  • Kelsee Ishmael 71 posts 158 karma points
    Jul 29, 2020 @ 01:10
    Kelsee Ishmael
    0

    You're right. Thanks for the catch!

  • Amir Khan 1186 posts 2533 karma points
    Jul 29, 2020 @ 01:41
    Amir Khan
    0

    How are you rendering the macro?

  • Kelsee Ishmael 71 posts 158 karma points
    Jul 29, 2020 @ 04:01
    Kelsee Ishmael
    0

    I'm not. I'm using the default out of the box from Umbraco grid. The rendering is happening here /Views/Partials/Grid/Editors/Rte.cshtml

    I can see where the view is parsing the umbraco internal links

    @{
        var value = TemplateUtilities.ParseInternalLinks(Model.value.ToString(), Current.UmbracoContext.UrlProvider);
        value = TemplateUtilities.ResolveUrlsFromTextString(value);
        value = TemplateUtilities.ResolveMediaFromTextString(value);
    }
    @Html.Raw(value)
    

    but there isn't anything to convert the macros, which is why they aren't rendering.

    I was attempting to use RteMacroRenderingValueConverter without having to build a VS Project. I'm trying to only use razor on this project for various reasons. There might be a way to do it, but I'm not familiar enough with how.

  • Amir Khan 1186 posts 2533 karma points
    Jul 29, 2020 @ 04:05
    Amir Khan
    0

    I hate to refer you to docs, but late here..

    You still have to use a macro partial to render the macro, you can definitely do this in razor without VS or compiling anything: https://our.umbraco.com/documentation/reference/templating/macros/

  • Kelsee Ishmael 71 posts 158 karma points
    Jul 29, 2020 @ 04:59
    Kelsee Ishmael
    0

    There isn't a problem with the macro partial. The macros work outside of the grid RTE. It works in a regular RTE that is added to a document type via a property. It works in the grid when using the default macro component. Rendering a macro in the view with Umbraco.RenderMacro works.

    My problem is specifically about displaying a macro in the RTE via grid and what code is needed to run the default Umbraco process to convert the code Umbraco places by default in RTE (below) to a rendered macro.

    <div class="umb-macro-holder siteVariantLink umb-macro-mce_1 mceNonEditable"><!-- <?UMBRACO_MACRO macroAlias="siteVariantLink" firstUrl="test" secondUrl="second" thirdUrl="654" forthUrl="655" linkTitle="testtitle" openInNewWindow="0" /> --><ins>Macro alias: <strong>siteVariantLink</strong></ins></div>
    

    I could write something to converts the macro name and moves all of the macro parameters to render the Umbraco.RenderMacro code, but it would be time-consuming. My hope was that the Umbraco API would have some type of utility that already did this.

    It may not and if it's late there, you don't have to find an answer. Was just putting it out there to the masses.

  • Erik 10 posts 51 karma points
    15 days ago
    Erik
    0

    Did anyone ever figure this out?

    My case is that i'm trying to insert a Umbraco-forms macro via the RTE in a Perplex Contentblock.

    The result HTML markup contains:

    <div class="umb-macro-holder renderUmbracoForm umb-macro-mce_1 mceNonEditable">
      <!-- the complete umbraco form commented out in HTML -->
      <ins>   
        [just the form labels without input elements]
      </ins>
    </div>
    

    Inserting the same macro via RTE outside the content blocks (or grid) works fine.

  • Kelsee Ishmael 71 posts 158 karma points
    14 days ago
    Kelsee Ishmael
    0

    Unfortunately no, I never found a solution. I've just used the default "insert form" module for the grid.

Please Sign in or register to post replies

Write your reply to:

Draft