Issue #2245Opened September 5, 2019by vivek106880 reactions

save html with inline css server side

Question

hello all , I am using version 0.15.3 and want to save html data with inline css to server side

 var editor = grapesjs.init({
                            height: '100%',
                            forceClass: false,
                            noticeOnUnload: 0,
                            container: '#gjs',
                            fromElement: true,
                            plugins: ['grapesjs-mjml'],
                            pluginsOpts: {
                                'grapesjs-mjml': {}
                            },
                            storageManager: {
                                autosave: false,
                                setStepsBeforeSave: 1,
                                storeHtml: 1,
                                type: 'remote',
                                urlStore: 'SERVER-URL',
                                contentTypeJson: false,
                                params:{'html':localStorage.getItem("htmldata")}
                            }
                        });
            console.log('version', grapesjs.version)

            editor.Panels.addButton('options', 
                [{
                    id: 'save-db',
                    className: 'fa fa-floppy-o',
                    command: 'save-db',
                    attributes: {title: 'Save DB'}
                }]
            );


            // var commands = editor.Commands;
            editor.Commands.add('save-db', {
                run: function (editor, sender) {
                    //sender && sender.set('active', 0); // turn off the button
                    editor.store();
                    var htmldata = editor.runCommand('mjml-get-code').html;
                    localStorage.clear();
                    localStorage.setItem("htmldata", htmldata);
                }
            });

            editor.runCommand('save-db');

this is my code where I am storing html to local-storage first and than sending it using storage manager . I want to know is there any way where I can send html with inline css without storing it into local-storage or by using ajax , I have already checked some solution where ajax is used but in my case ajax is not working don't know why? Can any one please help me ...

Answers (1)

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.