From f3f7bd9f240bc21dffadd784cdf77203b1a5148c Mon Sep 17 00:00:00 2001
From: Christophe Matthieu <chm@odoo.com>
Date: Tue, 8 Dec 2015 17:36:53 +0100
Subject: [PATCH] [FIX] web_editor: help the user to edit the link

User can't edit the first and last chars of a link (same issue for a lot of editors), and users don't want to click on edit link button in the editor bar.
When the user click (not if the user use arrow) on a link the link is activate with a content editable true and can edit the first and last chars.

opw: 654280
---
 addons/web_editor/static/src/js/rte.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/addons/web_editor/static/src/js/rte.js b/addons/web_editor/static/src/js/rte.js
index c107ca342aee..f50b93912aea 100644
--- a/addons/web_editor/static/src/js/rte.js
+++ b/addons/web_editor/static/src/js/rte.js
@@ -508,6 +508,16 @@ var RTE = Widget.extend({
         var $target = $(event.target);
         var $editable = $target.closest('.o_editable');
 
+        if ($target.is('a')) {
+            $target.attr('contenteditable', true);
+            setTimeout(function () {
+                $editable.attr('contenteditable', false);
+            });
+        } else if ($editable.attr('contenteditable') === 'false') {
+            $target.removeAttr('contenteditable');
+            $editable.attr('contenteditable', true);
+        }
+
         if (!$editable.size()) {
             return;
         }
-- 
GitLab