[FIX] website: restore mega menu item edition (deletion)

This basically reverts [1].

After discussion with the related team, [1]'s purpose was to prevent
merging two links together if backspace was hit at the beginning of one
mega menu item. [1] however made mega menu creation impossible as it
prevented removing any mega menu item (well, you had one possibility if
you used Chrome which was to unlink the mega menu item and then remove
it via backspace but...).

After some more discussion, we decided that allowing to merge mega menu
items seems not bad (it is the same behavior as the rest of the editor
when two links are next to each other). In any case, being able to
remove default mega menu items is more important.

[1]: https://github.com/odoo/odoo/commit/9779145d9157e9687c36d2caa0ecea2862a2ac5a

opw-3109946
opw-3120070

closes odoo/odoo#109804

X-original-commit: 7de359470fb4d8eb81f018262a5e4c66a71c7043
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
qsm-odoo
2023-01-13 17:32:47 +01:00
parent 8afa4228e2
commit bc1a1edfef
2 changed files with 15 additions and 2 deletions
@@ -377,8 +377,8 @@ export class WysiwygAdapterComponent extends ComponentAdapter {
_getReadOnlyAreas() {
return [];
}
_getUnremovableElements () {
return this.$editable[0].querySelectorAll("#top_menu a:not(.oe_unremovable)");
_getUnremovableElements() {
return [];
}
/**
* This method provides support for the legacy event system.
@@ -52,6 +52,19 @@ wTourUtils.registerWebsitePreviewTour('edit_megamenu', {
// Edit a menu item
wTourUtils.clickOnExtraMenuItem({extra_trigger: '#oe_snippets.o_loaded'}, true),
toggleMegaMenu({extra_trigger: 'iframe #top_menu .nav-item a.o_mega_menu_toggle:contains("Megaaaaa!")'}),
{
content: "Select the last menu link of the first column",
trigger: 'iframe .s_mega_menu_odoo_menu .row > div:first-child .nav > :nth-child(6)', // 6th is the last one
},
{
content: "Hit the delete button to remove the menu link",
trigger: 'iframe .oe_overlay .oe_snippet_remove',
},
{
content: "Check that the last menu link was deleted",
trigger: 'iframe .s_mega_menu_odoo_menu .row > div:first-child .nav:not(:has(> :nth-child(6)))',
run: () => null,
},
{
content: "Clicks on the first title item.",
trigger: 'iframe .o_mega_menu h4',