Page 1 of 1

It takes too many newlines to create a line break after a card image

Posted: Thu Mar 03, 2022 8:38 pm
by spacemonaut
I'm borrowing @Neige's street fighter cards for this bug report since it's occuring in his street fighter boss thread. I'm going to demonstrate the problem, you may want to quote this post and inspect its bbcode to see what I'm going on about here.



Here's a ccimg tag with zero line breaks before the text.




One line break before the text... but this text is still on the same line as the image for some reason.





Two line breaks before the text. It's still on the same line. Why??






Three line breaks before the text. Now there's an actual new line as you read this.







For good measure, here's one with four line breaks before the text. After the third, the line breaks start behaving like normal.



It shouldn't require putting three whole linebreaks in the editor to get just one linebreak in the view. It should require only one linebreak in the editor to get one in the view.

It's not even some weird layout issue like the image is using float: left; or something like that — the bbcode parser itself is eating up the first two line breaks and completely ignoring them until I put three of them together and then it starts giving me <br> elements.

In this screenshot of my DOM inspector, note the total lack of <br> elements after the div in the "two new lines" example, and the highlighted singular <br> inserted in the "three line breaks" example.
2022-03-03_20-46-52_firefox.png

Re: It takes too many newlines to create a line break after a card image

Posted: Fri Mar 04, 2022 12:40 am
by Feyd_Ruin
Fixed.
It saw that what we were creating was a block element, so it assumed we didn't actually need the br, since it pushes to a "new line" anyways. But since that block element was actually displaying as in-line block, that was a bad assumption. Swapped to a <span> and it knows better now.
Old posts may need to be edited and resaved.

Re: It takes too many newlines to create a line break after a card image

Posted: Fri Mar 04, 2022 9:35 pm
by spacemonaut
Thank you very much!

Here's the same content as the post within a spoiler block. It works perfectly!
SPOILER
Show
Hide
Here's a ccimg tag with zero line breaks before the text.




One line break before the text... but this text is still on the same line as the image for some reason.





Two line breaks before the text. It's still on the same line. Why??






Three line breaks before the text. Now there's an actual new line as you read this.







For good measure, here's one with four line breaks before the text. After the third, the line breaks start behaving like normal.