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?
Many thanks for your hard work Z Man. I tried the new coding but it did not work for me. Perhaps due to a caching issue... I'm using cloudflare for my site now. So, there are no deletions? Just your additions to the code?
a pure <enter> is enclosing each newline into divs.
Maaaan, I spent at least 2 hour playing with that line. All I was getting is div's. Had no idea why they were showing up. I see now.
Ok, so changing false to true lets you use enter for successive lines but doesn't put any spacing between them. How do you recode the js to put a break <br>or new line after each line of text?
Well, finally I had a little time to have a closer look ....
In opposite to <shift><enter> which is inserting a <br> into the text
a pure <enter> is enclosing each newline into divs.
That is, a text with 2 newlines will be encoded like
Line1
<div>Line2</div>
<div>Line3</div>
and since the current replacement code isn't prepared to handle a construct like that, all divs are simply removed - and Line1Line2Line3 will be submitted and saved. ;)
So far for the explanation why a simple change from false to true can't work.
Thus, to get things working as requested, we need to take extra care about the divs like
$text = $replace_tags($text, '<div>').replace(/\<div\\?>/g, "<br>");
$text = $replace_tags($text, '<br>').replace(/\<\/div\\?>/g, "<br>");
and insert these 2 lines before the old and final <br> to newline replacement
$text = $replace_tags($text, '<br>').replace(/\<br\\?>/g, '\n');
in order to achieve a reversed logic:
a simple <enter> gives a newline and <shift><enter> will save the comment
Allon Prooit, Naser Naser I have asked this question on stackoverflow a minute ago. Chances anyone would answer is about 1%. But who knows.
Allon Prooit that, I have no idea, as im not a JS expert. Its a question for developers or stackoverflow.
Ok, so changing false to true lets you use enter for successive lines but doesn't put any spacing between them. How do you recode the js to put a break <br>or new line \n after each line of text?
The thing is, to true(2 places). js/OssnComments.php
if (e.shiftKey === false)
SOPOSE TO do what you wanted to accomplish.
Thanks for the suggestions. Will check out the js file shortly. As for the button, I got the upgrade from Bansh33... He has a number of components for sale. You can reach him at [removed] ... If you want to see the button in action, check out my site... 3NCIRCLE N37WORK.
The thing is, you can disable enter post by setting js file to true(2 places).
if (e.shiftKey === false)
Only problem is when you post the
lol
lol
it will show as:
lol lol
Just play arond that JS file.
What button did you create for submitting?
Due to the many requests in the past for additonal features and components we have decided to develope a premium version. Features like Hashtags, Videos, Polls, Events, Stories, Link Preview, etc included in it.
$199 (Life Time)