From e797d7a3c3e5c4a42c8ea31da0fde2c13573038f Mon Sep 17 00:00:00 2001 From: Gorash Date: Wed, 6 Mar 2019 12:33:36 +0000 Subject: [PATCH] [FIX] web_editor: wrong focus detection in the editor Issue detected with tests in the branch that replace deferred by native Promise. Need to add isMedia to detect if the target is already a media when focus the editor. closes odoo/odoo#31632 Signed-off-by: Aaron Bohy (aab) --- addons/web_editor/static/src/js/wysiwyg/plugin/media.js | 2 +- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/media.js b/addons/web_editor/static/src/js/wysiwyg/plugin/media.js index e60cfbe8039..2cdfbe70cfe 100644 --- a/addons/web_editor/static/src/js/wysiwyg/plugin/media.js +++ b/addons/web_editor/static/src/js/wysiwyg/plugin/media.js @@ -86,7 +86,7 @@ var MediaPlugin = AbstractPlugin.extend({ * @param {Node} target */ update: function (target) { - if (!target) { + if (!target || !dom.isMedia(target)) { return; } if (!this.options.displayPopover(target)) { diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 44f7dd2c6a8..3b2a63fa48e 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -610,7 +610,7 @@ var Wysiwyg = Widget.extend({ this._editableHasFocus = true; this._justFocused = true; setTimeout(function () { - self._justFocused = true; + self._justFocused = false; }); }, /**