From e8da7caa64ea9d8dea6c9810dcd37a5515e69b7c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 7 Jul 2021 10:32:06 +0200 Subject: [PATCH] fix after rollup build popups need extra reload caused by no longer necessary import of etemplate2 in egw.js, as Promise works and etemplate2 is global --- api/js/jsapi/egw.js | 24 +++++++++++------------- rollup.config.js | 3 +-- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/api/js/jsapi/egw.js b/api/js/jsapi/egw.js index 23c36a4778..82bbbf9900 100644 --- a/api/js/jsapi/egw.js +++ b/api/js/jsapi/egw.js @@ -372,19 +372,17 @@ window.app = {classes: {}}; // load etemplate2 template(s) jQuery('form.et2_container[data-etemplate]').each( function(index, node) { - import('../etemplate/etemplate2').then((module) => { - const data = JSON.parse(node.getAttribute('data-etemplate')) || {}; - if (popup || window.opener && !egwIsMobile()) { - // Resize popup when et2 load is done - jQuery(node).on('load', () => window.setTimeout(resize_popup, 50)); - } - const et2 = new module.etemplate2(node, "EGroupware\\Api\\Etemplate::ajax_process_content"); - et2.load(data.name, data.url, data.data); - if (typeof data.response !== 'undefined') { - const json_request = egw(window).json(""); - json_request.handleResponse({response: data.response}); - } - }).catch((e) => alert(e.message+"\n\n"+e.stack)); + const data = JSON.parse(node.getAttribute('data-etemplate')) || {}; + if (popup || window.opener && !egwIsMobile()) { + // Resize popup when et2 load is done + jQuery(node).on('load', () => window.setTimeout(resize_popup, 50)); + } + const et2 = new etemplate2(node, "EGroupware\\Api\\Etemplate::ajax_process_content"); + et2.load(data.name, data.url, data.data); + if (typeof data.response !== 'undefined') { + const json_request = egw(window).json(""); + json_request.handleResponse({response: data.response}); + } }); // Offline/Online checking part diff --git a/rollup.config.js b/rollup.config.js index 1a2c217ad3..b4b0a44aba 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -21,7 +21,7 @@ import { readdir,stat } from 'fs/promises'; rimraf.sync('./chunks/'); // Turn on minification -const do_minify = false; +const do_minify = true; const config = { treeshake: false, @@ -30,7 +30,6 @@ const config = { // Note the .ts extension on the input - we build directly from the TypeScript when available "pixelegg/js/fw_pixelegg.min": "pixelegg/js/fw_pixelegg.js", "pixelegg/js/fw_mobile.min": "pixelegg/js/fw_mobile.js", - "api/js/etemplate/etemplate2.min":"api/js/etemplate/etemplate2.ts", "api/js/egw_action/egw_dragdrop_dhtmlx_tree.min":"api/js/egw_action/egw_dragdrop_dhtmlx_tree.js", "api/js/jsapi/egw.min": "api/js/jsapi/egw_modules.js",