[FIX] web_editor, website: fix menu edtion from the "edit menu" button
Before this commit, editing a menu item after clicking on the "edit menu" button of the link popover, in edit mode, would not save the change. This was caused by the "Double-click to edit" tooltip that is shown over media and links. Triggering the bootstrap tooltip on a target leads to attribute mutations (data-original-title, title and aria-describedby), that were processed by the EditPageMenu observer to set a view as o_dirty. The website.menu was therefore saved a first time by the edit menu dialog with the correct value, and a second time with the outdated label from the page. To solve that, the observer is deactivated when showing the "Double-click to edit" tooltip over a link or a media, so that the website.menu is updated only once, when saving the edit menu dialog. task-2513588 X-original-commit: 4244b60f36acbdbdc17c24d45144604d1276c15f Part-of: odoo/odoo#81351
This commit is contained in:
@@ -1431,7 +1431,9 @@ const Wysiwyg = Widget.extend({
|
||||
if (!this.showTooltip || $target.attr('title') !== undefined) {
|
||||
return;
|
||||
}
|
||||
this.odooEditor.observerUnactive();
|
||||
$target.tooltip({title: _t('Double-click to edit'), trigger: 'manual', container: 'body'}).tooltip('show');
|
||||
this.odooEditor.observerActive();
|
||||
setTimeout(() => $target.tooltip('dispose'), 800);
|
||||
}, 400);
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ tour.register('edit_menus', {
|
||||
clickOnSave,
|
||||
clickOnSave,
|
||||
wTourUtils.clickOnEdit(),
|
||||
// Edit the new menu item from the "edit link" popover button
|
||||
wTourUtils.clickOnExtraMenuItem({extra_trigger: '#oe_snippets.o_loaded'}),
|
||||
{
|
||||
content: "Menu should have a new link item",
|
||||
@@ -99,9 +100,37 @@ tour.register('edit_menus', {
|
||||
run: 'text Modnar',
|
||||
},
|
||||
clickOnSave,
|
||||
...wTourUtils.clickOnSave(),
|
||||
// Edit the menu item from the "edit menu" popover button
|
||||
wTourUtils.clickOnEdit(),
|
||||
wTourUtils.clickOnExtraMenuItem({extra_trigger: '#oe_snippets.o_loaded'}),
|
||||
{
|
||||
content: "Label should have changed",
|
||||
trigger: '#top_menu .nav-item a:contains("Modnar")',
|
||||
},
|
||||
{
|
||||
content: "Click on the popover Edit Menu button",
|
||||
trigger: '.o_edit_menu_popover a.js_edit_menu',
|
||||
},
|
||||
{
|
||||
content: "Click on the dialog Edit Menu button",
|
||||
trigger: '.oe_menu_editor .js_menu_label:contains("Modnar")',
|
||||
run: function () {
|
||||
const liEl = this.$anchor[0].closest('[data-menu-id]');
|
||||
liEl.querySelector('button.js_edit_menu').click();
|
||||
},
|
||||
},
|
||||
{
|
||||
content: "Change the label",
|
||||
trigger: '.o_link_dialog #o_link_dialog_label_input',
|
||||
run: 'text Modnar !!',
|
||||
},
|
||||
clickOnSave,
|
||||
clickOnSave,
|
||||
wTourUtils.clickOnExtraMenuItem({extra_trigger: 'a[data-action=edit]'}),
|
||||
{
|
||||
content: "Label should have changed",
|
||||
trigger: '#top_menu .nav-item a:contains("Modnar !!")',
|
||||
run: () => {}, // It's a check.
|
||||
},
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user