communications app, popup lib
This commit is contained in:
@ -34,7 +34,7 @@ function formatUrl(msg) {
|
||||
//const urlArrray = str.match(urlReg);
|
||||
const p = /(http|ftp|https):\/\/.+?(\s|\r\n|\r|\n|\"|\'|\*|$)/g;
|
||||
const r = msg.match(p);
|
||||
msg = htmlencode(msg);
|
||||
msg = escapeHtml(msg);
|
||||
|
||||
if (r?.length > 0) {
|
||||
const rs = [];
|
||||
@ -50,7 +50,17 @@ function formatUrl(msg) {
|
||||
}
|
||||
}
|
||||
|
||||
return msg
|
||||
return msg;
|
||||
}
|
||||
|
||||
function escapeHtml(text) {
|
||||
if (text == null) {
|
||||
return '';
|
||||
}
|
||||
return String(text)
|
||||
.replaceAll('&', '&')
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('\r\n', '<br/>')
|
||||
.replaceAll('\n', '<br/>')
|
||||
.replaceAll(' ', ' ');
|
||||
@ -61,5 +71,6 @@ export {
|
||||
contains,
|
||||
endsWith,
|
||||
padStart,
|
||||
formatUrl
|
||||
formatUrl,
|
||||
escapeHtml
|
||||
}
|
Reference in New Issue
Block a user