grapesjs-preset-webpage
grapesjs-preset-webpage copied to clipboard
Background color doesn't effectively change when removing value
When removing a value from the background-color
property and pressing enter , the color doesn't effectively get removed.
A workaround is to listen for changes to the background color property, and bind a transparent
value to the model
this.editor.on('component:styleUpdate:background-color', (model) => {
const updateToBg = this.editor.StyleManager.getProperty('background_&_border', 'background-color').attributes.value;
let s = model.getStyle()
if (!updateToBg) {
model.setStyle({...s, 'background-color':'transparent'});
}else{
model.setStyle({...s, 'background-color':updateToBg})
}
});
});