- Affected version
- 2.2.11
When using the 'insert spoiler' (and bb-code which uses
Given this bb-code in the rich-text editor:
line1
[b]line2[/b]
line3
line4
Drag-select line2/line3, and select insert spoiler.
This will result in the following html:
<p>line1</p
<p><strong>[SPOILER="Title"]line2</strong></p>
<p>line3[/SPOILER]</p>
<p>line4</p>
This generates the following bb-code:
line1
[b][SPOILER="Title"]line2[/b]
line3[/SPOILER]
line4
Which is rendered as:
line1
[B][SPOILER="Title"]line2[/SPOILER][/B][SPOILER="Title"]
line3[/SPOILER]
line4
The core of the issue is
wrapSelectionText
) this can result in unexpectedly broken bb-code.Given this bb-code in the rich-text editor:
line1
[b]line2[/b]
line3
line4
Drag-select line2/line3, and select insert spoiler.
This will result in the following html:
<p>line1</p
<p><strong>[SPOILER="Title"]line2</strong></p>
<p>line3[/SPOILER]</p>
<p>line4</p>
This generates the following bb-code:
line1
[b][SPOILER="Title"]line2[/b]
line3[/SPOILER]
line4
Which is rendered as:
line1
[B][SPOILER="Title"]line2[/SPOILER][/B][SPOILER="Title"]
line3[/SPOILER]
line4
The core of the issue is
XF.EditorHelpers.wrapSelectionText
needs to be aware of formatting to some degree to avoid the bb-code plain text causing issues when it crosses a <p>
tag boundary.
Last edited: