Copied to clipboard

Flag this post as spam?

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


  • philw 99 posts 434 karma points
    May 11, 2013 @ 16:59
    philw
    0

    Embedding entities with parameters via Macros

    I have a couple of macros I wrote backed-off on user controls. Each can be used by content editors to insert a bunch of complicated markup defined by a handful of parameters (width, height etc).

    My problem is that it's rather clunky to have to "insert a macro" and then fill in the parameters, and because I can't render it on screen (I'm on Medium Trust: macros YSOD if I try to render them in the editor it seems), the content editor can't see the parameters (or their effects).

    So you end up with a little box which tells you "here is a macro with this name", but you don't know what shape or size or type it is. The only way you can see that is to flip into html mode, where there's a lot of confusing stuff, and you can't see the original parameter selections easily. The only real way to alter the parameters is to delete the mess from the HTML, then flip back to the Rich Text, and insert it all over again.

    What I'd like to do is... allow the user to just type in content something like: {put control here, orient:landscape, width:300px, key:123455657575}. Then they can instantly see from the Rich Text Editor what is there, and they can edit the parameters right there also. If I could at least get the macro to render its parameters, then the user would know what it is.

    I've seen what look like old-version discussions on something a bit like this, but I can't figure out what i need to do.

    So I have are two quesitons:

    1. Is there any way to insert a macro by just typing in text, rather than using click-to-insert-macro thing?
    2. Can you get a macro to render its parameters in the Rich Text Editor so the user knows what the inserted thing actually is?

    All suggestions gratefully recieved...

  • philw 99 posts 434 karma points
    May 12, 2013 @ 15:14
    philw
    0

    An alternative to this seems to be to use TinyMCE templates to insert arbitary HTML. If I set it so the user can insert arbitary "canned" HTML that way, I can make it look something like this in the Tiny MCE editor:

     slides orient:landscape, width:300px, key:123455657575

    Then, as I decorate that HTML with jQuery at run time, I can parse out the parameters at that point and render my slides the way I want them.

    • The advantage then is that the Content editor can then edit the values right there in the editor, without having to switch to HTML and then read the mess which is an inserted Umbraco macro.
    • The diadvantage is that the html's rendered at insert time, so if I change the format of it, or the parameters for it, later, then I'll have to edit all the content. Hmm
Please Sign in or register to post replies

Write your reply to:

Draft