@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.
@@ -398,7 +398,7 @@ function img(el, state) {
398
398
  }
399
399
  const cls = el.getAttribute("class") || "";
400
400
  const shouldReplace = !cls.includes("no-replace");
401
- const hasAlreadyProxied = src.startsWith("https://images.ecency.com");
401
+ 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);
402
402
  if (shouldReplace && !hasAlreadyProxied) {
403
403
  const proxified = proxifyImageSrc(decodedSrc);
404
404
  if (proxified) {
@@ -1261,11 +1261,21 @@ function linkify(content, forApp) {
1261
1261
  }
1262
1262
 
1263
1263
  // src/methods/text.method.ts
1264
+ function hasAncestor(node, tagNames) {
1265
+ let current = node.parentNode;
1266
+ while (current) {
1267
+ if (tagNames.includes(current.nodeName.toLowerCase())) {
1268
+ return true;
1269
+ }
1270
+ current = current.parentNode;
1271
+ }
1272
+ return false;
1273
+ }
1264
1274
  function text(node, forApp) {
1265
1275
  if (!node || !node.parentNode) {
1266
1276
  return;
1267
1277
  }
1268
- if (["a", "code"].includes(node.parentNode.nodeName.toLowerCase())) {
1278
+ if (hasAncestor(node, ["a", "code", "pre"])) {
1269
1279
  return;
1270
1280
  }
1271
1281
  const nodeValue = node.nodeValue || "";