Small refactor
This commit is contained in:
parent
28074a7f17
commit
cd4f68f8f5
|
@ -41,12 +41,12 @@ export class UserGuideEditorComponent extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
private parseText(source: string): string {
|
private parseText(source: string): string {
|
||||||
source = source.replace(/src="images/g, `src="${environment.guideAssets}`);
|
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)));
|
const brokenElements = Array.from(new Set(source.match(/<\/\w+\d* >/g)));
|
||||||
if (!isNullOrUndefined(brokenElements)) {
|
if (!isNullOrUndefined(brokenElements)) {
|
||||||
brokenElements.forEach((brokenElement) => {
|
brokenElements.forEach((brokenElement) => {
|
||||||
const tempvalue = brokenElement.match(/\/\w+\d*/)[0];
|
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;
|
return source;
|
||||||
|
|
Loading…
Reference in New Issue