Replies: 1 comment
-
Hello! @gustavohleal and i are looking for a similar solution. I have a workaround: init() {
editor.on('component:styleUpdate', this.handleStyleChange);
// this.listenTo(this, 'change:attributes', this.handleStyleChange);
},
handleStyleChange(model, style){
console.log(editor.getSelected(),model,style);
if(editor.getSelected().cid==model.cid){
//do something
}
} If Gustavo find other way we will update here. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to listen to style changes. Here is my code:
`
export default (editor: any) => {
console.log('Grapesjs, adding type - '+ GJSTagNames.SectionHeader) ;
editor.Components.addType(GJSTagNames.SectionHeader, {
extend: 'react-component',
model: {
defaults: {
component: BusinessHeader,
stylable: ['background-color'],
resizable: false,
editable: false,
draggable: false,
droppable: false,
removable: false,
attributes: {
showHours: true,
},
toolbar: [],
traits: [
{
type: 'checkbox',
label: 'Show hours',
name: 'showHours',
}
]
},
});
};
`
What I am looking for:
Any time I change the background-color, I want to handle the event. But my "handleStyleChange" callback is not called.
Listening to change in attribute is working.
Any help how to listen to style changes ?
Beta Was this translation helpful? Give feedback.
All reactions