Merge urls which span lines

Xon

Well-known member
Affected version
2.2.11
XF2 merges a number of bb-codes which span lines to workaround <br> vs <p>. the URL bb-code isn't handled, despite font/size/color being handled.

One of our users has noticed another consequence of XenForo's usage of $.FroalaEditor.ENTER_P.

Consider this BB code:
Code:
[quote][url=https://www.xenforo.com/]Line 1
Line 2
Line 3
Line 4
Line 5[/url][/quote]

Now let the editor convert this BB code into HTML:

HTML:
<blockquote>
<p><a href="https://www.xenforo.com/" target="_blank">Line 1</a></p>
<p><a href="https://www.xenforo.com/" target="_blank">Line 2</a></p>
<p><a href="https://www.xenforo.com/" target="_blank">Line 3</a></p>
<p><a href="https://www.xenforo.com/" target="_blank">Line 4</a></p>
<p><a href="https://www.xenforo.com/" target="_blank">Line 5</a></p>
</blockquote>

As you can see, the link is split into 5 links, one per line. Since <a> elements cannot contain <p> elements (which XenForo uses to represent line-breaks), XenForo had no choice but to split the link up in this way. But this is not what the user expected to happen. :)

It looks like It is just a matter of editing the #(\[(font|color|size)... regex in _postRender to include the url tag.
 
It looks like It is just a matter of editing the #(\[(font|color|size)... regex in _postRender to include the url tag.
I can confirm that this does the trick (though I don't know enough about this code to say anything about unwanted side-effects).
 
Back
Top Bottom