Render block after trait action .
Inside the canvas you have Components... not blocks. A block is just a container which creates components when you drag them inside the canvas. Read carefully https://grapesjs.com/docs/modules/Components-js.html and see how you can interpolate component's properties to create dynamic scripts
Read full answer below ↓Question
I have created new block called sidebar that have dynamic updates by trait component ,trait contain checkboxes to dynamic change content by passing parameter to block , block updated but not rendered in editor,How can I render block in editor after click checkbox. I want to update ${data.cat} in editor block content in SidebarTool class export class SidebarTool implements BasicTool { createTool(data){ return { id: 'sidebar', label: '<i class="fab fa-stripe-s fa-3x"></i> <br><br><div>Side Bar</div>', content: { tagName: 'sidebarSelect', components: [ { type:'sidebarSelect', tagName: 'div', scr...
Answers (3)
Inside the canvas you have Components... not blocks. A block is just a container which creates components when you drag them inside the canvas. Read carefully https://grapesjs.com/docs/modules/Components-js.html and see how you can interpolate component's properties to create dynamic scripts
Thanks for replay and for your great tool ,So is it possible to render the component by trait.
Yes, you can listen for trait changes and doing whatever you want
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1683
How to change id/class when new element drop on editor or render element with dynamic ip?
Hello @artf , Hope you are doing well. I have two questions regards dynamic blocks adding, 1) Is it possible to render the block with dynam...
Issue #1679
How to render component in canvas using trait.
Hi Artf ,Thanks for your great tool,I have created test case for my problem https://js.do/code/271771 I have created custom tool sidebar an...
Issue #1982
[QUESTIONS] addcomponent after the selected component
how do I make it possible to add new components after the component I selected, at this time I use editor.DomComponents.addComponent (block...
Issue #1817
Change HTML content while block is render in editor
Hello @artf I have one block into block manager like As per above script inside the block, i want to add dynamic HTML content while this bl...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.