Remove fixed-height of Gallery preview in Gradio

pull/109/head
Uminosachi 2023-10-01 12:48:10 +09:00
parent 03095102da
commit 3c312bde08
1 changed files with 12 additions and 1 deletions

View File

@ -235,8 +235,19 @@ onUiLoaded(async () => {
function setStyleHeight(elemId, height) {
const elem = gradioApp().querySelector(elemId);
if (elem) {
if (elem.style.height === null || elem.style.height === "") {
if (!elem.style.height) {
elem.style.height = height;
const observer = new MutationObserver(() => {
const divPreview = elem.querySelector(".preview");
if (divPreview) {
divPreview.classList.remove("fixed-height");
}
});
observer.observe(elem, {
childList: true,
attributes: true,
attributeFilter: ["class"],
});
}
}
}