[FIX] web_editor: firefox RTEWidget if hidden
It seems that firefox has some difference of behavior from other browsers as said in: - https://bugzilla.mozilla.org/show_bug.cgi?id=548397 - https://github.com/whatwg/html/issues/1813 - https://github.com/w3c/csswg-drafts/issues/571 It seems that at least in one instance (a html field hidden on the pos configuration), firefox fails because of something similar: window.getComputedStyle(element) returns `null` instead of the element styles. In my tests, using the parent window (possible if current frame and parent have the same origin which should be the case) worked in this instance, this is examplified by this jsfiddle: https://jsfiddle.net/Lpv898ve/2/ This work with window.parent and not using window directly. So this commit adds fallback on doing getComputedStyle from the parent window (when testing on chromium this gave exactly the same result that before). opw-813363 fixes #22211 closes #22610
This commit is contained in:
@@ -281,8 +281,10 @@ var RTEWidget = Widget.extend({
|
||||
.each(function () {
|
||||
var $node = $(this);
|
||||
|
||||
// fallback for firefox iframe display:none see https://github.com/odoo/odoo/pull/22610
|
||||
var computedStyles = window.getComputedStyle(this) || window.parent.getComputedStyle(this);
|
||||
// add class to display inline-block for empty t-field
|
||||
if (window.getComputedStyle(this).display === 'inline' && $node.data('oe-type') !== 'image') {
|
||||
if (computedStyles.display === 'inline' && $node.data('oe-type') !== 'image') {
|
||||
$node.addClass('o_is_inline_editable');
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user