Skip to content
Snippets Groups Projects
Commit bd225ec7 authored by qsm-odoo's avatar qsm-odoo
Browse files

[FIX] website: allow to exit fullscreen if not on website anymore

While showcasing your website inside the website application, there is
the possibility to hit the escape key to enter fullscreen (hiding the
backend navbar outside edit mode and the editor panel during edit mode).

There was a problem following this flow:

- Go to your website inside your website app
- Hit escape to enter fullscreen
- Press CTRL-K to switch to another part of the backend
=> You are now somewhere in the backend, without the navbar (fullscreen)
   and you cannot exit it.

As it was a one-line fix (except for the re-indentation), this commit
now allows to exit fullscreen mode wherever we are.

Discovered during task-3082439

Part-of: odoo/odoo#106629
parent 634f6ae4
No related branches found
No related tags found
No related merge requests found
......@@ -57,11 +57,15 @@ export const websiteService = {
hotkey.add("escape", () => {
// Toggle fullscreen mode when pressing escape.
if (currentWebsiteId) {
fullscreen = !fullscreen;
document.body.classList.toggle('o_website_fullscreen', fullscreen);
bus.trigger((fullscreen ? 'FULLSCREEN-INDICATION-SHOW' : 'FULLSCREEN-INDICATION-HIDE'));
if (!currentWebsiteId && !fullscreen) {
// Only allow to use this feature while on the website app, or
// while it is already fullscreen (in case you left the website
// app in fullscreen mode, thanks to CTRL-K).
return;
}
fullscreen = !fullscreen;
document.body.classList.toggle('o_website_fullscreen', fullscreen);
bus.trigger(fullscreen ? 'FULLSCREEN-INDICATION-SHOW' : 'FULLSCREEN-INDICATION-HIDE');
}, { global: true });
registry.category('main_components').add('FullscreenIndication', {
Component: FullscreenIndication,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment