[FIX] web_editor: disable embedded video for html fields in backend
TLDR: the videos doesn't work anyway, but nobody noticed it for years; at the same time there is no easy way to fix it STEPS: * create a record with html field, e.g. project.task * add an embedded video (File/Image icon) * save BEFORE: video doesn't work AFTER: there is no option to add embedded video anymore WHY: * iframe tags are removed before storing html in database, so after saving a record, embedded video doesn't work anymore * possible fixes look too tricky for stable branches: * new field attribute sanitize_iframe=False -- requires changes in core python framework which may have side effect * adding iframe on client side -- the problem is that the backend doesn't have mechanism to use animation in html fields like it's done in website: https://github.com/odoo/odoo/blob/ced500e9bcbb5c84033463689d135ad4c7dc4f39/addons/website/static/src/js/content/snippets.animation.js#L623-L632 * adding iframe on server side -- parsing html fields in _read... Doesn't look good either * double selector is required to make it work both in frontend and backend: $editable.closest('.o_editable, .note-editor') * we don't need hardcoded exception for mailing.mailing, mail.compose.message because those fields marked as sanitized (default value) https://github.com/odoo/odoo/blob/c92f058571b0656451f24e24154dd1bdb3bdb48a/odoo/fields.py#L1589-L1590 https://github.com/odoo/odoo/blob/c92f058571b0656451f24e24154dd1bdb3bdb48a/addons/mail/wizard/mail_compose_message.py#L115 https://github.com/odoo/odoo/blob/61734cdaf1cf6857125b1ece63928ab080359c6c/addons/mass_mailing/models/mailing.py#L77 * I don't apply this for Odoo 12, because js is refactored in Odoo 13 (e.g. field_html.js has another name in Odoo 12) --- opw-2353103 closes odoo/odoo#60418 Signed-off-by:Nicolas Lempereur (nle) <nle@odoo.com>
Loading
Please register or sign in to comment