Merge pull request #59 from flipio-ru/fix-ios-padding

Fixes the iOS extra image bottom padding issue
This commit is contained in:
Leonardo Cavaletti 2021-09-07 08:14:27 +01:00 committed by GitHub
commit 82431f4d7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,3 +86,16 @@ for (let i = 0; i < anchorLinks.length; i++) {
});
});
}
// fix the problem with images having an annoying extra padding
// in Webkit renderers on iOS devices
const imgs = document.querySelectorAll("img:not(.notion-emoji)");
for (let i = 0; i < imgs.length; i++) {
parent = imgs[i].parentElement
let style = parent.getAttribute("style")
style = style.replace(/padding-bottom: 133\.333\%;/, "")
style = style + "; height:auto!important;"
parent.setAttribute("style", style);
}