Radi85/Comment

Allow users to make new paragraphs in comments

tetron432 opened this issue · 5 comments

Proposed Functionality

In the comments currently, the library doesn't allow the users to make a new comment by hitting enter twice- everything instead is on a single line. Can you please make it so that when a user makes a comment in the preview, and tries to make a new paragraph, it also shows up when they post it as well?

Preview of comment
Screen Shot 2021-02-03 at 9 20 00 AM

What the comment look like when the user makes a post
Screen Shot 2021-02-03 at 9 20 13 AM

Hi @tetrahed,

This should be covered in #153.

I think this can be covered independently of the markdown thing.

If the developer doesn't want to wrap the contents of the each comment, maybe we can introduce a new setting with the name COMMENT_ALLOW_CONTENT_WRAP or something similar. It would bypass the current functionality when rendering comments, if not required.

From the top of my head without consider anything else I think, if required, we might only have to touch the function below:

def render_content(comment, number):
number = int(number)
content = comment.content
content_words = content.split()
if not number or len(content_words) <= number:
text_1 = content
text_2 = None
else:
text_1 = ' '.join(content_words[:number])
text_2 = ' '.join(content_words[number:])
return {
'text_1': text_1,
'text_2': text_2,
'urlhash': comment.urlhash
}

On second thoughts, we may also not wrap the contents when number is None.

This will allow the functionality to be implemented without adding another extra setting value but may have issues with backward compatibility.

On second thoughts, we may also not wrap the contents when number is None.

This will allow the functionality to be implemented without adding another extra setting value but may have issues with backward compatibility.

The current implementation is intended to use the setting variable. I found it more convenient than extending the template for this purpose.

The current implementation is intended to use the setting variable. I found it more convenient than extending the template for this purpose.

Okay adding a new setting seems the more acceptable solution to this then.

Hey @tetrahed, would you be interested in working on this issue? If yes, and you run into any kind of problems or anything feel free to ask them here or hopefully in a pull request :)