Issue #2458πŸ’¬ AnsweredOpened December 17, 2019by angyLe0 reactions

Setting of default value for css property in StyleManager config does not affect style of new added block?

Quick answerby artf

Hi @angyLe the style manager just builds properties, in a kind of "blind-way", and some of their properties don't affect directly the target (component/rule). In this case the defaults it's more like a hint to show to the user when the property has no value. For this reason, from a practical point of view, you have to...

Read full answer below ↓

Question

I have a question. When css property is added to StyleManager configuration, for example I added color and set defaults to green (just for test):

name: 'Typography', open: false, buildProps: ['color'], properties:[{ name: 'Font color', property: 'color', defaults: "green"}, …

Looks like it does not affect text color of new added blocks? I dropped text block to canvas - text color is black. When I open style manager panel, i see that color is set to green. The same is with other properties I tried (width, height).

Answers (3)

artfβ€’ December 18, 2019

Hi @angyLe the style manager just builds properties, in a kind of "blind-way", and some of their properties don't affect directly the target (component/rule). In this case the defaults it's more like a hint to show to the user when the property has no value. For this reason, from a practical point...

angyLeβ€’ December 18, 2019

I didn't want to make properties different then in specification. I just wanted to set default value for existing properties. For example i want that width of the text box will be 100px, so when it is added to canvas it will be 100px . I thought than i can configure it in StyleManager by setting de...

balchenβ€’ December 18, 2019

@artf I'm sorry, I couldn't understand your answer (@angyLe and I work together on implementing grapesjs in our system, so I know what the question was). When I read your answer, it is my understanding that you are saying the following: 1) default values for properties are not immediately applied t...

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 β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.