diff --git a/addons/web_editor/models/ir_ui_view.py b/addons/web_editor/models/ir_ui_view.py index 3568123a31f..8b69d6e02ec 100644 --- a/addons/web_editor/models/ir_ui_view.py +++ b/addons/web_editor/models/ir_ui_view.py @@ -117,6 +117,10 @@ class IrUiView(models.Model): return False return all(self._are_archs_equal(arch1, arch2) for arch1, arch2 in zip(arch1, arch2)) + @api.model + def _get_allowed_root_attrs(self): + return ['style', 'class'] + def replace_arch_section(self, section_xpath, replacement, replace_tail=False): # the root of the arch section shouldn't actually be replaced as it's # not really editable itself, only the content truly is editable. @@ -132,7 +136,7 @@ class IrUiView(models.Model): root.text = replacement.text # We need to replace some attrib for styles changes on the root element - for attribute in ('style', 'class'): + for attribute in self._get_allowed_root_attrs(): if attribute in replacement.attrib: root.attrib[attribute] = replacement.attrib[attribute] diff --git a/addons/website/models/ir_ui_view.py b/addons/website/models/ir_ui_view.py index 54b26d2cd57..4e803e30ff7 100644 --- a/addons/website/models/ir_ui_view.py +++ b/addons/website/models/ir_ui_view.py @@ -484,6 +484,14 @@ class View(models.Model): self = website_specific_view super(View, self).save(value, xpath=xpath) + @api.model + def _get_allowed_root_attrs(self): + # Related to these options: + # background-video, background-shapes, parallax + return super()._get_allowed_root_attrs() + [ + 'data-bg-video-src', 'data-shape', 'data-scroll-background-ratio', + ] + # -------------------------------------------------------------------------- # Snippet saving # --------------------------------------------------------------------------