From 0ffc12c0a429072d20e1b31f827c8e6b92a21f6d Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Mon, 21 Jun 2021 14:39:18 +0000 Subject: [PATCH] [REF] web_editor: loader split the loading and the creation of wysiwyg Before this commit, the wysiwyg loader had only one method to both load and create it. After this commit, it has two separate methods to do it. This is practical if one wants to load in some other context, like studio closes odoo/odoo#72454 Related: odoo/enterprise#19139 Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/src/js/frontend/loader.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/frontend/loader.js b/addons/web_editor/static/src/js/frontend/loader.js index edb60a28f7e..43b745e6c4d 100644 --- a/addons/web_editor/static/src/js/frontend/loader.js +++ b/addons/web_editor/static/src/js/frontend/loader.js @@ -7,6 +7,11 @@ let wysiwygPromise; const exports = {}; +function loadWysiwyg(additionnalAssets=[]) { + return ajax.loadLibs({assetLibs: ['web_editor.compiled_assets_wysiwyg', ...additionnalAssets]}, undefined, '/web_editor/public_render_template'); +} +exports.loadWysiwyg = loadWysiwyg; + /** * Load the assets and create a wysiwyg. * @@ -16,7 +21,7 @@ const exports = {}; exports.createWysiwyg = async (parent, options, additionnalAssets = []) => { if (!wysiwygPromise) { wysiwygPromise = new Promise(async (resolve) => { - await ajax.loadLibs({assetLibs: ['web_editor.compiled_assets_wysiwyg', ...additionnalAssets]}, undefined, '/web_editor/public_render_template'); + await loadWysiwyg(additionnalAssets); // Wait the loading of the service and his dependencies (use string to // avoid parsing of require function). const stringFunction = `return new Promise(resolve => {