@ecency/render-helper 2.4.21 → 2.4.23
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 +12 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +12 -2
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +12 -2
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -369,7 +369,7 @@ function img(el, state) {
|
|
|
369
369
|
}
|
|
370
370
|
const cls = el.getAttribute("class") || "";
|
|
371
371
|
const shouldReplace = !cls.includes("no-replace");
|
|
372
|
-
const hasAlreadyProxied = src.startsWith("https://images.ecency.com");
|
|
372
|
+
const hasAlreadyProxied = src.startsWith("https://images.ecency.com/p/") || src.startsWith("https://images.ecency.com/u/") || /^https:\/\/images\.ecency\.com\/\d+x\d+\//.test(src);
|
|
373
373
|
if (shouldReplace && !hasAlreadyProxied) {
|
|
374
374
|
const proxified = proxifyImageSrc(decodedSrc);
|
|
375
375
|
if (proxified) {
|
|
@@ -1232,11 +1232,21 @@ function linkify(content, forApp) {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
|
|
1234
1234
|
// src/methods/text.method.ts
|
|
1235
|
+
function hasAncestor(node, tagNames) {
|
|
1236
|
+
let current = node.parentNode;
|
|
1237
|
+
while (current) {
|
|
1238
|
+
if (tagNames.includes(current.nodeName.toLowerCase())) {
|
|
1239
|
+
return true;
|
|
1240
|
+
}
|
|
1241
|
+
current = current.parentNode;
|
|
1242
|
+
}
|
|
1243
|
+
return false;
|
|
1244
|
+
}
|
|
1235
1245
|
function text(node, forApp) {
|
|
1236
1246
|
if (!node || !node.parentNode) {
|
|
1237
1247
|
return;
|
|
1238
1248
|
}
|
|
1239
|
-
if (["a", "code"]
|
|
1249
|
+
if (hasAncestor(node, ["a", "code", "pre"])) {
|
|
1240
1250
|
return;
|
|
1241
1251
|
}
|
|
1242
1252
|
const nodeValue = node.nodeValue || "";
|