Issue #2118πŸ’¬ AnsweredOpened July 5, 2019by lajby951 reactions

Save configuration of dynamic blocks into HTML? (Countdown, Slider)

Quick answerby alikabeer32❀ 1

Is your javascript code actually getting set? It might be because the framework, by default, doesn't set js when you run editor.setComponents(yourhtml); const editor = grapesjs.init({ ... allowScripts: 1, }); this might help you. All the best.

Read full answer below ↓

Question

I am trying to save the template data into the database. Currently I have it working successfully. It posts the Assets, Components, Styles, Html, and CSS data (just like how it saves into the browser's localStorage) to a PHP script. As I found out, the Components part ( editor.getComponents() ) contains the Html structure with all data of dynamic elements which are not static on the page (like Countdown or Slider), so it is reliable for storing the complete template with all dynamic elements. The Html part ( editor.getHtml() ) can only save the static part of the page, it leaves out these dyn...

Answers (2)

alikabeer32β€’ July 6, 2019

Is your javascript code actually getting set? It might be because the framework, by default, doesn't set js when you run editor.setComponents(yourhtml);

const editor = grapesjs.init({ ... allowScripts: 1, });

this might help you. All the best.

lajby95β€’ July 8, 2019

@alikabeer32 Hmm, that seems to have solved the problem. Thanks!

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 β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.