Adding new traits to component and update current ones with these
@Lakshit-Singhal In that case I think the best option would be to create a custom plugin, and before you initialize GrapesJS, call the API, get the values and pass them in the initialization function via the plugin's options, that way they are present when the trait gets initialized. Check the documentation on how to...
Read full answer below βQuestion
I have some custom components created before modifying their traits (for example, I created a new trait for it), these components wont contain the new trait. If I drag a new component into the editor, it will have it. Steps to reproduce: 1) Create a custom component and compile the code 2) Drag this custom component into the editor 3) Save the changes to DB 4) Modify the component by adding a new trait and compile again 5) Load the components from DB 6) Loaded components wont have the new trait I load and save all the data into the database: styles, css, components,and html. load(keys, clb, c...
Answers (3)
@Lakshit-Singhal In that case I think the best option would be to create a custom plugin, and before you initialize GrapesJS, call the API, get the values and pass them in the initialization function via the plugin's options, that way they are present when the trait gets initialized. Check the docu...
This happens because the editor stores also traits information in components. You can delete this information be extending the component and updating its toJSON method ps: I think I'll remove traits from JSON in the next release. Perhaps many versions back that would have made sense, but now I'd no...
@artf this removed custom traits !! as I mentioned in #2007
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3500
Remove custom trait by its type.
I have created a custom trait but the name of that trait will be dynamic which is unknown. The problem is that the current removeTrait() on...
Issue #3388
FEAT: adding indication as a Trait without any input.
I want to add an indication for a trait. For my component, I have the traits: and for the type 'dateformat-indication', I created the type:...
Issue #3239
[Question] How to update attribute/properties dynamically from Component Script?
We have a use case where we want to insert charts dynamically using Highcharts Editor. I have created a component, which on drag and drop,...
Issue #3213
How to save the dynamically added traits
Hi, @artf, I have a custom component that has a button trait. When the button is pressed, I am adding a custom trait dynamically using comp...
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 βBrowse Plugin Categories
Jump directly to plugin category pages on the marketplace.