[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
This commit is contained in:
Younn Olivier
2022-07-08 19:52:09 +02:00
committed by qsm-odoo
parent 11429329b8
commit 30a03a07df
@@ -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