@ecency/render-helper 2.4.26 → 2.4.27

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.
@@ -1226,6 +1226,7 @@ function linkify(content, forApp, renderOptions) {
1226
1226
  }
1227
1227
  return `${preceding}<a class="markdown-tag-link" data-tag="${tagLower}">${tag.trim()}</a>`;
1228
1228
  });
1229
+ const authorPlaceholders = [];
1229
1230
  content = content.replace(
1230
1231
  /(^|[^a-zA-Z0-9_!#$%&*@@/]|(^|[^a-zA-Z0-9_+~.-/]))[@@]([a-z][-.a-z\d^/]+[a-z\d])/gi,
1231
1232
  (match, preceeding1, preceeding2, user) => {
@@ -1234,7 +1235,10 @@ function linkify(content, forApp, renderOptions) {
1234
1235
  if (userLower.indexOf("/") === -1 && isValidUsername(user)) {
1235
1236
  if (!forApp) {
1236
1237
  const avatarSrc = `https://images.ecency.com/u/${userLower}/avatar/small`;
1237
- return `${preceedings}<a class="er-author er-author-link" href="/@${userLower}"><img class="er-author-link-image" src="${avatarSrc}" alt="${userLower}"/><span class="er-author-link-content"><span class="er-author-link-label">Hive account</span><span>@${userLower}</span></span></a>`;
1238
+ const html = `${preceedings}<a class="er-author er-author-link" href="/@${userLower}"><img class="er-author-link-image" src="${avatarSrc}" alt="${userLower}"/><span class="er-author-link-content"><span class="er-author-link-label">Hive account</span><span>@${userLower}</span></span></a>`;
1239
+ const placeholder = `\u200C${authorPlaceholders.length}\u200C`;
1240
+ authorPlaceholders.push({ placeholder, html });
1241
+ return placeholder;
1238
1242
  }
1239
1243
  return `${preceedings}<a class="markdown-author-link" data-author="${userLower}">@${user}</a>`;
1240
1244
  } else {
@@ -1279,6 +1283,9 @@ function linkify(content, forApp, renderOptions) {
1279
1283
  firstImageUsed = true;
1280
1284
  return createImageHTML(imglink, isLCP);
1281
1285
  });
1286
+ authorPlaceholders.forEach(({ placeholder, html }) => {
1287
+ content = content.replace(placeholder, html);
1288
+ });
1282
1289
  return content;
1283
1290
  }
1284
1291