diff --git a/apps/twitch-logs/src/app/comments/comments.component.html b/apps/twitch-logs/src/app/comments/comments.component.html index 93b9f81..bb11286 100644 --- a/apps/twitch-logs/src/app/comments/comments.component.html +++ b/apps/twitch-logs/src/app/comments/comments.component.html @@ -75,7 +75,17 @@ {{token.title}} - + + + {{token.formatted}} + + + + + + {{token}} + + diff --git a/apps/twitch-logs/src/app/pipes/splitmessage.pipe.ts b/apps/twitch-logs/src/app/pipes/splitmessage.pipe.ts index 8a57210..4cb0129 100644 --- a/apps/twitch-logs/src/app/pipes/splitmessage.pipe.ts +++ b/apps/twitch-logs/src/app/pipes/splitmessage.pipe.ts @@ -3,7 +3,7 @@ import { PipeTransform } from '@angular/core'; -import * as linkifyString from 'linkifyjs/string'; +import * as linkify from 'linkifyjs'; @Pipe({ @@ -22,13 +22,27 @@ export class SplitMessagePipe implements PipeTransform { let regexp = RegExp('(' + exps.join('|') + ')'); - // FIXME: do not split URLs - let tokens = message.split(regexp); + let options = new linkify.options.Options(); - return tokens.map((token: any) => { - let e = emotes.filter((emote: any) => emote.title == token); + let result = []; - return e.length > 0 ? e[0] : linkifyString(token); - }); + for (let token of linkify.tokenize(message)) { + if (token.isLink) { + result.push(options.resolve(token)); + continue; + } + + for (let part of token.toString().split(regexp)) { + let e = emotes.filter((emote: any) => emote.title == part); + + if (e.length > 0) { + result.push(e[0]); + } else { + result.push(part); + } + } + } + + return result; } } diff --git a/apps/twitch-logs/src/app/search/search.component.html b/apps/twitch-logs/src/app/search/search.component.html index bbb44b5..fb75478 100644 --- a/apps/twitch-logs/src/app/search/search.component.html +++ b/apps/twitch-logs/src/app/search/search.component.html @@ -112,7 +112,17 @@ {{token.title}} - + + + {{token.formatted}} + + + + + + {{token}} + +