Template does not load using just components
Question
I am trying to load an existing template. I believe that it should work with either components or HTML but it seems to work only through HTML. The following code does not work but code with the corresponding HTML does.
The LandingPage Json was taken from the dev toolbar panel
const LandingPage = {
"html": null,
"components": "[{'type':'text','attributes':{'id':'i0fq'},'components':[{'type':'textnode','removable':false,'draggable':false,'highlightable':0,'copyable':false,'selectable':true,'content':'Insert your text here','_innertext':false}]}]",
"assets": "[]",
"css": "* { box-sizing: border-box; } body {margin: 0;}#i0fq{padding:10px;}",
"styles": "[{'selectors':['#i0fq'],'style':{'padding':'10px'}}]"
}
var editor = grapesjs.init({
height: '100%',
showOffsets: 1,
noticeOnUnload: 0,
container: '#gjs',
fromElement: false,
components: LandingPage.components ,
// We might want to make the same check for styles
style: LandingPage.style || LandingPage.css,
storageManager: {
autoload:true
}
});
Answers (2)
@Vikash-ra please follow the issue template when you create one.
Thanks for reporting this, @Vikash-ra.
Thanks for sharing your report about Template does not load using just components. To help the team investigate and prioritize this:
Please provide:
- A minimal reproducible example (CodeSandbox/JSFiddle)
- Your GrapesJS version number
- Browser and OS information
- Any error messages from the browser console
- Steps to reproduce the issue
What helps most:
- Minimal code example (not your full project)
- Screen recording or screenshot showing the issue
- Expected vs actual behavior clearly stated
- GrapesJS configuration you're using
With these details, the maintainers can identify and prioritize a fix much faster. The GrapesJS team is very responsive to well-documented issues.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #4191
We are trying to store the data from grapesJS editor in Angular 10 application, getting CORS error, image attached below
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome 99.0.4844.5 Reproducible demo link...
Issue #3631
How to load dynamic content in the final HTML file?
I looked everywhere, including the issues section and tried a few things. But really unsure how to load dynamic content in my components al...
Issue #3170
Add class name from traits
Hello, what i am trying to achieve is to have the text component extended by assigning an extra trait named Alignment and deciding through...
Issue #6152
CSS added via custom code persists after custom code component is removed
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? any Reproducible demo link https://grapesj...
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.