Skip to content

[FIX] html_builder: double-click to replace video #4594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/html_builder/static/src/core/media_website_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export class MediaWebsitePlugin extends Plugin {
.map((s) => `${s}:not([data-oe-xpath])`)
.join(",");
this.addDomListener(this.editable, "dblclick", (ev) => {
const targetEl = ev.target;
if (!targetEl.matches(mediaSelector)) {
const targetEl = ev.target.closest(mediaSelector);
if (!targetEl) {
return;
}
let isEditable =
Expand Down
21 changes: 21 additions & 0 deletions addons/html_builder/static/tests/videos.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { expect, test } from "@odoo/hoot";
import { animationFrame, dblclick } from "@odoo/hoot-dom";
import { defineWebsiteModels, setupWebsiteBuilder } from "./website_helpers";

defineWebsiteModels();

test("double click on video", async () => {
await setupWebsiteBuilder(`
<div>
<div class="media_iframe_video o_snippet_drop_in_only">
<div class="css_editable_mode_display"></div>
<div class="media_iframe_video_size"></div>
<iframe frameborder="0" allowfullscreen="allowfullscreen" aria-label="Video"></iframe>
</div>
</div>
`);
expect(".modal-content").toHaveCount(0);
await dblclick(":iframe iframe");
await animationFrame();
expect(".modal-content:contains(Select a media) .o_video_dialog_form").toHaveCount(1);
});
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class VideoSelector extends Component {
errorMessages: Function,
vimeoPreviewIds: { type: Array, optional: true },
isForBgVideo: { type: Boolean, optional: true },
media: { type: Object, optional: true },
media: { validate: (p) => p.nodeType === Node.ELEMENT_NODE, optional: true },
"*": true,
};
static defaultProps = {
Expand Down