Issue #1674💬 AnsweredOpened December 20, 2018by alialrabi0 reactions

Render block after trait action .

Quick answerby artf

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)

artfDecember 21, 2018

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

alialrabiDecember 21, 2018

Thanks for replay and for your great tool ,So is it possible to render the component by trait.

artfDecember 21, 2018

Yes, you can listen for trait changes and doing whatever you want

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.