@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.
package/dist/node/index.cjs
CHANGED
|
@@ -1258,6 +1258,7 @@ function linkify(content, forApp, renderOptions) {
|
|
|
1258
1258
|
}
|
|
1259
1259
|
return `${preceding}<a class="markdown-tag-link" data-tag="${tagLower}">${tag.trim()}</a>`;
|
|
1260
1260
|
});
|
|
1261
|
+
const authorPlaceholders = [];
|
|
1261
1262
|
content = content.replace(
|
|
1262
1263
|
/(^|[^a-zA-Z0-9_!#$%&*@@/]|(^|[^a-zA-Z0-9_+~.-/]))[@@]([a-z][-.a-z\d^/]+[a-z\d])/gi,
|
|
1263
1264
|
(match, preceeding1, preceeding2, user) => {
|
|
@@ -1266,7 +1267,10 @@ function linkify(content, forApp, renderOptions) {
|
|
|
1266
1267
|
if (userLower.indexOf("/") === -1 && isValidUsername(user)) {
|
|
1267
1268
|
if (!forApp) {
|
|
1268
1269
|
const avatarSrc = `https://images.ecency.com/u/${userLower}/avatar/small`;
|
|
1269
|
-
|
|
1270
|
+
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>`;
|
|
1271
|
+
const placeholder = `\u200C${authorPlaceholders.length}\u200C`;
|
|
1272
|
+
authorPlaceholders.push({ placeholder, html });
|
|
1273
|
+
return placeholder;
|
|
1270
1274
|
}
|
|
1271
1275
|
return `${preceedings}<a class="markdown-author-link" data-author="${userLower}">@${user}</a>`;
|
|
1272
1276
|
} else {
|
|
@@ -1311,6 +1315,9 @@ function linkify(content, forApp, renderOptions) {
|
|
|
1311
1315
|
firstImageUsed = true;
|
|
1312
1316
|
return createImageHTML(imglink, isLCP);
|
|
1313
1317
|
});
|
|
1318
|
+
authorPlaceholders.forEach(({ placeholder, html }) => {
|
|
1319
|
+
content = content.replace(placeholder, html);
|
|
1320
|
+
});
|
|
1314
1321
|
return content;
|
|
1315
1322
|
}
|
|
1316
1323
|
|