Generating HTML link using DOM manipulation rather that string manipulation
This commit is contained in:
parent
eec15b38bb
commit
b7ac3b8fad
6
front/dist/resources/style/style.css
vendored
6
front/dist/resources/style/style.css
vendored
@ -381,7 +381,7 @@ body {
|
|||||||
max-height: 25%;
|
max-height: 25%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#game {
|
#game {
|
||||||
@ -1115,6 +1115,10 @@ div.modal-report-user{
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.discussion .messages .message p a:visited{
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
.discussion .send-message{
|
.discussion .send-message{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 45px;
|
bottom: 45px;
|
||||||
|
@ -35,7 +35,12 @@ export class HtmlUtils {
|
|||||||
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
||||||
text = HtmlUtils.escapeHtml(text);
|
text = HtmlUtils.escapeHtml(text);
|
||||||
return text.replace(urlRegex, (url: string) => {
|
return text.replace(urlRegex, (url: string) => {
|
||||||
return '<a href="' + url + '" target="_blank" style=":visited {color: white}">' + url + '</a>';
|
const link = document.createElement('a');
|
||||||
|
link.href = url;
|
||||||
|
link.target = "_blank";
|
||||||
|
const text = document.createTextNode(url);
|
||||||
|
link.appendChild(text);
|
||||||
|
return link.outerHTML;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user