Allow tagging(mention) in Notes with username or display name (#137)
Signed-off-by: Harshil-Jani <harshiljani2002@gmail.com>
This commit is contained in:
parent
3fcd7fece8
commit
17be82375e
|
@ -298,6 +298,16 @@ export class ContentComponent {
|
|||
} else {
|
||||
i = res.push({ safeWord: this.utilities.sanitizeUrlAndBypass(token), word: token.substring(6), token: decoded.type });
|
||||
}
|
||||
} else if (token.startsWith('@')) {
|
||||
const username = token.substring(1);
|
||||
const npub = this.profileService.following.find((follower) => follower.name === username)?.npub;
|
||||
if (npub) {
|
||||
const decoded = nip19.decode(npub);
|
||||
const val = decoded.data as any;
|
||||
i = res.push({ safeWord: this.utilities.sanitizeUrlAndBypass(token), word: val, token: decoded.type });
|
||||
} else {
|
||||
res[i] += token;
|
||||
}
|
||||
} else if (token.startsWith('http://') || token.startsWith('https://')) {
|
||||
if (this.isImage(token)) {
|
||||
i = res.push({ safeWord: this.utilities.sanitizeUrlAndBypass(token), word: token, token: 'image' });
|
||||
|
|
Loading…
Reference in New Issue