Anyone wanna help me find a bug?

+3 Bucky Roberts · July 21, 2014
There is a bug in the forum that's causing an unwanted "<br/>" to appear between list items. Look at the source code for this list in your browser:


  • item1

  • item2

  • item3



Here is the file that handles our BBCode/HTML conversion. If you can find it, let me know!

https://buckysroom.org/js/sceditor/jquery.sceditor.bbcode.js

Post a Reply

Replies

Oldest  Newest  Rating
+4 Waseem Hassan · July 21, 2014
The problem is with the convertToHTML function. As you write in the WYSIWYG editor, whenever you press the enter key, it renders it as a tokenType.newline as in that function and it includes even when you write HTML tags, try writing this and it won't produce the <br> tags.
<ul><li>Item1</li><li>Item2</li><li>Item3</li></ul>
Hope this helps.
+1 Darius Rapalis · July 21, 2014
That JS file is very confusing :/ I'm not that experienced in js :/ but I may guess the problem by asking a question. I belieave that whem message is being posted thoose <p></p> in message preview is being converted into <br>, is it happening with \n too? because if it is than there's your problem. 
+1 Bucky Roberts · July 21, 2014
Yes, I think so. But I can't find exactly where. 
+1 Bucky Roberts · July 21, 2014
Yep, you are right. Thanks!
+1 Waseem Hassan · July 21, 2014
Anytime Bucky :)
By the way, love your tutorials!
0 J.D Gauchat · July 21, 2014
It's funny. I was having the same exact problem with one of Amazon's systems. They replace all the line breaks \n with <br> tags without checking if there were other HTML tags in the text that were generating new lines. So, don't worry Bucky, if Amazon have the same problem, that means you're on the right track :-)

As someone mentioned, the problem is on the line 
pasteddata = pasteddata.replace(/(<br[\s//]?>)/ig, "\n");
0 J.D Gauchat · July 21, 2014
It's right, sorry, my mistake!
  • 1

Javascript

106,967 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators