我会建议你如何添加一些内联样式,你可以继续使用相同的方法编辑器类位于 root/libraries/joomla/html/editor.php
绕线你会发现显示功能
public function display($name, $html, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null, $params = array())
{
...
...
$width = str_replace(';', '', $width);
$height = str_replace(';', '', $height);
// Initialise variables.
$return = null;
$args['name'] = $name;
$args['content'] = $html;
$args['width'] = $width;
$args['height'] = $height;
$args['col'] = $col;
$args['row'] = $row;
$args['buttons'] = $buttons;
$args['id'] = $id ? $id : $name;
$args['event'] = 'onDisplay';
...
}
我会尝试传递我的内联样式
public function display($name, $html, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null, $params = array(),$inlinestyles){
...
$args['inlinestyles'] = $inlinestyles;
...
}
现在我们必须编辑位于 root/plugins/editors/jce/jce.php 中的 jce.php 文件
正如您在参数事件中看到的,我们将更改 onDisplay 事件
108号线附近
public function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null) {
...
return $editor;
}
现在我们将更改此函数并使用 JDocument 来解析我们的样式
public function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null,$inlines) {
//blah blah some code
//here comes the fun part
if($inlines){
$document =& JFactory::getDocument();
$document->addStyleDeclaration($inlines);
}
} //end of ondisplay
现在在您的组件中,您必须调用您的编辑器,因为它记录在 Joomla 的文档中
$inlines= 'BODY {'
. 'background: #00ff00;'
. 'color: rgb(0,0,255);'
. '}';
$editor = JFactory::getEditor();
echo $editor->display("jobdesc", ""/*$itemData['body']*/, "400", "100", "150", "10", 1, null, null, null, array('mode' => 'advanced'),$inlines);
http://docs.joomla.org/JFactory/getEditor