PDA

View Full Version : Custom Paragraph Indent BBCode


It's Damn Real!
06-19-2014, 02:15 AM
I'm trying to provide a QUOTE alternative for my forum where users can use a custom BBCode that will both indent any pasted text, as well as add a background color to that text so that it appears like so:


Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Nullam tristique lorem a tortor pulvinar, a consequat magna dictum.

Integer egestas eget ligula.


This is obviously just dummy text, but the idea is to allow for this new BBCode to serve in place of what we've traditionally used, which is the standard QUOTE code, which doesn't retain the text from the original post if that post is quoted by a user due to vBulletin's lack of quote level support.

I'm able to create a custom BBCode for a background color, but I want to make it as easy as possible on my users by automatically including an INDENT within that new custom code so that they aren't forced to include both the new code as well as a traditional indent.

Any help is much appreciated.

kh99
06-19-2014, 08:36 AM
I believe the css for indenting the first line 20 pixels (for example) would be
text-indent: 20px;

so the replacement html would be something like
<span style="text-indent: 20px;">{param}</span>

It's Damn Real!
06-19-2014, 12:31 PM
kh99,

The issue is that I'd also like to add a background text color to all the text being typed or pasted into this custom code so it stands out from any other type.

For example, if a user shares an article with a snippet from it, I'd like the custom quoted text from it to essentially be highlighted so that when that user then posts their opinion or thoughts on it, the two appear very differently in the post, so as not to confuse a users' opinion with being part of the article.

kh99
06-19-2014, 12:41 PM
OK, you can make the replacement include a background color, like:
<span style="text-indent: 20px; background-color:blue">{param}</span>

Maybe you want the background color an option on the bbcode, which you could do, but with this replacement it would allow a user to put whatever css attributes they want in there, which might not be good (you could for example use absolute positioning to put something anywhere on the page you want). It might be possible to use an old pre-css attribute to set the background color and avoid that problem (although I don't remember if there is one or what it is).