Fix egw.json() calls from a popup could cause JS files to be loaded into the main window instead of the popup

This commit is contained in:
nathan 2025-01-27 16:07:27 -07:00 committed by ralf
parent bd84b18b7e
commit 770b1d79fd
2 changed files with 13 additions and 2 deletions

View File

@ -506,4 +506,14 @@ window.egw_rejoin = function ()
}, 5000);
});
}.bind(window), 500);
}
/**
* Allow egw.json to load JS into popups
*
* @param url
* @returns {Promise<*>}
*/
window.egw_import = function (url)
{
return import(url);
}

View File

@ -346,8 +346,9 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
if(js_files.length > 0)
{
var start_time = (new Date).getTime();
// for some reason using this.includeJS() does NOT work / app.classes does not get set, before the Promise resolves
Promise.all(js_files.map((file) => import(file))).then(() => {
// Need to use this.egw.window.egw_import() to make sure file is loaded in correct window
Promise.all(js_files.map((file) => this.egw.window.egw_import(file))).then(() =>
{
var end_time = (new Date).getTime();
this.handleResponse(data);
if (egw.preference('show_generation_time', 'common', false) == "1")