[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.
note: backport of 11.0's 7a453b0b7a
In 10.0 this trigger could cause a "blur" which in some instance is not
wanted (eg. inside a newline of a list view).
opw-1906581
closes #31078
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
@@ -57,7 +57,8 @@ var FieldTextHtmlSimple = widget.extend({
|
||||
this.$translate.remove();
|
||||
this.$translate = $();
|
||||
// Triggers a mouseup to refresh the editor toolbar
|
||||
this.$content.trigger('mouseup');
|
||||
var mouseupEvent = $.Event('mouseup', {'setStyleInfoFromEditable': true});
|
||||
this.$content.trigger(mouseupEvent);
|
||||
return def;
|
||||
},
|
||||
initialize_content: function () {
|
||||
|
||||
Reference in New Issue
Block a user