Save configuration of dynamic blocks into HTML? (Countdown, Slider)
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)
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.
@alikabeer32 Hmm, that seems to have solved the problem. Thanks!
Related Questions and Answers
Continue research with similar issue discussions.
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 #2596
[QUESTION] Add html, css and js to Block Manager
[QUESTION] Hi! I'm retrieving dynamic html,css and js codes from the database. How can I create Blocks with this? Currently, this is my cod...
Issue #2982
BUG: Executing editor.load(x) on x = editor.store() results in error.
Version: 0.16.18 Are you able to reproduce the bug from the demo? [X ] Yes [ ] No What is the expected behavior? I would expect that assets...
Issue #2184
[QUESTION] Losing predefined media queries
Hi. I have a predefined json of a template which contains a set of html elements and styles which are parsed into the set of components upo...
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.