Automatic escaping in js enum editor.
This commit is contained in:
@@ -2380,7 +2380,7 @@ $(document).ready(function() {
|
|||||||
val = val + "'";
|
val = val + "'";
|
||||||
}
|
}
|
||||||
// escape the single quotes, except the mandatory ones enclosing the entire string
|
// escape the single quotes, except the mandatory ones enclosing the entire string
|
||||||
val = val.substr(1, val.length-2).replace(/'/g, "'");
|
val = val.substr(1, val.length-2).replace(/''/g, "'").replace(/\\\\/g, '\\').replace(/\\'/g, "'").replace(/'/g, "'");
|
||||||
// escape the greater-than symbol
|
// escape the greater-than symbol
|
||||||
val = val.replace(/>/g, ">");
|
val = val.replace(/>/g, ">");
|
||||||
$("#enum_editor #values").append("<input type='text' value=" + val + " />");
|
$("#enum_editor #values").append("<input type='text' value=" + val + " />");
|
||||||
@@ -2412,7 +2412,7 @@ $(document).ready(function() {
|
|||||||
$.each($("#enum_editor #values input"), function(index, input_element) {
|
$.each($("#enum_editor #values input"), function(index, input_element) {
|
||||||
val = jQuery.trim(input_element.value);
|
val = jQuery.trim(input_element.value);
|
||||||
if(val != "") {
|
if(val != "") {
|
||||||
value_array.push("'" + val + "'");
|
value_array.push("'" + val.replace(/\\/g, '\\\\').replace(/'/g, "''") + "'");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// get the Length/Values text field where this value belongs
|
// get the Length/Values text field where this value belongs
|
||||||
|
Reference in New Issue
Block a user