Extension:FCKeditor (Official)

From mediawiki.org
Revision as of 18:25, 23 April 2013 by Krenair (talk | contribs) (Rejected the last text change (by 79.116.9.231) and restored revision 669164 by Kghbln)
There are currently two noteworthy alternatives to this extension:
1. WYSIWYG (this may however not support stable or legacy releases of MediaWiki at all time) and
2. WikiEditor (this is a different approach)
MediaWiki extensions manual
FCKeditor extension (Official)
Release status: experimental
Implementation Page action , Extended syntax , User rights , Skin , Ajax, Parser extension
Description Allows using the FCKeditor (WYSIWYG editor) for editing wiki pages
Author(s) FCKeditor team (Frederico Caldeira Knabben, Wiktor Walc, others)
Jack Phoenix
MediaWiki 1.16.x and 1.17.x
Database changes No
License GPL/LGPL/MPL
Download Template:WikimediaDownload/svn
  • $wgFCKEditorExtDir
  • $wgFCKEditorDir
  • $wgFCKEditorToolbarSet
  • $wgFCKEditorHeight
  • $wgFCKEditorExcludedNamespaces
Translate the FCKeditor (Official) extension if it is available at translatewiki.net
Issues Open tasks ¡ Report a bug

The FCKeditor extension enables a more intuitive "what you see is what you get" (WYSIWYG) editor when editing pages on a MediaWiki-based site. It uses a special version of the FCKeditor, a WYSIWYG editor that outputs wiki text rather than the usual HTML that caused problems for MediaWiki integrations in the past.

This extension is no longer supported by the upstream developers.[1] Current downloads through the ExtensionDistributor are broken; they do no longer contain the editor at all.

Installation

$IP stands for the Installation Path (or "directory") of your MediaWiki installation, the same directory that holds LocalSettings.php , index.php etc..

Download the extension

MediaWiki 1.20

For the extension to work on MediaWiki 1.20 edit the file FCKeditor.body.php

Around line 291, after public function onEditPageShowEditFormInitial( $form ) { insert :

global $wgFCKEditorDir, $wgFCKEditorExtDir, $wgFCKEditorToolbarSet, $wgFCKEditorHeight;

Around line 386, after var oFCKeditor = new FCKeditor( "wpTextbox1" ); insert :

var wgFCKEditorDir  = "' . $wgFCKEditorDir  . '";// extensions/FCKeditor/fckeditor/
var wgFCKEditorExtDir  =  "'.  $wgFCKEditorExtDir .'"; //  extensions/FCKeditor
var wgFCKEditorToolbarSet  = "'.  $wgFCKEditorToolbarSet . '"; // Wiki
var wgFCKEditorHeight  = "'.  $wgFCKEditorHeight .'"; // 0		
var wgScriptPath = "' .  $wgScriptPath .'";

Around line 600, replace window.removeEventListener( 'load', mwSetupToolbar, false ); with

if ( typeof mwSetupToolbar == 'undefined') { } else { window.removeEventListener( 'load', mwSetupToolbar, false );  }

You can download the ready to go version right here.

MediaWiki 1.16 and newer

For MW 1.16 and later a new version is available on svn.wikimedia.org; it's a fork of the original FCKeditor extension and it requires 1.16. In this case, the extension is complete, i.e. unlike older versions it contains the FCKeditor/fckeditor itself.

Note: If you had installed a previous version, involving a separate check-out from svn.fckeditor.net for the editor itself, you may have to remove the extensions/FCKeditor folder and check it out again from svn.wikimedia.org.

MediaWiki 1.15 and older

If you have a wiki running 1.15 or lower version of MW, you can still use the extension available from http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/FCKeditor/. The repository will go and fetch the required fckeditor. If you are a Windows user, read the SVN_Instructions for more details. On UNIX, in your $IP/extensions directory, you can type the following command to install the FCKeditor extension:

svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/FCKeditor

See FCKeditor's download page for more details. Manual modifications were required for some older versions of FCKeditor. See Manual modifications for more info.

Verify/Rename Configuration Files

Verify that the files extensions/FCKeditor/fckeditor_config.js and extensions/FCKeditor/plugins/mediawiki/fckplugin.js does exist. In case they come with .txt extension, rename the files to .js

Modify configuration file

After you've downloaded the extension and actual editor, add this line at the end of LocalSettings.php:

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

Also make sure $wgUseAjax is turned on (it is by default on newer MediaWikis).

Fix hook error

On php version (>= 5.3.0) the following error shows up with the HTTP download:

PHP Warning:  Parameter 1 to FCKeditor_MediaWiki::onCustomEditor() 
expected to be a reference, value given in 
C:\inetpub\wwwroot\Wiki_Neuro\includes\Hooks.php on line 133

To fix this, change FCKeditor.body.php:

public function onCustomEditor(&$article, &$user) { 

to

public function onCustomEditor($article, $user) { 

Note: This problem is caused by the PHP version and affects all versions of MediaWiki using the version from the HTTP download. The current 1.16.x snapshot does not produce this error.

Thanks and credits to solweig

Parameters

  • $wgFCKEditorExtDir — path to FCKeditor extension. Defaults to extensions/FCKeditor.
  • $wgFCKEditorDir — path to the actual FCKeditor. Defaults to extensions/FCKeditor/fckeditor/.
  • $wgFCKEditorToolbarSet — defaults to 'Wiki'.
  • $wgFCKEditorHeight — '0' for automatic ('300' minimum). Defaults to '0'.
  • $wgFCKEditorExcludedNamespaces — array of namespaces that FCKeditor is disabled for. Use constants like NS_MEDIAWIKI here. Defaults to an empty array.

UserOptions

Edit the file FCKeditor.php, to change these user options:

  • riched_disable
  • riched_start_disabled  : This is set to 1 by default meaning that FCKEditor is DISABLED by default.Set this to 0 to enable FCKEditor by default
  • riched_use_popup
  • riched_use_toggle
  • riched_toggle_remember_state
  1. Change the user options for new account: Manual:$wgDefaultUserOptions.
  2. Change the users' preferences: Manual:Maintenance scripts.
    - No SSH access? Look at Extension:MaintenanceShell.

Example

If you set $wgDefaultUserOptions['riched_start_disabled'] = 1; the rich editor does not get started automatically after clicking on the edit button of the page.

Useful tweaks

Auto-fill the link dialog with selection

  • Edit FCKEditor/plugins/mediawiki/dialogs/link.html
    • add this line before // oLink: The actual selected link in the editor :
var TxtSelection = FCK.Selection.GetSelection() ;
    • add this line before </body></html> :
<script type="text/javascript">document.getElementById('txtUrl').value = TxtSelection ; StartSearch() ;</script>

Change the skin

  • Get (or make) your skin folder (for example, here)
  • Put it in FCKEditor/fckeditor/editor/skins
  • Edit FCKEditor/fckeditor/fckconfig.js and change the following line :

FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' replacing default by your folder's name

Deactivate the "Paste as plain text" dialog

Consider that what you're doing most of the time (copying between wiki pages rather than from other web pages) this dialog can be a waste of time, so you can just by-pass it by changing FCKConfig.ForcePasteAsPlainText to false in FCKEditor/fckeditor_config.js

Add a button to make a redirection

How to add a button that adds #REDIRECT[[link]] with a dialog

  • add an image plugins/mediawiki/images/tb_icon_redirect.gif (16x16), for example an arrow
  • go to plugins/mediawiki/dialogs, copy link.html to redirect.html
    • in this new file, add oEditor.FCK.InsertHtml( '#REDIRECT' ) ; before // Create a new (empty) anchor.
  • edit plugins/mediawiki/fckplugin.js
    • add the following code after line 37
tbButton = new FCKToolbarButton( 'MW_Redirect', 'Redirect', FCKLang.wikiBtnRedirect || 'Insert/Edit Redirection' );
tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_redirect.gif';
FCKToolbarItems.RegisterItem( 'MW_Redirect', tbButton );
    • add the following code in the section named // Override some dialogs.
FCKCommands.RegisterCommand( 'MW_Redirect', new FCKDialogCommand( 'MW_Redirect', FCKLang.DlgRedirectWindowTitle, FCKConfig.PluginsPath + 'mediawiki/dialogs/redirect.html', 400, 250 ) );
  • edit fckeditor_config.js and add 'MW_Redirect' in the section FCKConfig.ToolbarSets['Wiki'] = , where you want to see the button

Force to refresh

When you make changes to your interface, you may get mad trying to refresh your browser, which keeps for so long the old version in cache, despite your Ctrl+F5, Shift+Refresh, etc. Here are some method that seems to work well :

  • modify "FCKeditor.php" (for example to "FCKeditor.ph") and refresh, (your browser will scream, ok), then revert to original name and refresh
  • in Firefox : go to Firefox web history, right-click on your website and chose "Forget this website", that's all

Translating

FCKeditor can be translated through translatewiki.net.

Reporting software bugs

Bugs and issues can be reported on the MediaWiki Bugzilla (select FCKeditor as the component): https://bugzilla.wikimedia.org/enter_bug.cgi?product=MediaWiki%20extensions&component=FCKeditor

You can find a list of known bugs (both open and fixed ones) here: https://bugzilla.wikimedia.org/buglist.cgi?component=FCKeditor&product=MediaWiki%20extensions

Ugly image for category button

I noticed that the category button image has suddenly become ugly, from older versions to newer.

You can just compare...

... and you can repair it by copying the normal one to FCKeditor/plugins/mediawiki/images --Varlin 17:50, 3 August 2011 (UTC)

Wikis using this extension

References