From 30a03a07df886bc7a49d9e258f71494b9d6cd96d Mon Sep 17 00:00:00 2001 From: Younn Olivier Date: Mon, 4 Jul 2022 09:13:32 +0000 Subject: [PATCH] [FIX] website: better redirection from a fullscreen slide to edit mode Before this commit, clicking on the edit button of a slide viewed in fullscreen mode would instantiate the wysiwyg, remove it, exit the fullscreen mode et re-instantiate the wysiwyg. To prevent that, the editor component never starts with the wysiwyg shown by default when mounted. Before that, it checks if it should redirect somewhere in the publicRootReady method (if not, it shows the wysiwyg). Follows the merge of the "website in backend" task at [1]. [1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b task-2687506 Part-of: odoo/odoo#81485 --- addons/website/static/src/components/editor/editor.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/website/static/src/components/editor/editor.js b/addons/website/static/src/components/editor/editor.js index 8dba7fe64f8..9ff4c8d1bc1 100644 --- a/addons/website/static/src/components/editor/editor.js +++ b/addons/website/static/src/components/editor/editor.js @@ -4,7 +4,7 @@ import legacyEnv from 'web.commonEnv'; import { useService } from '@web/core/utils/hooks'; import { WysiwygAdapterComponent } from '../wysiwyg_adapter/wysiwyg_adapter'; -const { markup, Component, useState, useChildSubEnv, useEffect, onWillStart } = owl; +const { markup, Component, useState, useChildSubEnv, useEffect, onWillStart, onMounted } = owl; export class WebsiteEditorComponent extends Component { /** @@ -17,7 +17,7 @@ export class WebsiteEditorComponent extends Component { this.websiteContext = useState(this.websiteService.context); this.state = useState({ reloading: false, - showWysiwyg: this.websiteContext.isPublicRootReady, + showWysiwyg: false, }); this.wysiwygOptions = {}; @@ -33,6 +33,12 @@ export class WebsiteEditorComponent extends Component { this.publicRootReady(); } }, () => [this.websiteContext.isPublicRootReady]); + + onMounted(() => { + if (this.websiteContext.isPublicRootReady) { + this.publicRootReady(); + } + }); } /** * Starts the wysiwyg or disable edition if currently