From 695d7f2fa93aaea4b98a2139157922956699fd8b Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 5 Aug 2024 13:54:03 -0400 Subject: [PATCH] Revert 18e9e4984, only ask to close window if user has changed something (closes #1507) --- modules/core/EditSystem.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/core/EditSystem.js b/modules/core/EditSystem.js index 7e556a09b5..609b5d3cc9 100644 --- a/modules/core/EditSystem.js +++ b/modules/core/EditSystem.js @@ -135,9 +135,11 @@ export class EditSystem extends AbstractSystem { // Setup event handlers window.addEventListener('beforeunload', e => { - e.preventDefault(); - this.saveBackup(); - return (e.returnValue = ''); // show browser prompt + if (this._history.length > 1) { // user did something + e.preventDefault(); + this.saveBackup(); + return (e.returnValue = ''); // show browser prompt + } }); window.addEventListener('unload', () => this._mutex.unlock());