[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) <dmo@odoo.com>
This commit is contained in:
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user