From ebf684edef929fe75947c4e3107e801ab5d30fe5 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 29 Jun 2021 17:31:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E5=AF=BC=E5=85=A5JMX=E4=B8=AD=E7=9A=84Beanshell?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=9C=89=E5=A4=9A=E4=BD=99=E6=8D=A2=E8=A1=8C?= =?UTF-8?q?=E7=AC=A6,PR=E6=9D=A5=E8=87=AA@xiongxiaoqing614=20#2420?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/common/js/format-utils.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/src/common/js/format-utils.js b/frontend/src/common/js/format-utils.js index 2d84f5012b..40599f2c51 100644 --- a/frontend/src/common/js/format-utils.js +++ b/frontend/src/common/js/format-utils.js @@ -95,11 +95,11 @@ export function formatXml(text) { return name + ' ' + props.replace(/\s+(\w+=)/g, " $1"); }).replace(/>\s*?\n<"); //把注释编码 - text = text.replace(/\n/g, '\r').replace(//g, function ($0, text) { + text = text.replace(//g, function ($0, text) { var ret = ''; //alert(ret); return ret; - }).replace(/\r/g, '\n'); + }); //调整格式 var rgx = /\n(<(([^\?]).+?)(?:\s|\s*?>|\s*?(\/)>)(?:.*?(?:(?:(\/)>)|(?:<(\/)\2>)))?)/mg; var nodeStack = []; @@ -127,10 +127,8 @@ export function formatXml(text) { }); var prefixSpace = -1; var outputText = output.substring(1); - //alert(outputText); //把注释还原并解码,调格式 - outputText = outputText.replace(/\n/g, '\r').replace(/(\s*)/g, function ($0, prefix, text) { - //alert(['[',prefix,']=',prefix.length].join('')); + outputText = outputText.replace(/(\s*)/g, function ($0, prefix, text) { if (prefix.charAt(0) == '\r') prefix = prefix.substring(1); text = unescape(text).replace(/\r/g, '\n');