[IMP] web_editor, website, website_sale: hide block in desktop display

Since [1] it is possible to request that some blocks are not displayed
on mobile devices.
This commit adds a similar option to prevent blocks from being displayed
on desktops (i.e. on non-mobile devices).

[1]: https://github.com/odoo/odoo/commit/9463f0f889f9dd8da6077895c125da4998a933c0

task-2900730

closes odoo/odoo#101483

X-original-commit: 3103e0553011b5c1f4078972d7a88fa3fd4068b2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Antoine (anso) <anso@odoo.com>
This commit is contained in:
Benoit Socias
2022-09-28 19:31:39 +02:00
committed by qsm-odoo
co-authored by Antoine
parent c6fa784c43
commit 1139ad7aff
9 changed files with 149 additions and 48 deletions
@@ -674,6 +674,17 @@ export class WysiwygAdapterComponent extends ComponentAdapter {
_onContextGet(event) {
return event.data.callback(this._context);
}
/**
* Retrieves the website service context.
*
* @private
* @param {OdooEvent} ev
*/
_onServiceContextGet(ev) {
ev.data.callback({
isMobile: this.websiteService.context.isMobile,
});
}
/**
* Discards changes and reload the iframe.
*
@@ -841,6 +852,7 @@ WysiwygAdapterComponent.prototype.events = {
'gmap_api_key_request': '_onRootEventRequest',
'request_save': '_onSaveRequest',
'context_get': '_onContextGet',
'service_context_get': '_onServiceContextGet',
'action_demand': '_handleAction',
'request_cancel': '_onCancelRequest',
'snippet_will_be_cloned': '_onSnippetWillBeCloned',