Correct format for load template
Issue was caused by invalid JSON data inside "gjs-components" on saving, which breaks the loading later.
Read full answer below βQuestion
Hey,
I'm searching for the right way of loading template, generated by GrapesJS, but nothing is loading.
Can someone please check, maybe format is not ok. https://api.myjson.com/bins/14o5yz
There is no error message, just empty editor.
Data is saved in the database with the following code
$params = file_get_contents('php://input');
$params = json_decode($params, true);
The type of the columns is TEXT.
This is my code
var builder = grapesjs.init({
container : '#html-wrapper',
plugins: ['gjs-preset-newsletter', 'gjs-plugin-ckeditor', 'img-link-plugin'],
clearOnRender: true,
assetManager: {
upload: '/index.php?page=mod&mod=' + mod_param + '&action=ajax-upload-images',
dropzone: true,
},
storageManager: {
id: 'gjs-',
type: 'remote',
autoload: true,
autosave: true,
storeComponents: true,
storeStyles: true,
stepsBeforeSave: 1,
contentTypeJson: true,
urlStore: '/index.php?page=mod&mod=' + mod_param + '&action=ajax-save-campaign-template',
urlLoad: '/index.php?page=mod&mod=' + mod_param + '&action=ajax-load-campaign-template&template_id=' + template.id,
params: {
template_id: template.id,
template_name: template.name
}
}
});
Answers (1)
Issue was caused by invalid JSON data inside "gjs-components" on saving, which breaks the loading later.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #5046
is there any way to remove cross svg on selected default value of Float, Position and text-align
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Version 111.0.5563.147 (Official Build) (6...
Issue #3367
Modal template
Is there a way for me to modify the template from a compiled state? https://github.com/artf/grapesjs/blob/d3256e621bb43a537213ffcd86b10dc0b...
Issue #597
storageManager: Loading from remote storage
Hi, I'm trying to read the HTML and CSS from my database. When I try to load it into the editor, nothing displays. I can store the data jus...
Issue #6606
Editor takes a long time to load (sometimes over 1 minute)
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Firefox Reproducible demo link https://gra...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins βPremium plugins ship with support, regular updates, and production-ready features β save days of integration work.
Browse premium plugins βBrowse Plugin Categories
Jump directly to plugin category pages on the marketplace.