[FIX] website: fix traceback when saving anchor with unchanged name

Since commit [1], anchor dialog is now in OWL. During adaptation, a line
of code was forgotten which lead to a traceback when an anchor is saved
with an unchanged name.

Steps to reproduce:

- Drop a Text-Image snippet and set an anchor on it.
- On the anchor notification, click on "Edit"
- In the dialog, do not modify the anchor name (or change it but then
  set the original one again)
- Click on "Save & Copy"
=> Traceback

[1]: https://github.com/odoo/odoo/commit/57ed8bc0bf9d1ae2b7542d677a4d7e8fd1899ea2

task-3576975

closes odoo/odoo#141936

Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
This commit is contained in:
Arthur Detroux (ard)
2023-11-20 04:58:28 +00:00
parent e820187381
commit 458c26d307
@@ -2749,8 +2749,7 @@ options.registry.anchor = options.Class.extend({
if (this.$target[0].id === anchorName) {
// If the chosen anchor name is already the one used by the
// element, close the dialog and do nothing else
this.close();
return;
return true;
}
const alreadyExists = !!this.ownerDocument.getElementById(anchorName);