소스 검색

fix(editor): wrong xml prettify implementation

Introduced: #8968
Andelf 2 년 전
부모
커밋
beb02b6028
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      src/main/frontend/utils.js

+ 3 - 1
src/main/frontend/utils.js

@@ -395,5 +395,7 @@ export const prettifyXml = function(sourceXml)
     xsltProcessor.importStylesheet(xsltDoc);
     var resultDoc = xsltProcessor.transformToDocument(xmlDoc);
     var resultXml = new XMLSerializer().serializeToString(resultDoc);
-    return resultXml;
+    // if it has parsererror, then return the original text
+    return resultXml.indexOf('<parsererror') === -1 ? resultXml : sourceXml;
+
 };