grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

[Bug] Element auto generated id not added back after custom id is used and then cleared

Open maxtacco opened this issue 7 years ago • 1 comments

Hi, I think there is a bug related to the generation of element id attributes. When modifying element's style the value of the element's id attribute is auto generated and added to the HTML that once can see in the Code editor. Then the id attribute value is updated correctly when Id editor is used in the Settings to specify a custom id. But, once this Id value is cleared the auto generated value is not applied to the element's id attribute anymore. Instead id is set to an empty string (i.e. id="") I wonder if it has to do with Id trait that doesn't set id to null but instead sets to an empty string when cleared. Thank you.

maxtacco avatar Feb 01 '18 15:02 maxtacco

Also, if this is the case would be nice to set the default "empty" value strategy for traits in the configuration of a component. For example, emptyValue: "" or emptyValue: null or emptyValue: () => {}.

maxtacco avatar Feb 01 '18 15:02 maxtacco