grapesjs

How to set HTML and CSS in your grape js editor?


I was working in grapesjs and just want to know is there a way to render the HTML and CSS saved in your DB to show inside the grapesJS editor. I saved the HTML and CSS inside the DB and want to render the design inside the editor. is this possible to achieve this in grapesJs?


Solution

  • I finally found this solution. First, save your HTML and CSS inside variables. Then, do this.

    editor.setComponents(html);
    editor.setStyle(css);