[IMP] web_editor: update UI when clicking on mobile preview
Now trigger an UI update for all the options when clicking on the mobile preview button. This is at least important for the next commit in this PR to update the visibility of the different overlay elements as some will be shown in desktop and some other on mobile. task-2825241 Part-of: odoo/odoo#93144 Co-authored-by: qsm-odoo <qsm@odoo.com>
This commit is contained in:
committed by
qsm-odoo
co-authored by
qsm-odoo
parent
815d1f775c
commit
ca215a5bdf
@@ -3526,8 +3526,24 @@ var SnippetsMenu = Widget.extend({
|
||||
/**
|
||||
* Preview on mobile.
|
||||
*/
|
||||
_onMobilePreviewClick: function () {
|
||||
_onMobilePreviewClick() {
|
||||
this.trigger_up('request_mobile_preview');
|
||||
|
||||
// TODO refactor things to make this more understandable -> on mobile
|
||||
// edition, update the UI. But to do it properly and inside the mutex
|
||||
// this simulates what happens when a snippet option is used.
|
||||
this._execWithLoadingEffect(async () => {
|
||||
// TODO needed so that mobile edition is considered before updating
|
||||
// the UI but this is clearly random. The trigger_up above should
|
||||
// properly await for the rerender somehow.
|
||||
await new Promise(resolve => setTimeout(resolve));
|
||||
|
||||
return new Promise(resolve => {
|
||||
this.trigger_up('snippet_option_update', {
|
||||
onSuccess: () => resolve(),
|
||||
});
|
||||
});
|
||||
}, false);
|
||||
},
|
||||
/**
|
||||
* Undo..
|
||||
|
||||
Reference in New Issue
Block a user