Issue #2346💬 AnsweredOpened October 21, 2019by frankpagan1 reactions

When a component is clicked is there a hook to know when the traits have rendered.

快速解答by frankpagan1

Perfect, Thank you!

Read full answer below ↓

Question

Hey Grapes Community, When a component is clicked from within canvas is there a hook or event to know when the traits have rendered in view container for the selected component?

Answers (2)

frankpaganOctober 24, 2019

Perfect, Thank you!

pouyamiralayiOctober 21, 2019

Hi there!

When a component is clicked

component:selected is the event you are looking for. more on this here

to know when the traits have rendered in view container

based on the nature of the the suggested event, you will receive the model of the selected component as an argument, this way you can check for the availability of any trait on the model:

editor.on('component:selected', ( model => {
        console.log(model.get('traits'))
    })
)

cheers!

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.