GrapesJS / components-countdown

Simple countdown component for the GrapesJS Editor
BSD 3-Clause "New" or "Revised" License
22 stars 37 forks source link

Countdown and Navbar component doesn't work correctly in React. #17

Closed AntonRomanenkov closed 1 year ago

AntonRomanenkov commented 1 year ago

Countdown and Navbar component doesn't apply style when load data from localStorage. Here are my packages I am using.

"grapesjs": "^0.20.1", "grapesjs-blocks-basic": "^1.0.1", "grapesjs-component-countdown": "^1.0.1", "grapesjs-navbar": "^1.0.1", "grapesjs-react": "^4.0.1",

But it works correctly when I export and load it from Browswer. Here are my grapesjs configuration in my component.

componentDidMount() { this.props.init(); let editor = grapesjs.init({ fromElement: true, container: '#gjs', storageManager: { type: 'local', autoload: true, autosave: true, stepsBeforeSave: 1, storeComponents: true, storeStyles: true, storeHtml: true, storeCss: true, autorender: false }, plugins: [ basic, plugin, forms, navbar, countdown, pgexport ], pluginsOpts: {

                addExportBtn: true,
                btnLabel: 'export',
                css: {
                    'style.css': ed => ed.getCss(),
                    'some-file.txt': 'My custom content',
                },
                img: async ed => {
                    const images = await ed.getComponents();
                    return images;
                },
                'index.html': ed => `<body>${ed.getHtml()}</body>`
            },
        }
    });
    editor.load();
    editor.render();

}

Can you please explain how to fix this error?

artf commented 1 year ago

Same as here