Dynamic Changes vanish when load from DB
Thanks for reporting this, @codingmachine16. Great question about Question: Dynamic Changes vanish when load from DB. The recommended approach with Canvas is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on() event listener method Most operations can be...
Read full answer below ↓Question
@artf
Here is my code , I am adding test in a div on select change
init() {
this.listenTo(this, "change:noOfLinks", this.getInfoLinks);
},
getInfoLinks() {
let canvasDoc = editor.Canvas.getDocument();
canvasDoc.getElementById("infoLinks").innerHTML = " test text ";
editor.trigger("change:selectedComponent");
editor.TraitManager.getTraitsViewer().render();
},
You can see script is working fine and "test text" is displaying

When I press save button. It saves in DB and when I refresh editor, it loads data but the changes "test text" is not there

Please help what I am missing in the code. ThanksAnswers (1)
Thanks for reporting this, @codingmachine16.
Great question about Question: Dynamic Changes vanish when load from DB. The recommended approach with Canvas is to use the event-driven API.
Start here:
- Check the GrapesJS documentation for your specific module
- Look for the
on()event listener method - Most operations can be achieved by listening to editor and component events
Common patterns:
// Listen for changes
editor.on('change', () => console.log('something changed'));
// Component lifecycle
editor.on('component:mount', (c) => console.log('component ready', c));
editor.on('component:update', (c) => console.log('component updated', c));
If you're still stuck:
- Share a minimal CodeSandbox reproduction
- Include what you've already tried
- Mention your GrapesJS version
- The community is here to help!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3806
Target :null when adding video
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? chrome new version Reproducible demo link...
Issue #3655
The form button name changes are not getting captured in generated html code
Version: Version 0.17.19(grapesjs) Version 0.1.11(grapesjs-preset-webpage) Are you able to reproduce the bug from the demo?[ ] No What is t...
Issue #3342
jQuery not working for script in component
Hi! I have tried adding jquery in canvas as well as in index.html I am adding it in canvas like this- canvas = editor.Canvas; const script1...
Issue #3329
How should I receive custom trait modifications in the script?
Hi, @artf, this is a great framework, thank you very much. I am now using it to create components of the mobile BUI framework, and I ran in...
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 →Related tutorials
In-depth guides on the same topic.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
Embed GrapesJS in Your SaaS: A Weekend Guide
Embed GrapesJS in your SaaS and ship a white-label page builder over a weekend. Honest tradeoffs, real code, and the plugins that close the UX gap.
Tutorial
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins — TinyMCE Inline Text Editor and Placeholder.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.