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