Copied to clipboard

Flag this post as spam?

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


  • Joe Dirte 21 posts 163 karma points
    Apr 28, 2017 @ 19:22
    Joe Dirte
    0

    Issues with Macro Rendering

    Hey Our.

    I'm working with some macros right now and am seeing some weird stuff. I hope someone can shed some light on the behavior for me.

    I have this macro.cshtml

     var imageCaption = Model.MacroParameters["imageCaption"];
    
    <div class="articleHeroContainer">
        <figure>
            <img id="articleHeroImage" src="@Umbraco.Media(Model.MacroParameters["image"].ToString()).Url" />
            <figcaption class="details-font">@Html.Raw(imageCaption)</figcaption>
        </figure>
        <hr />
    </div>
    

    It is plugged into an RTE and everything wires up just fine. The problem occurs when the view is rendered this is the output.

        <div class="umb-macro-holder ImageWithCaptionMacro mceNonEditable umb-macro-mce_0">
        <!-- <?UMBRACO_MACRO macroAlias="ImageWithCaptionMacro" image="1310" imageCaption="&lt;p&gt;Photo by Some Guy&lt;br /&gt;Hey here's a caption - outta site.&lt;/p&gt;" /> -->
    <ins>
        <div class="articleHeroContainer"><img id="articleHeroImage" src="/media/1047/supahero.jpg" alt="">
        <p>Photo by Some Guy<br>Hey here's a caption - outta site.</p>
        <hr>
    </div>
        </ins>
    

    What exactly am I doing wring here? Should I render a partial inside the macro partial and pass the values over I need?

    Thoughts?

  • Joe Dirte 21 posts 163 karma points
    Apr 30, 2017 @ 20:15
    Joe Dirte
    0

    So I was able to track the issue down to TinyMCE configuration - atleast that's where I am now.

    I've added the following value to the config and refreshed app pools, but still no joy.

    figcaption[class|style],

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    May 01, 2017 @ 09:12
    Dave Woestenborghs
    0

    Hi Joe,

    I think you also need to add this one to the tinyMce conifg :

    figure

    And have you checked if the macro outputs correctly when you added it directly to the template. Just to rule out issues with the macro itself.

    Dave

  • Bhawna Jain 16 posts 96 karma points
    May 01, 2017 @ 07:00
    Bhawna Jain
    0

    just for my info,, does your code has given line of code in starting of your macro code file.?

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    

    And u have this output from ur website in html(lke inspecting html) or is it showing something on webpage also?

  • Joe Dirte 21 posts 163 karma points
    May 01, 2017 @ 12:13
    Joe Dirte
    0

    @Dave and @Bhawna

    Yes on both counts.

    The macro uses an RTE as a parameter. If I call the macro by itself in a gridview everything works fine.

    When called inside of an RTE, the macro will render correctly in the RTE, but will loose any non P tags that were included when the macro RTE param was authored.

Please Sign in or register to post replies

Write your reply to:

Draft