RTE formatting | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JeetendrakumarSa

HI @narendiran_ravi, issue finally found not in the AEM, that need to check in the front-end code 🙂

3 replies

BrianKasingli
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
September 26, 2024

Well, first of all you need to make sure your SlingModel is initiated... and then your using the correct Sling Annotations to pull jcr properties into that component. like @ValueMapValue private String text;... next, you need to ensure that your TextUtil is also working as expected.

 

 

HTL <a href="${model.urlLink}">${model.formattedText}</a> Sightly ... @ValueMapValue private String urlLink; @ValueMapValue private String text; public String getUrl() { return LinkUtils.formatLink(urlLink); } public String getFormattedText() { return TextUtil.reformatText(text); }

 

 

 

for testing sale, making sure if your Sling Model is returning string from the backend as expected, you can do something like this:
public String getFormattedText() {
   return "I love sourcedcode.com!";
}

 

References (Sling Model Annotations CheatSheet): https://sourcedcode.com/blog/aem/aem-sling-model-injectors-annotations-cheat-sheet-reference-guide#ValueMapValue

 

 

Level 2
September 27, 2024

Handled correctly only but formatting not works:

 

BrianKasingli
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
September 27, 2024

Hello, your link TextUtil must be not working as expected…. 

you can simple return hard coded text, to see if the method is retuning anything correct, and if so, must be your TextUtil. Something is not working there. 

public String getFormattedText() {
   return "I love sourcedcode.com!";
}

h_kataria
Community Advisor
Community Advisor
September 27, 2024

When you say it is not working. Could you elaborate that a little ? 

Level 2
September 27, 2024

For example, the formatting is applied to the text field which is working fine in 1 component but not working for the other.

narendiran_ravi
Level 6
September 27, 2024

You can debug or add logs to see if the Util method gives the expected output.

JeetendrakumarSaAuthorAccepted solution
Level 2
September 27, 2024

HI @narendiran_ravi, issue finally found not in the AEM, that need to check in the front-end code 🙂