fix(editor): wrong xml prettify implementation

Introduced: #8968
This commit is contained in:
Andelf
2023-04-19 22:49:51 +08:00
parent 897a6af010
commit beb02b6028

View File

@@ -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;
};