Post

5 followers Follow
0
Avatar

Detect if unsaved work is present

Hi,

 

I'm using the Bee plugin email editor in the context of an Angular app. I would like to know if there is a way that I can query the editor API to see if the user has unsaved changes. Currently the editor offers an option to prompt the user when trying to close/leave the page if there are unsaved changes, however I want to extend this functionality to also show the same prompt if the user tries to go to another page within the angular app.

 

Is this possible?

 

Thanks,

Daniel

Daniel Bonnell

Please sign in to leave a comment.

7 comments

0
Avatar

Hi Daniel, let us check with some more technical colleagues and get back to you.

Massimo Arrigoni 0 votes
0
Avatar

Hi Daniel, I checked with the dev team and they reported that there is no way to check if a user has unsaved work natively in the plugin because the plugin is "state less".

In BEE Pro, for example, we use a combination of local storage information and autosave to determine if a user has any unsaved work.

Massimo Arrigoni 0 votes
0
Avatar

Hi Massimo,

I wonder then how does the plugin prompt you when you have unsaved changes and try to close the page or navigate away? There is a configuration option to prompt a user if they are about to loose unsaved work when they try to close the browser or navigate to a different page. Is it possible to extend that functionality somehow, or as part of a future release, so that it can be accessed via the plugin's API?

Thanks!

Daniel Bonnell 0 votes
0
Avatar

Hi Daniel, the preventClose parameter may help you when your users click on the browsers back button or alike (something completely out of your control).

In BEE Pro, and in case the user uses your application nav to close editing, it's not the plugin but the BEE Pro application what check changes and trigger an alert with this workflow:

1. When the user decides to abandon editing, the app asks the plugin for the JSON (saveAsTemplate)
2. The application makes a diff between the given JSON and the starting JSON
3. The application triggers (or not) a confirm dialog

A limit to give a general approach within the preventClose parameter is that the plugin can trigger the dialog on Window events, like browsing away, but not with application events.

Hope this helps.

 

Guillermo Padilla 0 votes
0
Avatar

Hi Guille,

 

Thanks for the detailed explanation. Definitely something to consider for a future release if possible. 

 

Thanks!

Daniel Bonnell 0 votes
0
Avatar

Hi,

Are there any developments for this post? i'm interrested

Thanks,

Souhir

souhir feki 0 votes