I am creating a set of modules (widgets) with apostrophe-cms (2.x). Now I want to create different nested widgets, to use some of the modules e.g. in a 2-column layout. I followed the tutorial for nested-widgets https://apostrophecms.org/docs/tutorials/getting-started/layout-widgets.html and created a simple two column layout:
module.exports = {
extend: 'apostrophe-widgets',
label: 'Two Column Layout',
contextualOnly: true,
addFields: [{
name: 'columnLeft',
type: 'area',
label: 'Left Area',
},
{
name: 'columnRight',
type: 'area',
label: 'Right Area',
}
]
};
In part this works. I can add other widgets inside the two areas and the html gets correctly built. The problem comes when I use other widgets below the two column layout. Taking a look at the Inspector, I see that all widgets below get built inside the two-column apos-area-widget-wrapper . When I only want to delete the two column widget then, I also delete all modules below. (See image Link)
Chrome Inspector, wrong nesting of widgets inside the two column widget
Am I missing something or does the nested layout somehow miss its closing tag, so everything gets pulled into it?
(Update): Trying to narrow down the problem: I can add new (non-layout-only) modules below, they appear correct. As soon as I try to add another layout widget, I cannot do anything with it as it does not save any information.
(Update): GitHub Project for demonstration: https://github.com/raphaelurban/apostrophe-test