mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Do not resize images in Onebox while lazy loading.
Follow-up to 35d0fd0
.
This commit is contained in:
parent
9acd851b9a
commit
35da531f1d
@ -53,10 +53,21 @@ function show(image) {
|
||||
copyImg.style.position = "absolute";
|
||||
copyImg.style.top = `${image.offsetTop}px`;
|
||||
copyImg.style.left = `${image.offsetLeft}px`;
|
||||
copyImg.style.width = `${imageData.width}px`;
|
||||
copyImg.style.height = `${imageData.height}px`;
|
||||
copyImg.className = imageData.className;
|
||||
|
||||
let inOnebox = false;
|
||||
for (let element = image; element; element = element.parentElement) {
|
||||
if (element.classList.contains("onebox")) {
|
||||
inOnebox = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!inOnebox) {
|
||||
copyImg.style.width = `${imageData.width}px`;
|
||||
copyImg.style.height = `${imageData.height}px`;
|
||||
}
|
||||
|
||||
image.parentNode.insertBefore(copyImg, image);
|
||||
} else {
|
||||
image.classList.remove("d-lazyload-hidden");
|
||||
|
Loading…
Reference in New Issue
Block a user