Small refactor

This commit is contained in:
George Kalampokis 2020-02-17 17:43:12 +02:00
parent 28074a7f17
commit cd4f68f8f5
1 changed files with 2 additions and 2 deletions

View File

@ -41,12 +41,12 @@ export class UserGuideEditorComponent extends BaseComponent implements OnInit {
private parseText(source: string): string {
source = source.replace(/src="images/g, `src="${environment.guideAssets}`);
source = source.replace(/\r\n +>/g, '>\r\n');
source = source.replace(/\r\n +>/g, '>\n');
const brokenElements = Array.from(new Set(source.match(/<\/\w+\d* >/g)));
if (!isNullOrUndefined(brokenElements)) {
brokenElements.forEach((brokenElement) => {
const tempvalue = brokenElement.match(/\/\w+\d*/)[0];
source = source.replace(new RegExp(brokenElement, 'g'), `<${tempvalue}>\r\n`);
source = source.replace(new RegExp(brokenElement, 'g'), `<${tempvalue}>\n`);
});
}
return source;