Extension:FCKeditor (Official)

Intro
This extension enables a more intuitive WYSIWYG editor when editing pages on a Mediawiki-based site. It uses a special version of the FCKeditor WYSIWYG editor that outputs wiki text rather than the usual HTML that caused problems for Mediawiki integrations in the past. See the following link for a working example of this extension in action: http://mediawiki.fckeditor.net/index.php/Main_Page.

It is being jointly developed by the FCKeditor authors and Wikia.

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

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

Your directory structure should look similar to the following one: |- ..  |- ...   |- 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 FCKeditor (not the whole MediaWiki extension), remember to extract it into that fckeditor directory.
 * - docs
 * - extensions
 * - images

Then add this line at the end of LocalSettings.php: require_once $IP. "/extensions/FCKeditor/FCKeditor.php";

Patches
We are doing everything we can to avoid interferences in mediawiki source files. Currently, only two files needs to be "hacked" to integrate FCKeditor into Mediawiki (one is optional). (Tested with MediaWiki 1.10.1 and MediaWiki 1.11.0)

includes/EditPage.php (required)
This change had to be made to make "Show preview" feature work properly.

getPreviewText

Before: global $wgOut, $wgUser, $wgTitle, $wgParser; After: global $wgOut, $wgUser, $wgTitle, $wgParser, $wgRequest; Before: wfProfileIn( $fname );

if ( $this-&gt;mTriedSave &amp;&amp; !$this-&gt;mTokenOk ) { After: wfProfileIn( $fname );

if ($wgUser-&gt;getOption( 'showtoolbar' ) &amp;&amp; !$wgUser-&gt;getOption( 'riched_disable' ) &amp;&amp; !$this-&gt;previewOnOpen ) { $oldTextBox1 = $this-&gt;textbox1; $this-&gt;importFormData( $wgRequest ); }

if ( $this-&gt;mTriedSave &amp;&amp; !$this-&gt;mTokenOk ) { Before: wfProfileOut( $fname ); return $previewhead. $previewHTML; After: if ($wgUser-&gt;getOption( 'showtoolbar' ) &amp;&amp; !$wgUser-&gt;getOption( 'riched_disable' ) &amp;&amp; !$this-&gt;previewOnOpen ) { $this-&gt;textbox1 = $oldTextBox1; }

wfProfileOut( $fname ); return $previewhead. $previewHTML;

includes/Parser.php (required)
This change had to be made to correctly convert text with leading space.

doBlockLevels

Before: $output .= $this-&gt;closeParagraph.'&lt;pre&gt;'; After: $output .= $this-&gt;closeParagraph.'&lt;pre class="_fck_mw_lspace"&gt;';

includes/SpecialPreferences.php (optional)
This patch creates "Rich Editor" tab in "my preferences" section. It is not required for FCKeditor to work. If you don't add this patch, all configurable options will be in "Misc" tab, that's all.

mainPrefsForm

Before: global $wgLivePreview; $wgOut-&gt;addHTML( '&lt;fieldset&gt;&lt;legend&gt;' . wfMsg( 'textboxsize' ) . '&lt;/legend&gt; &lt;div&gt;' . wfInputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this-&gt;mRows ) . ' ' . wfInputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this-&gt;mCols ) . "&lt;/div&gt;" . $this-&gt;getToggles( array( 'editsection', 'editsectiononrightclick', 'editondblclick', 'editwidth', 'showtoolbar', 'previewonfirst', 'previewontop', 'minordefault', 'externaleditor', 'externaldiff', $wgLivePreview ? 'uselivepreview' : false, 'forceeditsummary', ) ) . '&lt;/fieldset&gt;' ); After: global $wgLivePreview; $wgOut-&gt;addHTML( '&lt;fieldset&gt;&lt;legend&gt;' . wfMsg( 'textboxsize' ) . '&lt;/legend&gt; &lt;div&gt;' . wfInputLabel( wfMsg( 'rows' ), 'wpRows', 'wpRows', 3, $this-&gt;mRows ) . ' ' . wfInputLabel( wfMsg( 'columns' ), 'wpCols', 'wpCols', 3, $this-&gt;mCols ) . "&lt;/div&gt;" . $this-&gt;getToggles( array( 'editsection', 'editsectiononrightclick', 'editondblclick', 'editwidth', 'showtoolbar', 'riched_disable', //add new tab (Rich Editor) 'previewonfirst', 'previewontop', 'minordefault', 'externaleditor', 'externaldiff', $wgLivePreview ? 'uselivepreview' : false, 'forceeditsummary', ) ) . '&lt;/fieldset&gt;' );

if (!$wgUser-&gt;getOption( 'riched_disable' )) { $wgOut-&gt;addHTML( '&lt;fieldset&gt;&lt;legend&gt;' . wfMsg( 'textrichditor' ) . '&lt;/legend&gt;' . $this-&gt;getToggles( FCKeditor_Mediawiki::$nsToggles ) . '&lt;/fieldset&gt;' ); }
 * 1) FCKeditor
 * 2) load FCKeditor settings into separate tab