From da14e4449e5e318eb72e1b9f268fb797adb0c6a6 Mon Sep 17 00:00:00 2001
From: "Andrea Grazioso (agr-odoo)" <agr@odoo.com>
Date: Fri, 12 Feb 2021 14:26:31 +0000
Subject: [PATCH] [FIX] web_editor: prevent crash on link edit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Go to Website
Go to conatct us form
Switch in Edit mode
Click on “send” (or "submit")
click on edit link

A js traceback will apper. This occur because we refocus an elements
which may not be the correct one. In this case $editable will contain
all the contact form instead of just the relevant div of the submit
button

opw-2439090

closes odoo/odoo#66081

Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
---
 .../web_editor/static/lib/summernote/src/js/module/Editor.js  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/addons/web_editor/static/lib/summernote/src/js/module/Editor.js b/addons/web_editor/static/lib/summernote/src/js/module/Editor.js
index 0b63f315cf97..df80f6c9e38b 100644
--- a/addons/web_editor/static/lib/summernote/src/js/module/Editor.js
+++ b/addons/web_editor/static/lib/summernote/src/js/module/Editor.js
@@ -680,7 +680,9 @@ define([
      * @return {String} [return.url=""]
      */
     this.getLinkInfo = function ($editable) {
-      this.focus($editable);
+      // ODOO: modification
+      // this.focus($editable);
+      this.focus($editable.closest(':not(form)'));
 
       var rng = range.create().expand(dom.isAnchor);
 
-- 
GitLab