How to make it so pressing enter doesn't cause the comment to post?

Allon Prooit Posted in Beginning Developers 4 years ago

Wanting to make it so that you can have multiple lines in the comments field. I have upgraded OssnComments to include a button for submitting the comments. Would like to make it so that when you press enter you get a break and can enter comments on successive lines. How do you do this? Any thoughts?

Replies
us Allon Prooit Replied 2 years ago

Regardless, a component for 6.1 would be just fine. I plan on upgrading soon and I'm sure everybody else would like to see this function too.

Indonesian Arsalan Shah Replied 2 years ago

We don't support OSSN 5.6 anymore.

us Allon Prooit Replied 2 years ago

Ok so, after upgrading to OSSN 5.6 I found the button I created to post the comments instead the ENTER key no longer worked. I deleted the button but lost the ability to post comments altogether. Can someone please come up with a component that gives us an FB like button for posting comments instead of the ENTER or SHIFT+ENTER comment posting actuator? Thanks!

us Roman Lohov Replied 4 years ago

There is no need a component for this. We just trashed this topic badly. Here is all you need to do to make it work.

Open:
components/OssnComments/plugins/default/js/OssnComments.php

Find(there is 2 of them):

if (e.shiftKey === false) {

Change both to true

Find (there is 2 of them):

$text = $replace_tags($text, '<br>').replace(/\<br\\?>/g, "\n");

And add Before that:

$text = $replace_tags($text, '<div>').replace(/\<div\\?>/g, "<br>");
                $text = $replace_tags($text, '<br>').replace(/\<\/div\\?>/g, "<br>");

That's it. Done! Now you use Enter to make a new line, and Shift+Enter to send comment.

us Bryce alvord Replied 4 years ago

I'm curious, will you be turning this into a component?

us Roman Lohov Replied 4 years ago

I have messaged you in your site, so we dont trash this topic, as it is personal issue, not OSSN issue.

us Allon Prooit Replied 4 years ago

Ok, so I'm still at a loss for why it's not working, though I am happy with the non-breaking space i'm getting. You're using OSSN 5.2 though right, Roman Lohov? This would explain the difference between the two console readings. Also, entity/comment_add.php governs the picture uploading to comments function. I think it's just redundancy for the javascript to be there too.

us Roman Lohov Replied 4 years ago

enter image description here

Looks ok on mine. Like I said, you might have extra stuff added that stops it from working. I would contact a person who installed extra stuff for you, as he will know way more on what he(she) did.

us Roman Lohov Replied 4 years ago

php version doesn't matter on this one. I do not know what is entity for(developers please explain).

Try deleting extra stuff from entity, As I did not edit it at all.

You might have extra stuff added to your OSSN network that I don't know about. On a clean install, it works.

us Allon Prooit Replied 4 years ago

Also, what does your console say? Here's mine.enter image description here And, if anyone can help me out with the syntax error in tinymce.min.js I would be most appreciative!