[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) <nle@odoo.com>
This commit is contained in:
Nicolas Lempereur
2019-04-08 08:17:57 +00:00
parent 610ab82b51
commit e1b1d3cd1b
@@ -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');