Snog
Well-known member
OK, here's my problem...
I've extended formatter/Base.php to add 3 new BBCodes and that works perfectly. The new BBCodes are displayed properly in posts.
When I edit a post with the custom BBCodes in it I get this...
I figured that could be solved by extending the formatter/Wysiwyg.php with this code..
When that code is active, all formatting with the custom BBCodes in the post is lost in the editor.
Am I missing something, or doing something incorrectly?
I've extended formatter/Base.php to add 3 new BBCodes and that works perfectly. The new BBCodes are displayed properly in posts.
When I edit a post with the custom BBCodes in it I get this...
I figured that could be solved by extending the formatter/Wysiwyg.php with this code..
Code:
<?php
class Snog_MyMod_BbCode_Formatter_Wysiwyg extends XFCP_Snog_MyMod_BbCode_Formatter_Wysiwyg
{
public function getTags()
{
if ($this->_tags !== null)
{
return $this->_tags;
}
$tags = parent::getTags();
$tags['mainbox'] = array(
'hasOption' => false,
'callback' => array($this, 'renderTagMainbox')
);
$tags['lbox'] = array(
'hasOption' => false,
'callback' => array($this, 'renderTagLbox')
);
$tags['rbox'] = array(
'hasOption' => false,
'callback' => array($this, 'renderTagRbox')
);
foreach ($tags AS $tagName => &$tag)
{
if (in_array($tagName, $this->_undisplayableTags))
{
$tag['callback'] = array($this, 'renderTagUndisplayable');
unset($tag['trimLeadingLinesAfter'], $tag['stopLineBreakConversion']);
}
else if (isset($this->_tagReplacements[$tagName]))
{
$tag = array_merge($tag, $this->_tagReplacements[$tagName]);
if (isset($this->_tagReplacements['replace']))
{
unset($tag['callback']);
}
}
}
return $tags;
}
public function renderTagMainbox(array $tag, array $rendererStates)
{
$text = $this->renderSubTree($tag['children'], $rendererStates);
return '<div>' . $text . '</div>';
}
public function renderTagLbox(array $tag, array $rendererStates)
{
$text = $this->renderSubTree($tag['children'], $rendererStates);
return '<div style="width:200px;float:left;display:block;vertical-align:top;">' . $text . '</div>';
}
public function renderTagRbox(array $tag, array $rendererStates)
{
$text = $this->renderSubTree($tag['children'], $rendererStates);
return '<div class="message messageText" style="height:auto;text-align:left;vertical-align:top;overflow:hidden;">' . $text . '</div>';
}
}
When that code is active, all formatting with the custom BBCodes in the post is lost in the editor.
Am I missing something, or doing something incorrectly?
Last edited: