Hi! I’m trying to create a set of new macros to share across projects and I see some issues to have this working fine. First, a macro can’t hold the “HtmlArea” input type, so, if I want to get a styled box containing a text, it won’t work, and if I add this element type, it is rendered as an ugly and simple “TextArea” element, as you can see on the attached picture:
Also, I can’t use “Item Sets”. Suposing I want to create an accordion element, that will handle some sets of Title (which is shown when the accordion is collapsed) and Content (to show when expanded). If I set the minimum occurencies to 0, the button to “Add Expandere Element” is show, but without any action when clicking on it.
This should be used to render an accordion group on the frontend. We achieve this using shortcodes and we have been using since 6.5.2 Just placing {{ACCORDION1}} or the order of the group we want to show in the article body, we replace the tag with the content on the group and then thymeleaf renders it.
Ok, I understand, but that is not going to work with macros.
What about creating a part component with the same logic and having the same config in the part form? You can then configure the accordion in Live Edit.
I worked a bit with macros and i would really like to see it be improved.
Some use cases which have room for improvements:
Authors want a fact-box inside an article.
You could as mentioned use a part and add it in the live edit, but this doesnt allow you to add it mid-text, and it also wouldn’t be searchable when doing an article search.
Macros seems to solve both these issues, but there are some drawbacks. Firstly, you cannot use a HTMLArea, which means you probably want to create this as a body. The problem with this is that it now displays an empty popup, both the preview and config is unused. In addition it only leaves a [facts /] tag in the HTMLArea of the article, leaving the author in charge of properly formatting the macro.
I can see the macro inside macro issue, but nothing is currently stopping you from doing that manually either - and to be honest, maybe it should actually just work.
Authors want a gallery inside an article.
For the same reasons as previously mentioned, this could be better with a macro than a part.
The problem here is that Item Sets do not work and it makes it harder to make a gallery with alt/credit/figcaption fields.
I also want to add that the HTMLArea macro tag could look nicer than [macro]-format. Maybe a placeholder macro wrapper would be better and rather have the [macro]-format in source code?
TLDR;
It would be good for HTMLArea and ItemSets to work in macros.
Yes, the body element does work as a single “HTMLArea”. But as i said it leaves it up to the editor to properly format it, since macros are always outputted self-closed.
Does it have to be serialized though? Could it be stored as a JSON in the back, and previewed in the editor as it would look when rendered? Then you could click it to edit macro
Concept with macros is really to enable editing it without using the insert dialogue at all. I guess we have to investigate this further. I guess it would be cool to be able to insert any part as a macro too, and store the part config outside of the html?
For example: we have a gallery mixin where the user can set up multiples item sets with images and a macro that places “[bildeserie id=”(0-9)"]" where the parameter “id” is the order of the images gallery.