Skip to main content
Topic: [1.0.9] Bug with "center" BBC (Read 2676 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[1.0.9] Bug with "center" BBC

Try this please: Center a text with the "center" BBC.

Center another line of text, but then use another BBC too for this text. The "center" BBC must be the one inside the other codes:

Code: [Select]
[color=red][center]Text[/center][/color]

If you edit this post then, the "color" BBC disappears.  :o

This happens with any BBC which outlines the "center" BBC, no matter what code or how many of them, they all disappear, only the "center" BBC stays.

A workaround can be to write all codes inside the "center" BBC. They are kept after an edit of the post. This works:

Code: [Select]
[center][color=red]Text[/color][/center]

Re: [1.0.9] Bug with "center" BBC

Reply #1

This is an old issue with a tremendous amount of crusty baggage around it.

Center as an html element is a block level tag, like a div, which means you use it to wrap other elements.  Actually in HTML5 the tag was dropped, so instead you apply center text alignment via css to ... block level elements. 

As a block level you need to outer wrap with it, not have it wrapped it with non block elements like color.  Note that browsers display it correctly either way as they seem to understand that not every user has fully read the html specifications before they use the interwebs.

ElkArte does not prevent you from incorrectly nesting the center tag in its BBC parser since the browser will show just what you expect. 

What is happening above is that the editor is removing the :incorrect: nesting (and dammit you should know all about proper nesting  :P ).  Start a new post, and try you example in source mode, toggle to wizzy and then back ... That outer tag (color, bold, italic, etc) will be removed.  I'm not sure we can stop that, but I'll take a look.


Re: [1.0.9] Bug with "center" BBC

Reply #3

And I did implement a fix for this as well and it will be in 1.0.10

Re: [1.0.9] Bug with "center" BBC

Reply #4

Interesting. How did you handle it?
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: [1.0.9] Bug with "center" BBC

Reply #5

Basically I told the editor and parser that [center]some text[/center] was not a block level and just let the browser sort it .... At least in my (limited) testing, browsers seem to back out to the previous block level and then apply the center starting there regardless of where it found the command.  Seems they just gave in and decided to match user expectations vs correct markup  :-\  Note that could be all BS as well  :D

Re: [1.0.9] Bug with "center" BBC

Reply #6

People should just use the WYSIWYG editor. It would make our lives so much easier lol.

Re: [1.0.9] Bug with "center" BBC

Reply #7

Quote from: Joshua Dickerson – People should just forget about the WYSIWYG editor. It would make our lives so much easier lol.
FTFY! :D
Bugs creator.
Features destroyer.
Template killer.

Re: [1.0.9] Bug with "center" BBC

Reply #8

If there weren't so many hacks to get it to work with the BBC it would be pretty easy.

Re: [1.0.9] Bug with "center" BBC

Reply #9

Actually, the hacks are to make BBC work with HTML, because it's HTML that has restrictions on the nesting order, but that's a technicality. :P

Dunno, I don't feel like working with plain html would be a lot much easier.
Yes, you cut the conversion, but that just means you move the problem from the toggling to the applying (that may or may not be an improvement).
Bugs creator.
Features destroyer.
Template killer.

 

Re: [1.0.9] Bug with "center" BBC

Reply #10

I think moving from square brackets to XML would make it a lot easier. There are tools that handle XML and HTML already. Start from blacklist * and then whitelist what you want to display. Then the front-end just passes XHTML to the backend and it reads it. The WYSIWYG editors that handle HTML will be able to handle this and swapping them out to find a better one will be a lot easier.