HTML-escape strings in the soft prompt selection menu
This commit is contained in:
parent
1f449a9dda
commit
9e82ce34a6
|
@ -682,15 +682,18 @@ function buildSPList(ar) {
|
|||
: Object.prototype.toString.call(ar[i].supported) === "[object Array]"
|
||||
? "[" + ar[i].supported.join(', ') + "]"
|
||||
: "[" + ar[i].supported.toString() + "]";
|
||||
var filename = ar[i].filename.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/(?=\r|\n)\r?\n?/g, '<br/>');
|
||||
var name = ar[i].name || ar[i].filename;
|
||||
name = name.length > 120 ? name.slice(0, 117) + '...' : name;
|
||||
name = name.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/(?=\r|\n)\r?\n?/g, '<br/>');
|
||||
var desc = ar[i].description || '';
|
||||
desc = desc.length > 500 ? desc.slice(0, 497) + '...' : desc;
|
||||
desc = desc.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/(?=\r|\n)\r?\n?/g, '<br/>');
|
||||
spcontent.append("<div class=\"flex\">\
|
||||
<div class=\"splistitem flex-row-container\" id=\"sp"+i+"\" name=\""+ar[i].filename+"\">\
|
||||
<div class=\"flex-row\">\
|
||||
<div>"+name+"</div>\
|
||||
<div class=\"flex-push-right splistitemsub\">"+ar[i].filename+"</div>\
|
||||
<div class=\"flex-push-right splistitemsub\">"+filename+"</div>\
|
||||
</div>\
|
||||
<div class=\"flex-row\">\
|
||||
<div>"+desc+"</div>\
|
||||
|
|
Loading…
Reference in New Issue