Grapes cannot be reinitiated with new HTML
Looks like I'm not the only one who wants this 😉 . Single page apps are where this has value (the issue I raise but also freeing up some memory). I'll look to raise a PR when I got something.
Read full answer below ↓Question
Calling init() on Grapes after changing HTML fails. This kinda situation happens on one page apps.
I think a destory() function to gracefully reset Grapes is needed.
- https://jsfiddle.net/wdtrg1je/ (very bare bones simulation of a one page app)
- Click "Add Grapes" (loads Grapes with a some HTML)
- Click the "Link", change it's href to
http://yahoo.com - Click "Remove Grapes". This grabs the HTML from Grapes before destorying the grapes element.
- Click "Add Grapes" again. This starts Grapes again with the new HTML which differs from the original HTML.
- Error in console.

If "Add Grapes" and "Remove Grapes" are clicked without any changes to HTML, it's fine.
Answers (3)
Looks like I'm not the only one who wants this 😉 . Single page apps are where this has value (the issue I raise but also freeing up some memory).
I'll look to raise a PR when I got something.
As already mentioned here, currently, I don't see any value in starting such a feature (creating a good destroy method) but would really happy to see some PR :)
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 #986
[BUG]: Exported CSS cannot override body's background-color
When a body background style is defined in the style option of the init function it's not possible to override. Given the style: After chan...
Issue #1614
[Bug]: adding css variables as style manager property
trying to add css variable to style manager causing error: Uncaught TypeError: Cannot read property 'toUpperCase' of undefined fiddle Am i...
Issue #912
[BUG]: HTML attributes/traits not escaped
When double quotes are added to an attribute it breaks the HTML.https://jsfiddle.net/szLp8h4n/Drag in the link block.Click the link in the...
Issue #1032
[BUG] Multiple font-face at-rule CSS rules are not processed
Latest version of grapes #cfde1c1 If you supply a single @font-face, this is parsed just fine: JSFiddle example: https://jsfiddle.net/szLp8...
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.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.