Expand my Community achievements bar.

SOLVED

AEM Communities OOTB comments - Text only comments with line break

Avatar

Community Advisor

Hello All,

I was trying to add comments with line break using OOTB comments component (we-retail blog). I see that when I make a comment with line break (richtext disabled in component properties). I see the comment posted in a single line. Please see image below

1293784_pastedImage_0.png

I am using MSRP for UGC storage and the comment entry is stored with a '\n'. (See image)

1293788_pastedImage_1.png

Is this a desired behavior? I will expecting to see my comment as:

"test

another line"

instead of "test another line"

Please let me know if/how desired behavior can be achieved. (Other alternative is to allow RichText in component properties, but we will like to avoid that.)

Thanks

Shubham

1 Accepted Solution

Avatar

Correct answer by
Level 1

Hi Shubham,

You can use html's <pre> tag  if you want to keep the formatting without enabling rich-text. You can overlay few hbs files used by comment (component) and replace {{{message}}} with <pre> {{{message}}} </pre>

You may need to overlay the following files after updating, as mentioned above.

1. /libs/social/journal/components/hbs/entry_topic/entry_topic.hbs

2. /libs/social/journal/components/hbs/entry_topic/list-item.hbs

3. /libs/social/journal/components/hbs/comment/comment.hbs

View solution in original post

1 Reply

Avatar

Correct answer by
Level 1

Hi Shubham,

You can use html's <pre> tag  if you want to keep the formatting without enabling rich-text. You can overlay few hbs files used by comment (component) and replace {{{message}}} with <pre> {{{message}}} </pre>

You may need to overlay the following files after updating, as mentioned above.

1. /libs/social/journal/components/hbs/entry_topic/entry_topic.hbs

2. /libs/social/journal/components/hbs/entry_topic/list-item.hbs

3. /libs/social/journal/components/hbs/comment/comment.hbs