Fix html escaping showing up in input fields. (#1584)

Signed-off-by: thislooksfun <thislooksfun@repbot.org>
This commit is contained in:
thislooksfun
2020-10-12 12:23:17 -05:00
parent c3dbd56078
commit 8f55dfa03b
5 changed files with 20 additions and 5 deletions

View File

@@ -22,6 +22,20 @@ function escapeHtml(text) {
});
}
function unescapeHtml(text) {
var map = {
"&amp;": "&",
"&lt;": "<",
"&gt;": ">",
"&quot;": '"',
"&#039;": "'"
};
return text.replace(/&(?:amp|lt|gt|quot|#039);/g, function (m) {
return map[m];
});
}
// Helper function for converting Objects to Arrays after sorting the keys
function objectToArray(obj) {
var arr = [];
@@ -233,6 +247,7 @@ function getGraphType() {
window.utils = (function () {
return {
escapeHtml: escapeHtml,
unescapeHtml: unescapeHtml,
objectToArray: objectToArray,
padNumber: padNumber,
showAlert: showAlert,