Issue #3185Opened December 11, 2020by Stiggi0 reactions

[QUESTION] How to get the models trait of a component?

Question

Hi there,

I added a new type "array" to the TraitManager. So I can add several sub traits. On one point I have to check the traits of the model. I do this with a construct like this:

domc = editor.DomComponents;
selc = editor.getSelected();  // get the currently selected component

type = selc.get('type'); // now i have the type name of my selected component

comType = domc.getType( type );
defaultTraits = comType.model.prototype.defaults.traits;

Is there an easier way to get the model of a component directly from the component?

Best regards, Michael

Answers (1)

StiggiDecember 16, 20200 reactions

simpler than I thought :)

editor.getSelected().defaults.traits

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.