diff --git a/api/js/jsapi/egw.js b/api/js/jsapi/egw.js index fad96f42b8..818d0c9e8b 100644 --- a/api/js/jsapi/egw.js +++ b/api/js/jsapi/egw.js @@ -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); } \ No newline at end of file diff --git a/api/js/jsapi/egw_json.js b/api/js/jsapi/egw_json.js index 2e0d2ec7f8..95feec4986 100644 --- a/api/js/jsapi/egw_json.js +++ b/api/js/jsapi/egw_json.js @@ -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")