Custom component default children
@simplecommerce a working example of a custom component with default children (it uses local storage) https://jsfiddle.net/t5yw48cs/ Try to review the way you store/load templates, maybe the issue is there https://grapesjs.com/docs/modules/Storage.html#store-and-load-templates
Read full answer below ↓Question
Hi, I am trying to understand how I can achieve the following.Create a component with a default content as children.Create a block to add that component to the canvas.Edit the component children to anything else and save the HTML result.Reload the component in the editor later on and continue editing. My issue is the following:I have tried using components and content in defaults.I have tried defining some custom logic in init function of the view of my component, to only append the default value is no components exists. Both these methods, do not work, they work at first, but if I edit the t...
Answers (2)
@simplecommerce a working example of a custom component with default children (it uses local storage) https://jsfiddle.net/t5yw48cs/
Try to review the way you store/load templates, maybe the issue is there https://grapesjs.com/docs/modules/Storage.html#store-and-load-templates
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #460
When the component's view modifies the HTML, text components are no longer editable
I'm trying to build a custom component that contains some lorem ipsum text in the content, for editing once it's on the canvas. But I also...
Issue #1574
Question, Block content from file
Hi, this is not really an issue but more a question. I'm currently using custom blocks in my GrapesJS editor. This is how I create them : I...
Issue #906
[Question]How to change custom component content (html) from ajax?
Hi @artf, First of all thanks for this awesome plugin. Can you please let me know how i can update/change block content? I created custom b...
Issue #1313
[Question] Set traits value from html on component load
I have custom component and want to set trait default values from html. below is html rendered by component. traits I am trying to set for...
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.