1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-04-11 11:12:03 +02:00

Clipper: Fixes #1881: Some pages could not be clipped in Firefox due to an issue with dynamic images

This commit is contained in:
Laurent Cozic 2019-10-02 19:03:36 +01:00
parent eca0ab0ef6
commit 309835f2fe

View File

@ -134,11 +134,17 @@
const src = absoluteUrl(imageSrc(node));
node.setAttribute('src', src);
if (!(src in imageIndexes)) imageIndexes[src] = 0;
const imageSize = imageSizes[src][imageIndexes[src]];
imageIndexes[src]++;
if (imageSize && convertToMarkup === 'markdown') {
node.width = imageSize.width;
node.height = imageSize.height;
if (!imageSizes[src]) {
// This seems to concern dynamic images that don't really such as Gravatar, etc.
console.warn('Found an image for which the size had not been fetched:', src);
} else {
const imageSize = imageSizes[src][imageIndexes[src]];
imageIndexes[src]++;
if (imageSize && convertToMarkup === 'markdown') {
node.width = imageSize.width;
node.height = imageSize.height;
}
}
}