Fixed Select quoting an ordered list changes it to an unordered one

With the way select-to-quote has to work, we essentially have to use Javascript to tell us which content is selected vs when clicking on "Reply" we can just pull the quote content from the database, so that's why there's a difference in behaviour.

The problem arises when select to quote literally consists of:
Code:
<li>Item 1</li>
<li>Item 2</li>
Our HTML to BB code system parses the HTML string into tags and if it comes across a list item tag that doesn't have a list (ul / ol) parent then it just wraps it in a ul tag to make it a valid.

Therefore, what you end up with is:
Code:
[LIST]
[*]Item 1
[/LIST]

[LIST]
[*]Item 2
[/LIST]
So I've made a few changes here. The first, is that the BB code renderer now outputs a data attribute containing the list type (either ol or ul) so that the HTML to BB code renderer ends up seeing:
Code:
<li data-xf-list-type="ol">Item 1</li>
<li data-xf-list-type="ol">Item 2</li>
I've also added a pre-filter step in the HTML to BB code renderer so that if the HTML string starts with <li> and ends with </li> then we will wrap it in a list tag, the type of which determined by the data attribute on the list items.
 
Back
Top Bottom