import template
Question
Hi . I have a json string like this '{ "assets": "[{"type":"image","src":"./img/team1.jpg","unitDim":"px","height":0,"width":0}]", "css": "* { box-sizing: border-box; } body {margin: 0;}", "styles": "[]", "html": "", "components": "[]"}'. Now I want to import it.
Answers (2)
Honestly, I'd recommend following the flow with the storage manager, but in any way, you could achieve it in this way:
const obj = var tt = JSON.parse(yourJsonString);
editor.setComponents(obj.components);
editor. setStyle(obj.styles);
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.
Issue #609
CSS editing duplicates body properties
It's still duplicating body sections and properties: When I pull it up, this is what it looks like: <img width="472" alt="screen shot 2017-...
Issue #453
Previously saved css rules not showing in Style Manager
Previously saved css rules using remote method are not showing in Style Manager. remote json response {"gjs-assets":"","gjs-css":"*{box-siz...
Issue #957
[Question] Add custom attributes (data-) to assets/images on Upload/Selection
Hi, I am trying my best to find the proper/best way to do this, but I need to attach two custom HTML5 data tags to an image once it is sele...
Issue #1333
Bug in WebPage Demo
To reproduce: 1) Open https://grapesjs.com/demo.html in incognito mode. 2) Import this code: 3) Clear Canvas 4) Press Import. Result: The c...
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.