@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.
@@ -366,7 +366,7 @@ function img(el, state) {
366
366
  }
367
367
  const cls = el.getAttribute("class") || "";
368
368
  const shouldReplace = !cls.includes("no-replace");
369
- const hasAlreadyProxied = src.startsWith("https://images.ecency.com");
369
+ 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);
370
370
  if (shouldReplace && !hasAlreadyProxied) {
371
371
  const proxified = proxifyImageSrc(decodedSrc);
372
372
  if (proxified) {
@@ -1229,11 +1229,21 @@ function linkify(content, forApp) {
1229
1229
  }
1230
1230
 
1231
1231
  // src/methods/text.method.ts
1232
+ function hasAncestor(node, tagNames) {
1233
+ let current = node.parentNode;
1234
+ while (current) {
1235
+ if (tagNames.includes(current.nodeName.toLowerCase())) {
1236
+ return true;
1237
+ }
1238
+ current = current.parentNode;
1239
+ }
1240
+ return false;
1241
+ }
1232
1242
  function text(node, forApp) {
1233
1243
  if (!node || !node.parentNode) {
1234
1244
  return;
1235
1245
  }
1236
- if (["a", "code"].includes(node.parentNode.nodeName.toLowerCase())) {
1246
+ if (hasAncestor(node, ["a", "code", "pre"])) {
1237
1247
  return;
1238
1248
  }
1239
1249
  const nodeValue = node.nodeValue || "";