I'm trying to render a structure inside a RichTextField in kentico cloud. Following this tutorial https://docs.kenticocloud.com/tutorials/develop-apps/get-content/dealing-with-structure-in-rich-text i made a ContentType and used as template for my AngularLink
(which has 2 properties, text and link), then defined a TypeResolver and registered in DeliveryClient
new DeliveryClient({
projectId: 'xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
typeResolvers: [
new TypeResolver('landing_page', () => new LandingPage()),
new TypeResolver('angular_link', () => new AngularLink())
],
});
the AngularLink
class provides a richTextResolver
export class AngularLink extends ContentItem {
text: Fields.TextField;
link: Fields.TextField;
constructor() {
super({
richTextResolver: (item: AngularLink) => {
return `<a routerLink="${item.link.value}">${item.text.value}</a>`;
}
});
}
}
The problem is that when i resolve the html with the getHtml()
method in RichTextField, the BrowserRichTextParser
inserts the returned string in an element through innerHTML and the final result is the anchor tag with an attribute routerlink
all lowercase.
Is there a better strategy to make angular attributes working inside the standard fow of kentico-cloud-delivery api?
Thank you very much in advance!