Closed ltenti-eventboost closed 3 years ago
Try adding it inside defaults
@Ju99ernaut I did it:
model: {
defaults: {
ebTesto: 'Ciao',
....
I think it's not stored since the property hasn't been changed from the default. The editor should be able to recover the property from the component definition itself.
I think it's not stored since the property hasn't been changed from the default. The editor should be able to recover the property from the component definition itself.
Correct.
One note for your component definition, you don't need this check
if(el.getAttribute && el.getAttribute('data-gjs-type') ==COMPONENT_TYPE) {
GrapesJS checks already internally for data-gjs-type
, so you can even remove isComponent
(which is used only to identify components post-parsing).
Thank you both!
I would like to create a custom component with a property that will be updated by specific code, but I don't want this property to be visible and updatable as a trait; let say my property is called "ebTesto", I wrote a plugin function like that:
I expected to find my new property in the "gjs-components" part of the stored JSON, but this is what I got:
Maybe I'm trying the wrong way? Has anyone ever had a similar need? Thanks for your help!