Hi,
I am in the process of converting Block Grids from Umbraco 13 to Umbraco 15.
I have followed the instructions to create a separate project to create custom preview block grids for the CMS using Typescript, Vite and Lit.
So far so good, using 'npm run build' to compile in to /wwwroot/Plug_ins.
The big issue I have come up against, and so far I have come up with no solutions is adding slots in the new typescript code that allowed me to agg content in layouts, in left and right areas.
My code so far is simple not rendering "areas"/"slots" that I can add further content in to like, rich text or other block grids. This is becoming quite frustrating. I have been reading up on slots in web components, but to no avail.
In Umbraco 13 - the code to render blocks was this:
Turning to This example code for Umbraco 15 - for a custom block grid cms preview,, the slots do not render, or allow me to add further content within the layout custom block, with two columns/areas:
In web components, slots are designed to accept content dynamically passed from the parent component, not to define areas within the component itself as your current code suggests.
Thank you for your feedback.
Yes, this does indeed generate the areas so you can edit within them, thank you. Just also wondered, if I am able to target a single area, for example an area with an alias of left or right, can this be done as well?
The custom views I am converting form in my Umbraco 13 build are in some instances are the surrounding columns for banners, and have different CSS applied left and right around the areas, and though it would be good to use those styles and the preview appearing as close as possible to what they will look like when published. Like I have been able to do in Umbraco 13 with Block grid. I also will be having arrangements in the rows for three or four columns. This will help greatly and is a big hurdle surmounted in understanding Typescript and Web Components in Umbraco.
Umbraco 15 - Block Grid - custom Block grid previews with slots
Hi, I am in the process of converting Block Grids from Umbraco 13 to Umbraco 15.
I have followed the instructions to create a separate project to create custom preview block grids for the CMS using Typescript, Vite and Lit.
So far so good, using 'npm run build' to compile in to /wwwroot/Plug_ins.
The big issue I have come up against, and so far I have come up with no solutions is adding slots in the new typescript code that allowed me to agg content in layouts, in left and right areas. My code so far is simple not rendering "areas"/"slots" that I can add further content in to like, rich text or other block grids. This is becoming quite frustrating. I have been reading up on slots in web components, but to no avail.
In Umbraco 13 - the code to render blocks was this:
or this, using slot instead:
Turning to This example code for Umbraco 15 - for a custom block grid cms preview,, the slots do not render, or allow me to add further content within the layout custom block, with two columns/areas:
This is the display that is rendered in the cms:
Please can someone assist, who has successfully rendered slots and content within block grid items in the cms, and advise on the correct code to use.
Thank you.
Kind regards,
Pete
Hi Peter,
In web components, slots are designed to accept content dynamically passed from the parent component, not to define areas within the component itself as your current code suggests.
You could use something like this for your case:
you can also pass in
Hope this helps
Hi Afreed,
Thank you for your feedback. Yes, this does indeed generate the areas so you can edit within them, thank you. Just also wondered, if I am able to target a single area, for example an area with an alias of left or right, can this be done as well?
Thanks again,
Kind regards,
Pete
Yes, you could use something like this:
Hi again Afreed,
That works, thank you. For my starter custom block grid with just two columns, I can get the left and right areas using 0 and 1 like so:
The custom views I am converting form in my Umbraco 13 build are in some instances are the surrounding columns for banners, and have different CSS applied left and right around the areas, and though it would be good to use those styles and the preview appearing as close as possible to what they will look like when published. Like I have been able to do in Umbraco 13 with Block grid. I also will be having arrangements in the rows for three or four columns. This will help greatly and is a big hurdle surmounted in understanding Typescript and Web Components in Umbraco.
Kind regards,
Pete
is working on a reply...