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)
Refer to the command used in Newsletter preset to inline CSS https://github.com/artf/grapesjs-preset-newsletter/blob/master/src/openExportCommand.js by default there is no way to do that
Related Questions and Answers
Continue research with similar issue discussions.
Issue #507
uploadFile being called twice on drop file?
I have an editor initialized as so: If I add an image to the canvas and try to upload a new image by dragging it into the drop area in the...
Issue #974
[Question] Removing the deviceManager and ViewCode buttons
I'm playing with the default init to try and remove the deviceManager and ViewCode buttons... var editor = grapesjs.init({ showOffsets: 1,...
Issue #384
Create and Edit Template into Database
This is my code to Create a new template and insert the inline html with style into the database : I am able to insert the template-data in...
Issue #998
[BUG] Asset Manager sends empty request when uploading image
Description: GrapesJS editor is initialized in an editor.html file as follows: localhost:9001 is a local IIS server running PHP5. The conte...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.