[IMP] web_editor: allow the onBuilt method to be async
This became more and more needed. Of course, it should be avoided most of the time as you do not want to rely on async operations to build the initial rendering of a snippet (best to do server side during the rendering of the editor panel). This can however make sense and it is needed as a fix for the social media snippet (see next commit). task-2739937 X-original-commit: 3fb1718ce494ccf48959e6e4fe9f640621c4a3a9 Part-of: odoo/odoo#87933
This commit is contained in:
@@ -296,7 +296,7 @@ var SnippetEditor = Widget.extend({
|
||||
*/
|
||||
buildSnippet: async function () {
|
||||
for (var i in this.styles) {
|
||||
this.styles[i].onBuilt();
|
||||
await this.styles[i].onBuilt();
|
||||
}
|
||||
await this.toggleTargetVisibility(true);
|
||||
},
|
||||
|
||||
@@ -2999,8 +2999,9 @@ const SnippetOptionWidget = Widget.extend({
|
||||
* menu. Note: this is called after the start and onFocus methods.
|
||||
*
|
||||
* @abstract
|
||||
* @returns {Promise|undefined}
|
||||
*/
|
||||
onBuilt: function () {},
|
||||
async onBuilt() {},
|
||||
/**
|
||||
* Called when the parent edition overlay is removed from the associated
|
||||
* snippet (another snippet enters edition for example).
|
||||
|
||||
Reference in New Issue
Block a user