Issue #914✓ SolvedOpened February 28, 2018by nojacko3 reactions

Grapes cannot be reinitiated with new HTML

Quick answerby nojacko3

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.comClick "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" a...

Answers (3)

👍 Most helpfulnojackoMarch 2, 2018

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.

artfMarch 2, 2018

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 :)

lock[bot]September 18, 2019

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.

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 →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.