[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)
simpler than I thought :)
editor.getSelected().defaults.traits
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3461
Re-render trait on selected component
I know there is a function that can rerender the view of a trait. However, I still don't know how and where to use it.
Issue #2404
Question: how to observe children changes in component
Is there an easy way to subscribe/listen to changes in the components/children of my custom component type? Perhaps an event I can subscrib...
Issue #2696
[QUESTION]: How can I create block with background image with behavior like built-in "image"?
Hello, I'm trying to create block with background image (similar to Grapedrop Image Box). I added new component like this: And also I added...
Issue #3732
BUG: comment component type do not support adding traits
i am working on a script that add a trait on all the component type , but the comment type do not have the prototype object. code
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.