Issue #650Opened December 15, 2017by vishal50331 reactions

Help Wanted : On Trait update

Question

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,

Answers (2)

ryandebaDecember 16, 20171 reactions

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);
  };
})
lock[bot]September 18, 20190 reactions

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.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.