Issue #2851✓ SolvedOpened June 22, 2020by pooriamo2 reactions

Style Manager Not Working

Quick answerby VojtechLanka2

Had the same problem, adding widthMedia: '' to my custom device fixed it. I think there is some problem when using millimeters in media queries so the styles aren't applied because it thinks your canvas is too big.

Read full answer below ↓

Question

Hi

When I choose a block and try to change the styles, nothing happens. (I'm using the web preset)

Laravel

Here is my config:

        const editor = grapesjs.init({
            canvas: {
                styles: ['/css/canvas.css']
            },
            styleManager: {
                clearProperties: true
            },
            container: '#gjs',
            fromElement: true,
            height: '100vh',
            width: '100%',
            storageManager: false,

            plugins: ["gjs-preset-webpage"],
            pluginsOpts: {
                "gjs-preset-webpage": {
                    blocks: [],
                    blocksBasicOpts: {
                        flexGrid: true,
                    },
                    navbarOpts: false,
                    countdownOpts: false
                }
            }
        });

        editor.setStyle('html {direction: rtl}')

Answers (3)

👍 Most helpfulVojtechLankaJune 24, 2020

Had the same problem, adding widthMedia: '' to my custom device fixed it. I think there is some problem when using millimeters in media queries so the styles aren't applied because it thinks your canvas is too big.

pooriamoJune 23, 2020

It seems that there is a problem with custom device size. When I set default size to desktop, it works.

const deviceManager = editor.DeviceManager;

deviceManager.add('paper-a4', '210mm', {
    height: '297mm',
    name: 'A4',
});

const panelsManager = editor.Panels;

const panelDevices = panelsManager.getPanel('devices-c');
panelDevices.get('buttons').add([{
    id: 'set-paper-a4',
    command: editor => {
        editor.setDevice('A4')
    },
    className: 'fa fa-desktop',
    active: 1,
}]);
pooriamoJune 24, 2020

@VojtechLanka Thank you

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 →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.