Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

AEM6.5 source edit plugin adding "\\r\\n" after content adding in richtext inside Multifield

Avatar

Level 7

Hi All,

the Source Edit Plugin is adding a "\r\n" line break after the content that you are authoring in a multifield dialog with richtext fields in Adobe Experience Manager (AEM).

 

I am facing an issue where I have a multifield dialog having richtext fields. and whenever I am authorthing any values using Source Edit Plugin. and saving dialog it will automatically save "\r\n" regex after the authored content init

example:

tushaar_srivastava_0-1672926186731.png

and store like : 

 

tushaar_srivastava_1-1672926364149.png

and if we check properties in crx node it shows one line break [enter] in porpery.

 

How to resolve this?

 

Thanks 

@kautuk_sahni  @arunpatidar @BrianKasingli  @Theo_Pendle 

 

[Update]
I am reading the richtext value with name.\value, which is having \r\n in the last of which we authored in source edit plugin and I am reading it like ValueMap vm = multifield.getValueMap; vm.getOrDefault("Value",StringUtils.EMPTY).toString()); I am manipulate the string to reove \r\n from the last : 
like: 

String value = vm.getOrDefault("Value", StringUtils.EMPTY).toString();
value = value.trim();

or

String value = vm.getOrDefault("Value", StringUtils.EMPTY).toString();
value = StringUtils.stripEnd(value, "\r\n");

Could you please suggest me any other optimized solution.

 

1 Accepted Solution

Avatar

Correct answer by
Level 7

I have used below approach :

String value = vm.getOrDefault("Value", StringUtils.EMPTY).toString();
value = StringUtils.stripEnd(value, "\r\n");

View solution in original post

4 Replies

Avatar

Level 7

do we have any dialog level property implementation to remove line break for richText>? maybe cleanup="true"

 

Avatar

Correct answer by
Level 7

I have used below approach :

String value = vm.getOrDefault("Value", StringUtils.EMPTY).toString();
value = StringUtils.stripEnd(value, "\r\n");