FCKeditor integration guide

From MediaWiki+FCKeditor

Jump to: navigation, search

[edit] Installation

[edit] Download and extract necessary files

First of all, you need to install FCKeditor as MediaWiki extension:

Download FCKeditor extension, unpack it and place in the extensions directory.

Your directory structure should look similar to the following one: 

|- ..
|- docs
|- extensions
   |- ...
   |- FCKeditor
      |- css
      |- fckeditor
      |- plugins
      |- FCKeditor.body.php
      |- fckeditor_config.js
      |- FCKeditor.i18n.en.php
      |- ... 
      |- FCKeditorParser.body.php 
      |- FCKeditorParserOptions.body.php 
      |- FCKeditor.php 
      |- FCKeditorSajax.body.php 
      |- FCKeditorSkin.body.php 

Please note that inside FCKeditor directory there is another fckeditor directory. FCKeditor holds the whole extension, whilst fckeditor inside holds the rich text editor itself. If you decide some day to upgrade the editor (not the whole MediaWiki extension), remember to extract it into that fckeditor subdirectory.

[edit] Modify configuration file

After you have put the FCKeditor extension in the correct directory, add this line at the end of LocalSettings.php:

require_once $IP . "/extensions/FCKeditor/FCKeditor.php";

[edit] Manual modifications

[edit] EditPageBeforeEditConflict

In the latest MediaWiki (1.13, SVN version), new hook EditPageBeforeEditConflict is already available. This hook is required to fix WikiText/HTML problems when conflict occurs.

MediaWiki 1.10 - 1.12 users have to add this hook manually.

In includes/EditPage.php, at the end of showEditForm function, find this code:

$wgOut->addHtml( wfHidden( 'wpAutoSummary', $autosumm ) );

if ( $this->isConflict ) {

and replace with:

$wgOut->addHtml( wfHidden( 'wpAutoSummary', $autosumm ) );

if ( $this->isConflict && wfRunHooks( 'EditPageBeforeConflictDiff', array( &$this, &$wgOut ) )) {

[edit] SanitizerAfterFixTagAttributes

In the latest MediaWiki (1.13, SVN version), new hook SanitizerAfterFixTagAttributes is already available. This hook is required to keep templates defining tag attributes.

MediaWiki 1.10 - 1.12 users have to add this hook manually.

In includes/Sanitizer.php, at the end of fixTagAttributes function, find this code:

return count( $attribs ) ? ' ' . implode( ' ', $attribs ) : '';

and add this before the last line (with return statement):

if ( !wfRunHooks( 'SanitizerAfterFixTagAttributes', array( $text, $element, &$attribs ) ) ) {
	return '';
}

at the end you should have:

if ( !wfRunHooks( 'SanitizerAfterFixTagAttributes', array( $text, $element, &$attribs ) ) ) {
	return '';
}
return count( $attribs ) ? ' ' . implode( ' ', $attribs ) : '';

[edit] Note for SVN users

The editor is not included in the SVN repository, it holds the pure extension only.

You have to download the FCKeditor from http://www.fckeditor.net/download or obtain the latest FCKeditor from SVN (according to the instructions) and place him into extensions/FCKeditor/fckeditor directory.

[edit] Tips & Tricks

Q: Is it possible to add a button to change text color?

A: To enable buttons to change font color in the toolbar, do the following:

  • open fckeditor_config.js file (located inside of extensions/fckeditor directory)
  • uncomment two buttons:
    ['TextColor','BGColor'],
  • save the file, clear your browsers cache
  • done!
Personal tools