[FIX] website: allow edit mode when a wrong iframe is in the page
Before [this other commit], it was possible to add a wrong video on a page of its website. If the user did this and saved the page, it was no longer possible for him to enter edit mode. To solve this, two improvements have been made: 1. We now prevent the user from putting a wrong video on his page when he goes through the media dialog (see [this other commit]). 2. Since there are probably websites that have a bad video (it was possible before [this other commit]), this commit allows users to edit the pages that have these wrong videos. Steps to reproduce before [this other commit]: - Edit a page. - Via the media dialog add a video with the following URL: 'google.com'. - Save the page. => It is no longer possible to enter edit mode. Note that part 1 was merged from 14.0 but part 2 was merged from 16.0 because the media dialog adds `iframe` without `src` attribute since [the refactor of the media dialog] and we cannot edit a page containing this code `<div class="media_iframe_video"><iframe/></div>` since the merge of the frontend into the backend. [this other commit]: https://github.com/odoo/odoo/commit/fbab1bffa033638553750d49fcde89a9a2fc5e6c [the refactor of the media dialog]: https://github.com/odoo/odoo/commit/7fd0698cf765a79959566b51e33cb76bff83d344 opw-3167707 closes odoo/odoo#116128 X-original-commit: 242d6f2e1dc35c3d22314a4c92c2420f69eb9970 Signed-off-by: Romain Derie (rde) <rde@odoo.com> Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Signed-off-by: Guillaume-gdi <gdi@odoo.com>
This commit is contained in:
@@ -686,7 +686,10 @@ registry.mediaVideo = publicWidget.Widget.extend(MobileYoutubeAutoplayMixin, {
|
||||
iframeEl = this._generateIframe();
|
||||
}
|
||||
|
||||
if (!iframeEl) {
|
||||
// We don't want to cause an error that would prevent entering edit mode
|
||||
// if there is an iframe that doesn't have a src (this was possible for
|
||||
// a while with the media dialog).
|
||||
if (!iframeEl || !iframeEl.getAttribute('src')) {
|
||||
// Something went wrong: no iframe is present in the DOM and the
|
||||
// widget was unable to create one on the fly.
|
||||
return Promise.all(proms);
|
||||
|
||||
Reference in New Issue
Block a user