Extension:WYSIWYG

The WYSIWYG extension provides more intuitive page editing on a MediaWiki-based site. When this extension is installed, the tab 'Edit' in the command bar on top of every page leads directly in the wysiwyg editing mode.

Features of the WYSIWYG extension
The WYSIWYG extension supports:
 * Importing and insertion of tables and images; and formatting enumerations, font style, etc.; and links
 * Real copy and paste without postprocessing
 * Working with the known Word-like toolbar arrangement
 * Special characters
 * Real time spell-checking with recommend function
 * Undo and redo, and find and replace

Download

 * WYSIWYG (dependencies, download, help)

NOTE!

Wikitext mode: toggle- link and WikiEditor
WikiEditor which comes with bundle #6 works with MW>=1.25. If you have other versions of MW and WikiEditor add following lines into these two files:


 * In file LocalSettings.php:


 * In file extensions/WikiEditor/modules/ext.wikiEditor.toolbar.js (as last lines before ending "} );":

For more information about additional settings of LocalSettings.php etc. with MW>=1.22 and #6 bundle, see README.md (on github -page).

Customize the toolbar
Everything is explained here.

Disable for some namespaces
To disable WYSIWYG for some namespaces (for example, here Mediawiki), add the following code in your LocalSettings.php :

$wgFCKEditorExcludedNamespaces = array(NS_MEDIAWIKI);

To set default preferences while letting users chose to use WYSIWYG on certain namespaces :

$wgDefaultUserOptions['riched_disable_ns_mediawiki'];

To hide from preferences the checkboxes relative to the namespaces, comment these lines.

Style the content of the editor
Two solutions :
 * 1) Edit the file ckeditor/contents.css
 * 2) Point to the css file of your choice, adding this line to ckeditor/config.js :

config.contentsCss = 'path/to/your/file.css';

Config "Paste as ..."
When clicking "Paste as..." button under Firefox, you may get a popup telling your browser can't access your clipboard. This is a security protection, but you can configure your browser so that it makes an exception for your wiki. Thus, you will be able to paste in one click, with no need to paste in the dialog field and then validate. See here.

Cleaning some tags
CKeditor functions AllowedContent and DisallowedContent are supposed to do that, but do not work (TEST: these should should work with branch wysiwyg_mw127_459, Version 1.5.6_0 [B551+14.07.2016]).

You can add some regexp to play this role. For example, if you don't want to allow color styles, you can add here the following lines :

data = data.replace(/\bcolor:[^;"']*;?/gi, '' );

Remove advanced tab in table dialog
Add these lines in config.js : (included in #6 bundle >= Version 1.5.6_0 [B551+11.06.2016])

CKEDITOR.on( 'dialogDefinition', function( ev ) {    var dialogName = ev.data.name;     var dialogDefinition = ev.data.definition;     if((dialogName=='table')||(dialogName=='tableProperties')) { dialogDefinition.removeContents('advanced'); }         });

Improvements
Modifications (#5 and #6 refer to Download section above)
 * Buttons to create a references (footnotes): and (incl. in #5 and #6)
 * Fixed Images dialog (parameters) (incl. in #5 and #6)
 * Button to add ... in one click in order to convert text as target link (incl. in #5 and with additional modifications in #6)
 * Autofilling of the link dialog with selected text, and autosearch] (incl. in #5 and with additional modifications in #6)
 * Dialog to handle categories. Category dialog supporting hierarchical categories #6.
 * Display category name in WYSIWYG beside the "C" icon (patch here, included and further modified here Version 1.5.6_0 [B551+01.09.2015]) (screenshot here)(thread here).
 * [//en.wikipedia.org wikipedia] is considered as external link (incl. in #6)
 * tags are not deleted anymore. Math -tags, gallery- and hovergallery- tags (HoverGallery ext.), poll- and ajaxpoll- tags (poll- and ajaxpoll ext.) as well as contents of all other unknown mediawiki tags should now be possible to enter/update using tag -dialog of wysiwyg (incl. in #6)
 * Edit text with paragraph format "Formatted" (pre- and syntaxhighlight -tags) directly as text in wysiwyg mode (skip using special -dialog). #6 Version 1.5.6_0 [B551+01.09.2015]). (Github#50, test version in branch CKeditor_v4_Nowiki-Synt-Pre)
 * Use of resourceloader (forced with MW 1.26.xx) of MW (branch wysiwyg_mw126_rsl458 is using WYSIWYG.php, branch wysiwyg_mw127 is using wfLoadExtension)
 * Show references in wysiwyg editing mode as text (Version 1.5.6_0 [B551+08.07.2016]). Show them as "widgets" which can be dragged and dropped (branch wysiwyg_mw127_459, Version 1.5.6_0 [B551+20.07.2016].).

Possible customizations
.ImagePreviewBox img { max-height: 200px; max-width: 300px; } .ImagePreviewBox { overflow: unset!important; }
 * Disable search for images in link dialog (incl. in #5)    Question: Is this necessary modification? You can already now specify namespace as search criteria in link dialog using ":", f.ex. keying in "image:eifel" (without quotes) will search only image names starting with string "eifel". Other namespaces works similarly. Answer: Personaly, I don't use [[Media: ]], and I don't want images to appear in the search list of link dialog.
 * Hide checkbox "Open rich editor in a popup" in Special:Preferences : comment these lines (included inbranch wysiwyg_mw127_459, versions >= 1.5.6_0 [B551+14.07.2016].)
 * Tables :
 * summary attribute is not supported anymore in HTML5, and is of little use. I suggest to remove it
 * Remove infotip displayed on editor in wikitext view : see here Solved:No need to edit core files of CKeditor, included in versions >=1.5.6_0 [B551+21.07.2016], branch wysiwyg_mw127_459
 * Image dialog enhancement (patch here) :
 * Add a button in dialog to reset to default size
 * Add a button in dialog to lock size ratio
 * Display image size by default in the dialog width/height input
 * if you type exactly the file name in the input, the image preview is loaded instantly (no need to click on the ImgList)
 * if you tick upright checkbox, the fields height and width are cleared
 * Fix a Firefox line wrap bug (patch)(thread) Fixed:This is not anymore an issue after upgrading CKeditor in versions >=1.5.6_0 [B551+07.07.2015]
 * In the image dialog, fit image preview and remove scrollbars with this css :
 * Implement Footnotes (ckeditor addon) to handle footnotes with WYSIWYG.    QUESTION: Is this really needed? ...because there is Cite- extension of MW available and WYSIWYG supports it using - and - tags). Ref- and References- elements can now be dragged and dropped in editor (branch wysiwyg_mw127_459, versions >= 1.5.6_0 [B551+21.07.2016]).
 * Make AllowedContent and DisallowedContent work. TEST: After removing custom dataprocessor definiton of Wysiwyg ACF should now work with branch wysiwyg_mw127_459, versions >= 1.5.6_0 [B551+21.07.2016]. At this moment all kind of content is allowed by setting "config.allowedContent = true;" of config.js.

Todo

 * Ability to pick up available templates in a list (like old fckeditor)
 * Images :
 * Fix breaking of captions format
 * Make image captions appear in preview mode Github#53

Known incompatibilities

 * FileLink extension does not work with wysiwyg extension.
 * Issues with Preloader extension (#6)
 * When loading a template from Preloader, formatting may be stripped from header and thematic break tags. For example, Title and  return only plain, black === Title === and, with no formatting. It is unknown whether this issue occurs with other tags, but appears likely. Github#27

Development Repositories
If anyone is interested in developing the extension further, there are three known repositories created by users:


 * "WYSIWYG" wikimedia.org repository from Wingsofcourage (#1 of Download section above)
 * "CKEditor in MediaWiki" github.com repository from Ciges (#2 of Download section above)
 * Mediawiki-wysiwyg github.com repository (#6 of Download section above).

See the discussion/talk page to get in touch with the owners of these repositories.