Issue #1519πŸ’¬ AnsweredOpened Oct 16, 2018by Controlhaus1 reactions

Init components in grapesjs.init

Quick answerby cjpollard❀ 1

You need to parse the string. JSON.parse(projectData.components)

Read full answer below ↓

Question

Is it possible to initialise the components at grapesjs.init. We are not using StorageManager.load. We already have the project data at init. Using html works fine, but using components renders the components object as text in the editor. this.editor = grapesjs.init({ components: projectData.components || projectData.html, style: projectData.styles || projectData.css, container: '#gjs', plugins: ['gjs-preset-webpage'], pluginsOpts: { 'gjs-preset-webpage': { } }, storageManager: { id: '', // Prefix identifier that will be used on parameters type: 'catchService', // Type of the storage urlStore...

Answers (3)

cjpollardβ€’ Oct 16, 2018

You need to parse the string. JSON.parse(projectData.components)

Controlhausβ€’ Oct 16, 2018

Working now. Thank you for the fast and accurate reply :-)

lock[bot]β€’ Oct 16, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Related tutorials

In-depth guides on the same topic.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.