lightbox: Use ".append" to append nodes instead of ".html".

This commit is contained in:
afeefuddin 2024-03-23 02:45:59 +05:30 committed by Tim Abbott
parent ce3e609d90
commit 97d372c837
1 changed files with 7 additions and 4 deletions

View File

@ -213,7 +213,7 @@ export function render_lightbox_media_list(preview_source) {
$video.attr("src", src);
$video.attr("controls", false);
$node.html($video);
$node.append($video);
} else {
$node = $("<div>")
.addClass(className)
@ -241,7 +241,8 @@ function display_image(payload) {
const $img_container = $("#lightbox_overlay .image-preview > .zoom-element");
const img = new Image();
img.src = payload.source;
$img_container.html(img).show();
$img_container.empty();
$img_container.append(img).show();
const filename = payload.url?.split("/").pop();
$(".media-description .title")
@ -282,7 +283,8 @@ function display_video(payload) {
const $video = $("<video>");
$video.attr("src", payload.source);
$video.attr("controls", true);
$(".video-player").html($video);
$(".video-player").empty();
$(".video-player").append($video);
$(".media-actions .open").attr("href", payload.source);
const filename = payload.url?.split("/").pop();
@ -322,7 +324,8 @@ function display_video(payload) {
$iframe.attr("frameborder", 0);
$iframe.attr("allowfullscreen", true);
$("#lightbox_overlay .player-container").html($iframe);
$("#lightbox_overlay .player-container").empty();
$("#lightbox_overlay .player-container").append($iframe);
$(".media-actions .open").attr("href", payload.url);
}