Extension:MsWikiEditor

From Linux Web Expert

MediaWiki extensions manual
MsWikiEditor
Release status: stable
Implementation User interface
Description Easily add or remove buttons to the WikiEditor
Author(s) Martin Schwindl, Martin Keyler
Maintainer(s) Sophivorus
Latest version 3.2 (2019-07-10)
MediaWiki 1.21+
PHP 5.3+
License GNU General Public License 2.0 or later
Download
  • $wgMSWE_remove
  • $wgMSWE_add
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Translate the MsWikiEditor extension if it is available at translatewiki.net

The MsWikiEditor extension allows you to easily add or remove buttons from the WikiEditor from your LocalSettings.php

Installation

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/MsWikiEditor</tvar>|Download]] and move the extracted <tvar name=name>MsWikiEditor</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MsWikiEditor
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'MsWikiEditor' );
    
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

Usage

To add a button, add its definition to the $wgMSWE_add array in your LocalSettings.php, using the following format:

$wgMSWE_add['button-key'] = [ 'Name of the button', 'Default content', 'Left wrapper', 'Right wrapper', 'URL or path to the image', 'toolbar-section', 'section-group' ];

If the toolbar section and section group are not specified, the button will be added to the "insert" group of the "main" section. Here are a few working examples:

$wgMSWE_add['date'] = [ 'Current date', date( 'Y-m-d' ), '', '', 'extensions/MsWikiEditor/images/date.png' ];
$wgMSWE_add['gallery'] = [ 'Gallery', '<gallery>\\n', 'File:Example1.jpg|Caption1\\nFile:Example2.png|Caption2\\n', '</gallery>', 'extensions/MsWikiEditor/images/gallery.png' ];
$wgMSWE_add['strike'] = [ 'Strike', '<strike>', 'Text', '</strike>', 'extensions/MsWikiEditor/images/strike.png' ];
$wgMSWE_add['email'] = [ 'Email', '[mailto:', 'address@domain.com', ']', 'extensions/MsWikiEditor/images/email.png' ];
$wgMSWE_add['mslink'] = [ 'MsLink', '{{#l:', 'Filename.ext', '}}', 'extensions/MsWikiEditor/images/link.png' ];
$wgMSWE_add['template'] = [ 'Your template', '{{Your template|', 'Parameters', '}}', 'extensions/MsWikiEditor/images/template.png' ];
$wgMSWE_add['signature'] = [ 'Signature', '--~~~~', '', '', 'extensions/MsWikiEditor/images/signature.png' ];
$wgMSWE_add['attention'] = [ 'Attention', '{{Attention|', 'Text', '}}', 'extensions/MsWikiEditor/images/attention.png' ];

To remove a button, just include its key (the 'rel' attribute) in the $wgMSWE_remove array. For example:

$wgMSWE_remove = [ 'advanced', 'characters', 'help', 'file', 'reference', 'ilink', 'xlink' ];

By default, both arrays are empty.

See also