grapesjs
grapesjs copied to clipboard
Help Wanted : On Trait update
Hello,
I have applied a href trait on image tag. Can you please tell me which event fires when href trait is changed for that.
Thanks,
Hi @vishal5033,
The component:update event should get triggered when a trait changes, but it's also going to fire when anything changes. You could check for the specific trait (href) by inspecting the changed property of the component object that's passed to the callback. Maybe something like this:
editor.on("component:update", function(component) {
if (component.changed && component.changed.attributes && component.changed.attributes.href) {
console.log("href changed!", component);
};
})
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.