Extension:FCKeditor (by FCKeditor and Wikia)

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
FCKeditor extension by FCKeditor and Wikia

Release status: beta

Implementation Page action, Extended syntax, User rights, Skin, Ajax
Description using the FCKeditor (WYSIWYG editor) for editing wiki pages
Author(s) FCKeditor and Wikia
MediaWiki 1.10+
License GPL/LGPL/MPL
Download Nightly build
Example Sandbox

Contents

[edit] 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.

[edit] Installation

Full details for installing FCKeditor are available at http://mediawiki.fckeditor.net/index.php/FCKeditor_integration_guide.

[edit] Download the extension

First of all, you need to download and install the MediaWiki extension. Currently you can download this through SVN or get it from: http://mediawiki.fckeditor.net/nightly/svn/mediawiki_fckeditor_ext_N.zip (Size: 1,2 MB). The extension does not contain the editor itself. If you are a UNIX user, you must install the subversion package. If you are a Windows users, read the SVN_Instructions for more details.

On UNIX, you can type the following commands (you must first set the variable MEDIAWIKI_HOME with the base path of your MediaWiki installation ):

$ cd $MEDIAWIKI_HOME
$ cd extensions
$ svn checkout http://svn.fckeditor.net/MediaWiki/trunk FCKeditor
# (wait a few minutes)

# For security purposes, you should remove the .svn files.
# You can also configure your webserver to deny access to .svn directories
$ find . -name .svn -print | xargs rm -rf {}
# If you don't keep .svn directory you can directly use 
$ cd $MEDIAWIKI_HOME
$ cd extensions
$ svn export http://svn.fckeditor.net/MediaWiki/trunk FCKeditor
# (wait a few minutes)
 


Now your directory structure should look similar to the following one: 

$ cd $MEDIAWIKI_HOME
$ tree
|- ..
|- docs
|- extensions
   |- ...
   |- FCKeditor
      |- css
      |- <b>fckeditor</b>
      |- 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 

Inside the directory extensions/FCKeditor is a directory named fckeditor. The editor is already installed in this directory but you can download and install last version of the editor.


[edit] Verify/Rename Configuration Files

Verify the files fckeditor_config.js and \plugins\mediawiki\fckplugin.js exist. In case they come with .txt extension, rename the files to .js extension.

[edit] Download the editor

Download the editor. You can get this via normal HTTP, via FTP, or via SVN. Examples are given for HTTP and SVN.

Via HTTP, you can get the latest stable version, or you can get the latest nightly build. The example below is on UNIX and for the nightly build (http://www.fckeditor.net/nightly/FCKeditor_N.tar.gz):

 $ cd /tmp
$ wget http://www.fckeditor.net/nightly/FCKeditor_N.zip
$ cd $MEDIAWIKI_HOME
$ cd extensions/FCKeditor
$ unzip /tmp/FCKeditor_N.zip

[edit] Modify configuration file

Place the contents of the FCKeditor folder you have just downloaded in to the folder 'extensions/FCKeditor/'. After you have put the FCKeditor extension in the correct directory, add this line at the end of LocalSettings.php:

require_once( "extensions/FCKeditor/FCKeditor.php" );

Also make sure $wgUseAjax is turned on:

$wgUseAjax = true;

[edit] Manual modifications (only for 1.10 - 1.12 users)

[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 replace it with:

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

[edit] More information

For more information please refer to the official site of the project

Personal tools