@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/browser/index.js
CHANGED
|
@@ -388,7 +388,7 @@ var getInlineMeta = (el, href, author, permlink, communityTag) => {
|
|
|
388
388
|
if (communityTag) {
|
|
389
389
|
expectedDisplays.add(`${communityTag.toLowerCase()}/${normalizedTarget}`);
|
|
390
390
|
}
|
|
391
|
-
const sophisticatedMatch = normalizedDisplay === normalizedTarget || communityTag
|
|
391
|
+
const sophisticatedMatch = normalizedDisplay === normalizedTarget || (communityTag ? normalizedDisplay === `${communityTag.toLowerCase()}/${normalizedTarget}` : false);
|
|
392
392
|
return {
|
|
393
393
|
textMatches,
|
|
394
394
|
titleMatches,
|
|
@@ -1490,11 +1490,23 @@ function getImage(entry, width = 0, height = 0, format = "match") {
|
|
|
1490
1490
|
}
|
|
1491
1491
|
function catchPostImage(obj, width = 0, height = 0, format = "match") {
|
|
1492
1492
|
if (typeof obj === "string") {
|
|
1493
|
-
const
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1493
|
+
const html = markdown2Html(obj);
|
|
1494
|
+
const doc = createDoc(html);
|
|
1495
|
+
if (!doc) {
|
|
1496
|
+
return null;
|
|
1497
|
+
}
|
|
1498
|
+
const imgEls = doc.getElementsByTagName("img");
|
|
1499
|
+
if (imgEls.length >= 1) {
|
|
1500
|
+
const src = imgEls[0].getAttribute("src");
|
|
1501
|
+
if (!src) {
|
|
1502
|
+
return null;
|
|
1503
|
+
}
|
|
1504
|
+
if (isGifLink(src)) {
|
|
1505
|
+
return proxifyImageSrc(src, 0, 0, format);
|
|
1506
|
+
}
|
|
1507
|
+
return proxifyImageSrc(src, width, height, format);
|
|
1508
|
+
}
|
|
1509
|
+
return null;
|
|
1498
1510
|
}
|
|
1499
1511
|
const key = `${makeEntryCacheKey(obj)}-${width}x${height}-${format}`;
|
|
1500
1512
|
const item = cacheGet(key);
|