Is it possible to change components style from its Traits? #4751
Unanswered
mohamad97-alhomsi
asked this question in
Q&A
Replies: 1 comment
-
Hello! editor.TraitManager.addType('traitname', {
createInput({ trait }) {
// Your UI
},
onEvent({ elInput, component, event }) {
// some code
component.addAttributes({ css })
}
} I think you can use editor.getSelectedToStyle().setStyle({
...editor.getSelectedToStyle().attributes.style,
color:"red"
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using grapes js JSON object
so in JSON object, each component has a type, attributes, and components fields in its object
we know attributes field has the component traits values so I use these traits from the attributes field
What do I need to make these traits affect components in the editor like if i was using style manager on this component
Note: i didn't use style manager to change components' style because i cannot access its values like padding or color, .....etc
from attributes fields
Exp: : if i create trait for a component named rounding corners so if i change values for this trait i want to change the component style and make the component has rounded corners as my trait value
I hope someone understands what I mean
Beta Was this translation helpful? Give feedback.
All reactions