|
@@ -84,6 +84,20 @@ let JsonFormatEntrance = (function () {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * HTML特殊字符格式化
|
|
|
|
+ * @param str
|
|
|
|
+ * @returns {*}
|
|
|
|
+ */
|
|
|
|
+ let htmlspecialchars = function(str){
|
|
|
|
+ str = str.replace(/&/g, '&');
|
|
|
|
+ str = str.replace(/</g, '<');
|
|
|
|
+ str = str.replace(/>/g, '>');
|
|
|
|
+ str = str.replace(/"/g, '"');
|
|
|
|
+ str = str.replace(/'/g, ''');
|
|
|
|
+ return str;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 执行代码格式化
|
|
* 执行代码格式化
|
|
@@ -94,7 +108,7 @@ let JsonFormatEntrance = (function () {
|
|
cachedJsonString = JSON.stringify(JSON.parse(jsonStr), null, 4);
|
|
cachedJsonString = JSON.stringify(JSON.parse(jsonStr), null, 4);
|
|
|
|
|
|
_initElements();
|
|
_initElements();
|
|
- jfPre.html(cachedJsonString);
|
|
|
|
|
|
+ jfPre.html(htmlspecialchars(cachedJsonString));
|
|
|
|
|
|
JsonFormatDealer.postMessage({
|
|
JsonFormatDealer.postMessage({
|
|
type: "SENDING TEXT",
|
|
type: "SENDING TEXT",
|