QUESTION: Is there a way to use different variations of the same style property?
Question
Note: This is in the context of the Style Manager.
Is there a way to use different variations of the same style property?
For example when I use the text-align property on a non-text node component I'd like the label to read "Align Content" with the options of "left", "right" and "center". However, when the "text-align" property is displayed for a text node I'd like the label to read "Align Text" with the options of "left", "right", "center", and "justify".
I've searched the documentation and issues on GitHub and can't seem to find any answers.
Does anyone know how to achieve this?
Thanks in advance!
Answers (3)
I don't think that's possible using the API, also does text-align work for non-text components? You'll probably want to use the align-content property from flexbox
You should try to use Component's stylable-require property to show the particular style property (marked with toRequire) and unstylable for the one you don't need.
editor.Components.addType('...', {
model: {
defaults: {
'stylable-require': ['align-content'],
unstylable: ['text-align'],
}
}
});
// in your StyleManager configuration
buildProps: [..., 'text-align', 'align-content'],
properties: [{
// ...
property: 'align-content',
toRequire: true, // <-- So this property will be hidden if the component doesn't require it
}]
@artf Thank you for your response.
In this case, I would still have an issue using the align-content property with flex columns and rows. For columns, I'd like the options to read: Top, Center, and Bottom and for rows I'd like the options to read: Left, Center, and Right.
My users aren't too familiar with CSS let alone flexbox and to use Start, Center and End won't be as good of a user experience as I'd like.
Do you have any other suggestions?
Thank you, Josh
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1428
[Question] Define or hide properties for specific components
Hi, I'm wondering if there is the possibility to define properties for specific components. I mean, when I select the component Image I wou...
Issue #1709
[QUESTION] Is it possible to affect child component's styling through parent component's style manager?
Hello there! Awesome project and thanks for your contribution. I would like to know if it is possible to change the styling of a child comp...
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 #1144
[Question]: Custom property to change multiple settings
Is there a way to extend a current property or create a new one to change multiple properties? I have a component in which I would like to...
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.