From c17656fa9a2a01f1d7d90dd985bfdc2570c7ac03 Mon Sep 17 00:00:00 2001 From: GhilesHideur <47829666+GhilesHideur@users.noreply.github.com> Date: Fri, 14 Feb 2025 17:57:29 +0100 Subject: [PATCH] fix: avoid save pop-up window #498 --- front-end/source/kernel/base/xdash-main.js | 10 +++++++--- front-end/source/kernel/runtime/xdash-runtime-main.js | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/front-end/source/kernel/base/xdash-main.js b/front-end/source/kernel/base/xdash-main.js index 1bd21201..0fa035af 100644 --- a/front-end/source/kernel/base/xdash-main.js +++ b/front-end/source/kernel/base/xdash-main.js @@ -490,9 +490,13 @@ export const Xdash = function () { } /*--------manage leave/refresh page--------*/ - $(window).bind('beforeunload', async function () { - await saveAndClosePrj(); - }); + (() => { + if (!window.isRuntime) { + $(window).bind('beforeunload', async function () { + await saveAndClosePrj(); + }); + } + })(); //------------------------------------------------------------------------------------------------------------------- diff --git a/front-end/source/kernel/runtime/xdash-runtime-main.js b/front-end/source/kernel/runtime/xdash-runtime-main.js index be79b559..7d442e2e 100644 --- a/front-end/source/kernel/runtime/xdash-runtime-main.js +++ b/front-end/source/kernel/runtime/xdash-runtime-main.js @@ -267,4 +267,6 @@ export async function chalkitLoadDashboard(xprjson, parameters = {}) { deferedLoadStatus.toLoad = { xprjson, parameters }; } } + +window.isRuntime = true; window.chalkitLoadDashboard = chalkitLoadDashboard;