From e1b1d3cd1bf703e175ad188333e868977e34dccd Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 5 Apr 2019 14:34:03 +0000 Subject: [PATCH] [FIX] web_editor: no lose tooltip on selection The editor has a tooltip editor wizard "Change media description and tooltip", but when selecting an image there is also a tooltip: "Double-click to edit" added by the editor. The combination of the two break the functionality, eg: - if a tooltip is set with editor, then selecting the tooltip: we see the set tooltip and not "Double-click to edit" - if a tooltip is set with editor, then selecting the image back, then opening the tooltip editor => the set tooltip is lost With this changeset, we just do not show "Double-click to edit" tooltip if there is a tooltip set on the element. opw-1946801 closes #32482 Signed-off-by: Nicolas Lempereur (nle) --- addons/web_editor/static/src/js/editor/rte.summernote.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/rte.summernote.js b/addons/web_editor/static/src/js/editor/rte.summernote.js index 2b1f516af84..646c3497e7c 100644 --- a/addons/web_editor/static/src/js/editor/rte.summernote.js +++ b/addons/web_editor/static/src/js/editor/rte.summernote.js @@ -881,7 +881,10 @@ eventHandler.attach = function (oLayoutInfo, options) { show_tooltip = true; setTimeout(function () { - if (!show_tooltip) return; + // Do not show tooltip on double-click and if there is already one + if (!show_tooltip || $target.attr('title') !== undefined) { + return; + } $target.tooltip({title: _t('Double-click to edit'), trigger: 'manuel', container: 'body'}).tooltip('show'); setTimeout(function () { $target.tooltip('destroy');