存档

文章标签 ‘CKEditor安装’

mediawiki安装CKEditor插件

2012年4月18日 8 条评论

下载CKEditor,解压到/var/lib/mediawiki/extensions目录下:

root@athens:/var/lib/mediawiki/extensions# ls
ckeditor  README

修改/var/lib/mediawiki/LocalSettings.php文件,在最后加上:

require_once("$IP/extensions/ckeditor/ckeditor.php");

$wgHooks['EditPage::showEditForm:initial'][] = 'showEditForm';
function showEditForm($form){
global $wgOut;
$wgOut->addScriptFile( '/extensions/ckeditor/ckeditor.js' );
$script =
"<script type=\"text/javascript\">
window.onload = function()
{
CKEDITOR.replace( 'wpTextbox1' );
};
if ( window.removeEventListener )
window.removeEventListener( 'load', mwSetupToolbar, false ) ;
else if ( window.detachEvent )
window.detachEvent( 'onload', mwSetupToolbar ) ; 
</script>";

$wgOut->addHTML($script);

return true;
}