Issue #441💬 AnsweredOpened October 20, 2017by santiph0 reactions

Ignore/avoid changeCount

Quick answerby artf

Hi @santiph well, if the problem is onbeforeunload you can disable it with noticeOnUnload

Read full answer below ↓

Question

Due to https://github.com/artf/grapesjs/issues/436, I cannot rely on StorageManager's Remote Load method to load a template from a REST endpoint, so I'm falling back to alternatives as editor.setComponents() and editor.setStyle() (being used within a command, so grapesjs and editor are available). Unfortunately, those methods make changesCount to increase and triggers onbeforeunload event when our users try to leave the webpage. Also, including sentences like editor.editor.set('changesCount', 0); in the command are useless, since changesCount gets incremented as soon as the command finishes (...

Answers (3)

artfOctober 23, 2017

Hi @santiph well, if the problem is onbeforeunload you can disable it with noticeOnUnload

grapesjs.init({
     ...
     noticeOnUnload: false
})
santiphOctober 23, 2017

Hi @artf I need to warn the user know of any unsaved changes consistently. And skip it when there's nothing new to be saved: When a new empty template is created, right after saving or right after loading a template, no confirmation message should be displayed. Saving scenario through StorageManage...

santiphOctober 24, 2017

I could test it with remote storage fully: onbeforeunload is disabled, as expected, on closing right after saving. Unfortunately, it's still being displayed on closing right after loading a new template. After a little debugging, loading a new template seems to increase changesCount to 1. (Load cha...

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.