[FIX] web_editor: fix user avatar aspect-ratio

This commit fixes an issue occurring in the `web_editor` when multiple
users edit some content.

Prior to this commit, the user avatar was not using any aspect-ratio
rule, resulting in a stretch avatar if the uploaded image wasn't square.

This commit fixes this issue by adding the `o_object_fit_cover` class to
the image, ensuring a correct ratio no matter the format of the uploaded
image.

task-3877841

closes odoo/odoo#162810

X-original-commit: 7240fa3ff495a8aba7bd53b720e99cd767948342
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Chrysanthe Gomrée (chgo) <chgo@odoo.com>
This commit is contained in:
Chrysanthe (chgo)
2024-04-22 13:39:52 +00:00
parent 1b746c0e2c
commit 83f24391cd
@@ -1954,6 +1954,7 @@ export class OdooEditor extends EventTarget {
avatarElement.append(image);
image.onload = () => avatarElement.style.removeProperty('display');
image.setAttribute('src', clientAvatarUrl);
image.classList.add('o_object_fit_cover');
}
// Avoid re-appending the element in the dom.
if (!avatarElement.parentElement) {