Skip to content

Commit 17be823

Browse files
authored
Allow tagging(mention) in Notes with username or display name (#137)
Signed-off-by: Harshil-Jani <[email protected]>
1 parent 3fcd7fe commit 17be823

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/app/shared/content/content.ts

+10
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,16 @@ export class ContentComponent {
298298
} else {
299299
i = res.push({ safeWord: this.utilities.sanitizeUrlAndBypass(token), word: token.substring(6), token: decoded.type });
300300
}
301+
} else if (token.startsWith('@')) {
302+
const username = token.substring(1);
303+
const npub = this.profileService.following.find((follower) => follower.name === username)?.npub;
304+
if (npub) {
305+
const decoded = nip19.decode(npub);
306+
const val = decoded.data as any;
307+
i = res.push({ safeWord: this.utilities.sanitizeUrlAndBypass(token), word: val, token: decoded.type });
308+
} else {
309+
res[i] += token;
310+
}
301311
} else if (token.startsWith('http://') || token.startsWith('https://')) {
302312
if (this.isImage(token)) {
303313
i = res.push({ safeWord: this.utilities.sanitizeUrlAndBypass(token), word: token, token: 'image' });

0 commit comments

Comments
 (0)