@ecency/render-helper 2.4.10 → 2.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +18 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +18 -6
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +18 -6
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -420,7 +420,7 @@ var getInlineMeta = (el, href, author, permlink, communityTag) => {
|
|
|
420
420
|
if (communityTag) {
|
|
421
421
|
expectedDisplays.add(`${communityTag.toLowerCase()}/${normalizedTarget}`);
|
|
422
422
|
}
|
|
423
|
-
const sophisticatedMatch = normalizedDisplay === normalizedTarget || communityTag
|
|
423
|
+
const sophisticatedMatch = normalizedDisplay === normalizedTarget || (communityTag ? normalizedDisplay === `${communityTag.toLowerCase()}/${normalizedTarget}` : false);
|
|
424
424
|
return {
|
|
425
425
|
textMatches,
|
|
426
426
|
titleMatches,
|
|
@@ -1522,11 +1522,23 @@ function getImage(entry, width = 0, height = 0, format = "match") {
|
|
|
1522
1522
|
}
|
|
1523
1523
|
function catchPostImage(obj, width = 0, height = 0, format = "match") {
|
|
1524
1524
|
if (typeof obj === "string") {
|
|
1525
|
-
const
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1525
|
+
const html = markdown2Html(obj);
|
|
1526
|
+
const doc = createDoc(html);
|
|
1527
|
+
if (!doc) {
|
|
1528
|
+
return null;
|
|
1529
|
+
}
|
|
1530
|
+
const imgEls = doc.getElementsByTagName("img");
|
|
1531
|
+
if (imgEls.length >= 1) {
|
|
1532
|
+
const src = imgEls[0].getAttribute("src");
|
|
1533
|
+
if (!src) {
|
|
1534
|
+
return null;
|
|
1535
|
+
}
|
|
1536
|
+
if (isGifLink(src)) {
|
|
1537
|
+
return proxifyImageSrc(src, 0, 0, format);
|
|
1538
|
+
}
|
|
1539
|
+
return proxifyImageSrc(src, width, height, format);
|
|
1540
|
+
}
|
|
1541
|
+
return null;
|
|
1530
1542
|
}
|
|
1531
1543
|
const key = `${makeEntryCacheKey(obj)}-${width}x${height}-${format}`;
|
|
1532
1544
|
const item = cacheGet(key);
|