Loading src/app/p_services/admin/lifeCycleManagement/service-rule-design/service-rule-design.component.ts +32 −12 Original line number Diff line number Diff line Loading @@ -1169,13 +1169,27 @@ export class ServiceRuleDesignComponent implements OnInit { }; Blockly.Java['text_escape'] = function(block: any) { var code = Blockly.Java.valueToCode(block, 'paramtxt', Blockly.Java.ORDER_NONE) || '""'; code = code.replace('"', ''); code = code.substring(0, code.length-1); // code = code.replaceAll('\\', '\\\\'); // code = code.replaceAll('"', '\\"'); code = '"' + textEscape(code) + '"'; // Get the value connected to 'paramtxt', defaulting to an empty string var code = Blockly.Java.valueToCode(block, 'paramtxt', Blockly.Java.ORDER_NONE) || '""'; // If the code starts and ends with quotes, treat it as a literal string if (code.startsWith('"') && code.endsWith('"')) { // Remove surrounding quotes var literalValue = code.substring(1, code.length - 1); // Call the textEscape function to escape the string literalValue = textEscape(literalValue); // Wrap the escaped string in double quotes again code = '"' + literalValue + '"'; return [code, Blockly.Java.ORDER_ATOMIC] } // If the code is not a literal (e.g., it's a method call) code = "escapeText(" + code + ")"; return [code, Blockly.Java.ORDER_ATOMIC]; }; Loading Loading @@ -1759,10 +1773,16 @@ export class ServiceRuleDesignComponent implements OnInit { function textEscape(avalue: any): any { //avalue = avalue.replaceAll('\\', '\\\\'); avalue = avalue.replaceAll('"', '\\"'); //avalue = avalue.replaceAll('\\\\\\\\n', '\n'); // Check if the value is an object (including arrays) if (typeof avalue === 'object' && avalue !== null) { // Convert object or array to a JSON string avalue = JSON.stringify(avalue); } else if (typeof avalue !== 'string') { // If it's not an object/array or string, return as is (e.g., number, null, etc.) return avalue; } // Escape double quotes in the string return avalue.replaceAll('"', '\\"'); } Loading
src/app/p_services/admin/lifeCycleManagement/service-rule-design/service-rule-design.component.ts +32 −12 Original line number Diff line number Diff line Loading @@ -1169,13 +1169,27 @@ export class ServiceRuleDesignComponent implements OnInit { }; Blockly.Java['text_escape'] = function(block: any) { var code = Blockly.Java.valueToCode(block, 'paramtxt', Blockly.Java.ORDER_NONE) || '""'; code = code.replace('"', ''); code = code.substring(0, code.length-1); // code = code.replaceAll('\\', '\\\\'); // code = code.replaceAll('"', '\\"'); code = '"' + textEscape(code) + '"'; // Get the value connected to 'paramtxt', defaulting to an empty string var code = Blockly.Java.valueToCode(block, 'paramtxt', Blockly.Java.ORDER_NONE) || '""'; // If the code starts and ends with quotes, treat it as a literal string if (code.startsWith('"') && code.endsWith('"')) { // Remove surrounding quotes var literalValue = code.substring(1, code.length - 1); // Call the textEscape function to escape the string literalValue = textEscape(literalValue); // Wrap the escaped string in double quotes again code = '"' + literalValue + '"'; return [code, Blockly.Java.ORDER_ATOMIC] } // If the code is not a literal (e.g., it's a method call) code = "escapeText(" + code + ")"; return [code, Blockly.Java.ORDER_ATOMIC]; }; Loading Loading @@ -1759,10 +1773,16 @@ export class ServiceRuleDesignComponent implements OnInit { function textEscape(avalue: any): any { //avalue = avalue.replaceAll('\\', '\\\\'); avalue = avalue.replaceAll('"', '\\"'); //avalue = avalue.replaceAll('\\\\\\\\n', '\n'); // Check if the value is an object (including arrays) if (typeof avalue === 'object' && avalue !== null) { // Convert object or array to a JSON string avalue = JSON.stringify(avalue); } else if (typeof avalue !== 'string') { // If it's not an object/array or string, return as is (e.g., number, null, etc.) return avalue; } // Escape double quotes in the string return avalue.replaceAll('"', '\\"'); }