summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/lib/summernote
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2018-08-24 17:12:22 +0200
committerNicolas Lempereur <nle@odoo.com>2018-09-03 16:51:20 +0200
commit7a453b0b7aea59e7f091daa65a69636de2a34d3b (patch)
treeeb97961cfa24a427425bf432f60d13f2efc9ab3d /addons/web_editor/static/lib/summernote
parentaf27196fc52122edc1607772bf7f3ba82e039b26 (diff)
[FIX] web_editor: focus lost with inline editor
When an inline editor is eg. in a form view, the focus is always stolen by it. This is because we trigger a mouseup on the editor to update its toolbars values and informations. In 10.0 this was not necessary since the default values were sanely set when the editor was inside the DOM. In 11.0 the editor is not in the DOM when this is being done and the info was wrong (eg. NaN for text size). With this commit, we don't steal the focus and get the default like it was done in 10.0 instead. fixes #26366 opw-1874880 closes #26582
Diffstat (limited to 'addons/web_editor/static/lib/summernote')
-rw-r--r--addons/web_editor/static/lib/summernote/src/js/EventHandler.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/addons/web_editor/static/lib/summernote/src/js/EventHandler.js b/addons/web_editor/static/lib/summernote/src/js/EventHandler.js
index efa57f8111c..578bcfd7a0c 100644
--- a/addons/web_editor/static/lib/summernote/src/js/EventHandler.js
+++ b/addons/web_editor/static/lib/summernote/src/js/EventHandler.js
@@ -207,11 +207,15 @@ define([
var layoutInfo = dom.makeLayoutInfo(target);
/* ODOO: (start_modification */
var $editable = layoutInfo.editable();
- if (!event.isDefaultPrevented()) {
- modules.editor.saveRange($editable);
+ if (event.setStyleInfoFromEditable) {
+ var styleInfo = modules.editor.styleFromNode($editable);
+ } else {
+ if (!event.isDefaultPrevented()) {
+ modules.editor.saveRange($editable);
+ }
+ var styleInfo = modules.editor.currentStyle(target);
}
/* ODOO: end_modification) */
- var styleInfo = modules.editor.currentStyle(target);
self.updateStyleInfo(styleInfo, layoutInfo);
}, 0);
};