UI: Resources service - avoid modules scan recursion. Update markdown template sanitize according to the latest angular template requirements.
This commit is contained in:
parent
1d6b6a3f40
commit
4ca215fdee
@ -237,11 +237,10 @@ export class ResourcesService {
|
|||||||
standaloneComponents: []
|
standaloneComponents: []
|
||||||
},
|
},
|
||||||
visitedModules: Set<any> = new Set<any>()): ModulesWithComponents {
|
visitedModules: Set<any> = new Set<any>()): ModulesWithComponents {
|
||||||
if (module && ['object', 'function'].includes(typeof module)) {
|
if (module && ['object', 'function'].includes(typeof module) && !visitedModules.has(module)) {
|
||||||
|
visitedModules.add(module);
|
||||||
if (ɵNG_MOD_DEF in module) {
|
if (ɵNG_MOD_DEF in module) {
|
||||||
const moduleDef: ɵNgModuleDef<any> = module[ɵNG_MOD_DEF];
|
const moduleDef: ɵNgModuleDef<any> = module[ɵNG_MOD_DEF];
|
||||||
if (!visitedModules.has(moduleDef.type)) {
|
|
||||||
visitedModules.add(moduleDef.type);
|
|
||||||
const moduleInfo: ModuleInfo = {
|
const moduleInfo: ModuleInfo = {
|
||||||
module: moduleDef,
|
module: moduleDef,
|
||||||
components: []
|
components: []
|
||||||
@ -266,7 +265,6 @@ export class ResourcesService {
|
|||||||
this.extractModulesWithComponents(module, modulesWithComponents, visitedModules);
|
this.extractModulesWithComponents(module, modulesWithComponents, visitedModules);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (ɵNG_COMP_DEF in module) {
|
} else if (ɵNG_COMP_DEF in module) {
|
||||||
const component: ɵComponentDef<any> = module[ɵNG_COMP_DEF];
|
const component: ɵComponentDef<any> = module[ɵNG_COMP_DEF];
|
||||||
if (component.standalone) {
|
if (component.standalone) {
|
||||||
|
|||||||
@ -127,7 +127,7 @@ export class TbMarkdownComponent implements OnChanges {
|
|||||||
const preHtml = preElements.item(i).outerHTML.replace('ngnonbindable=""', 'ngNonBindable');
|
const preHtml = preElements.item(i).outerHTML.replace('ngnonbindable=""', 'ngNonBindable');
|
||||||
template = template.replace(matches[i][0], preHtml);
|
template = template.replace(matches[i][0], preHtml);
|
||||||
}
|
}
|
||||||
template = this.sanitizeCurlyBraces(template);
|
template = this.sanitize(template);
|
||||||
this.markdownContainer.clear();
|
this.markdownContainer.clear();
|
||||||
let styles: string[] = [];
|
let styles: string[] = [];
|
||||||
let readyObservable: Observable<void>;
|
let readyObservable: Observable<void>;
|
||||||
@ -259,8 +259,8 @@ export class TbMarkdownComponent implements OnChanges {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private sanitizeCurlyBraces(template: string): string {
|
private sanitize(template: string): string {
|
||||||
return template.replace(/{/g, '{').replace(/}/g, '}');
|
return template.replace(/{/g, '{').replace(/}/g, '}').replace(/@/g, '@');
|
||||||
}
|
}
|
||||||
|
|
||||||
private destroyMarkdownInstanceResources() {
|
private destroyMarkdownInstanceResources() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user