[FIX] website: prevent dropping generated ToC outside its snippet
In the table of content snippet, both its generated entries and its content wrapper can be dropped outside of it. This cannot be allowed because the entries are generated from the wrapped content that belongs to the same table of content snippet. If any of them is missing, the feature is broken. This commit prevents this by hiding the drag handle from the generated table of content and from the content wrapper. Note that they can still be moved using the arrows. task-2752391 closes odoo/odoo#107510 Signed-off-by: Bojabza Soukéina (sobo) <sobo@odoo.com>
This commit is contained in:
@@ -3633,7 +3633,26 @@ options.registry.sizing.include({
|
||||
$body.on('mouseup', documentMouseUp);
|
||||
});
|
||||
return defs;
|
||||
}
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Public
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
async updateUIVisibility() {
|
||||
await this._super(...arguments);
|
||||
const nonDraggableClasses = [
|
||||
's_table_of_content_navbar_wrap',
|
||||
's_table_of_content_main',
|
||||
];
|
||||
if (nonDraggableClasses.some(c => this.$target[0].classList.contains(c))) {
|
||||
const moveHandleEl = this.$overlay[0].querySelector('.o_move_handle');
|
||||
moveHandleEl.classList.add('d-none');
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
options.registry.SwitchableViews = options.Class.extend({
|
||||
|
||||
Reference in New Issue
Block a user