- Affected version
- 2.2.15
If you have the bb-code:
[ICODE=rich][COLOR=rgb(0, 255, 255)]Test[/COLOR][/ICODE]
It is rendered in the editor as:
<p><code><span style="color: rgb(0, 255, 255);">Test</span></code></p>
And then edit the post it gets saved as:
[ICODE][COLOR=rgb(0, 255, 255)]Test[/COLOR][/ICODE]
The problem is
	
	
	
		
And 
Something like the following will work:
In
	
	
	
		
Then in
	
	
	
		
Probably can be cleaned up a little but it works
				
			[ICODE=rich][COLOR=rgb(0, 255, 255)]Test[/COLOR][/ICODE]
It is rendered in the editor as:
<p><code><span style="color: rgb(0, 255, 255);">Test</span></code></p>
And then edit the post it gets saved as:
[ICODE][COLOR=rgb(0, 255, 255)]Test[/COLOR][/ICODE]
The problem is
XF\BbCode\Renderer\EditorHtml::addDefaultTags has the following code:
		PHP:
	
	$this->addTag('icode', ['replace' => ['<code>', '</code>']]);XF\Html\Renderer\BbCode::handleTagCode just outputs [ICODE]/[code] without any css handling.Something like the following will work:
In
XF\Html\Renderer\BbCode::handleTagCode:
		PHP:
	
	public function handleTagCode($text, Tag $tag)
{
    if (preg_match('/[\r\n]/', $text))
    {
....
    }
    else
    {
        return '[ICODE'.($tag->hasClass('bbCodeInline--rich') ? '=rich' : '').']' . $text . '[/ICODE]';
    }Then in
XF\BbCode\Renderer\EditorHtml; remove the $this->addTag('icode', ['replace' => ['<code>', '</code>']]); line and specialize renderTagInlineCode in EditorHtml:
		PHP:
	
	public function renderTagInlineCode(array $children, $option, array $tag, array $options)
{
    $class = $option === 'rich' ? 'bbCodeInline--rich' : '';
    $content = $this->renderSubTree($children, $options);
    return $this->wrapHtml('<code class="'.$class.'">', $content, '</code>');
}Probably can be cleaned up a little but it works
 
 
		