Grapesjs: [QUESTION] Apply styles to all media queries

Created on 26 Feb 2018  路  2Comments  路  Source: artf/grapesjs

Again, congratulations on the great job. We have heavily extended Grapes and we managed to add almost all the functionality we need.

We plan to use it for mobile first pages. So we have set up the Device manager to default to "Mobile Portrait". Styling is done through classes, and we have extended all components to create a new class when being added on the canvas. This suits us and so far it works great.

Yet, when a style is changed on a class, only the media query for @media (max-width:480px) is changed. Thus, the user may have to repeat the same changes for other media queries (or the main CSS). How can we control this behaviour. Can we define which style properties are set up on the non media query based CSS and which are set up on the media query ones?

Or if this is quite complex, can we make the CSS mobile first? Ie: change the break points so that css is formed like this

-Non media query css

  • @media (min-width:481px)
  • @media (min-width:993px)

This way the "primary css" is set up for mobile and overrides take place in Tablet and Mobile

Thnx again!

outdated

Most helpful comment

I figured out how to make it mobile first and it solves my issue for now:

Set the editor config.mediaCondition: 'min-width'

and on deviceManager: [
{name: 'Mobile portrait', width:'320px',widthMedia:'0px'}
{name: 'Tablet', width:'568px',widthMedia:'320px'},
{name: 'Desktop', width:'568px',widthMedia:'768px'},
]

All 2 comments

I figured out how to make it mobile first and it solves my issue for now:

Set the editor config.mediaCondition: 'min-width'

and on deviceManager: [
{name: 'Mobile portrait', width:'320px',widthMedia:'0px'}
{name: 'Tablet', width:'568px',widthMedia:'320px'},
{name: 'Desktop', width:'568px',widthMedia:'768px'},
]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Geczy picture Geczy  路  3Comments

desilvaNSP picture desilvaNSP  路  3Comments

ryandeba picture ryandeba  路  3Comments

krunal039 picture krunal039  路  3Comments

YashPrince picture YashPrince  路  3Comments