Copied to clipboard

Flag this post as spam?

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


  • teus 42 posts 74 karma points
    Jan 03, 2014 @ 12:10
    teus
    0

    calling Umbraco.AssignedContentItem in macro gives "No macro content available for WYSIWYG editing"

    I'm using Umbraco v6.1.6 (Assembly version: 1.0.5021.24867)

    I made a small macro(\Views\MacroPartials\helloworld.cshtml) to illustrate the issue:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @{
    
       IPublishedContent asigned = Umbraco.AssignedContentItem;
    
    }
    Hallo wereld !!
    

    When used in a "Richtext editor" property the box where the rendered should be, shows

    helloworld

    No macro content available for WYSIWYG editing

    If I comment out the line "IPublishedContent assigned = Umbraco.AssignedContentItem;" the rendered content shows just fine.

    So not a big bug but does anyone know of a solution?

    Or maybe another way to get the Node the macro is in, instead of Umbraco.AssignedContentItem? Because I think it is a nice feature to show immediately to the client what wil be shown on the page.

    Thanks

    Teus

  • Jeroen Breuer 4909 posts 12266 karma points MVP 5x admin c-trib
    Jan 03, 2014 @ 14:09
    Jeroen Breuer
    101

    Did you try Model.Content? I think that should return the current page in a PartialViewMacro.

    Jeroen

  • teus 42 posts 74 karma points
    Jan 06, 2014 @ 10:39
    teus
    0

    Thanks Jeroen. This is indeed the obvious and simple(aargh!!) solution.

  • Jeroen Breuer 4909 posts 12266 karma points MVP 5x admin c-trib
    Jan 06, 2014 @ 11:02
    Jeroen Breuer
    0

    Could you please mark a post as the solution if it helped you?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies