Arty
Well-known member
- Affected version
- 2.1.0
I've attached a custom add-on that implements "test" bbcode. Its as basic as possible to demonstrate bug.
It uses template engine to render custom BBCode.
It highlights contents in red color:
	
		
is turned into this HTML:
	
	
	
		
BBCode is simple: its a PHP callback that renders template public:bbcode_test.
Contents of callback:
	
		
Contents of public:bbcode_test:
	
	
	
		
So it is very simple. Here is bug: if post is saved from quick edit, BBCode is rendered using master style instead of currently selected style.
How to test it:
				
			It uses template engine to render custom BBCode.
It highlights contents in red color:
		Code:
	
	[test]qwerty[/test]
		Code:
	
	<span style="color: red">qwerty</span>BBCode is simple: its a PHP callback that renders template public:bbcode_test.
Contents of callback:
		Code:
	
	public static function getHTML($tagChildren, $tagOption, $tag, array $options, \XF\BbCode\Renderer\AbstractRenderer $renderer)
{
    $content = $renderer->renderSubTree($tagChildren, $options);
    /* @var \XF\Template\Templater $templater */
    $templater = $renderer->getTemplater();
    $content = $templater->renderTemplate('public:bbcode_test', [
        'content' => $content
    ], true);
    return $content;
}
		Code:
	
	<span style="color: red">{{ $content | raw }}</span>So it is very simple. Here is bug: if post is saved from quick edit, BBCode is rendered using master style instead of currently selected style.
How to test it:
- Install this test add-on
- In default style edit template "bbcode_test". Change it to this:
	
	
so in master style highlight is red, in default style highlight is greenCode:<span style="color: green">{{ $content | raw }}</span>
- Go to visitor area, make sure default style is selected, create sample post:
	
	
Code:[test]qwerty[/test]
- Click "Post thread" to submit thread.
- Post will have "qwerty" in green color, as it is supposed to (because in default style it was changed to green).
- Click "Edit" link below post to show quick edit.
- Do not change anything, simply click "Save".
- Post will refresh and "qwerty" will be in red color instead of green.
Attachments
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
 
		 
 
		 
 
		
 
					
				 
						
					 
 
		 
 
		 
 
		 
 
		