Jump to content

扩展:MsWikiEditor

From mediawiki.org
This page is a translated version of the page Extension:MsWikiEditor and the translation is 54% complete.
MediaWiki扩展手册
MsWikiEditor
发行状态: 稳定版
实现 用户界面
描述 简单的对WikiEditor增加或删除按钮
作者 Martin Schwindl, Martin Keyler
维护者 Sophivorus
最新版本 4.0 (2024-08-12)
MediaWiki 1.39+
PHP 7.4+
  • $wgMSWE_remove
  • $wgMSWE_add
许可证 GNU General Public License 2.0 or later
下載
前往translatewiki.net翻譯MsWikiEditor扩展

The MsWikiEditor extension allows you to easily add or remove buttons from the WikiEditor toolbar via configuration.

安裝

  • 下载文件,并解压MsWikiEditor文件夹到extensions/目录中。
    开发者和代码贡献人员应改从Git安装此扩展,输入:
    cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MsWikiEditor
    
  • 請新增下列代码到您的LocalSettings.php 文件的底部:
    wfLoadExtension( 'MsWikiEditor' );
    
  • 按需求配置。
  • Yes 完成 – 請导航至您的wiki上的Special:Version,以验证此扩展已成功安装。

配置

To add a button, add its definition to the $wgMSWE_add array in your LocalSettings.php file 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' ), '', '', '/w/extensions/MsWikiEditor/images/date.png' ];
$wgMSWE_add['gallery'] = [ 'Gallery', "<gallery>\n", "File:Example1.jpg|Caption1\nFile:Example2.png|Caption2", "\n</gallery>", '/w/extensions/MsWikiEditor/images/gallery.png' ];
$wgMSWE_add['strike'] = [ 'Strike', '<strike>', 'Text', '</strike>', '/w/extensions/MsWikiEditor/images/strike.png' ];
$wgMSWE_add['email'] = [ 'Email', '[mailto:', 'address@example.com', ']', '/w/extensions/MsWikiEditor/images/email.png' ];
$wgMSWE_add['mslink'] = [ 'MsLink', '{{#l:', 'Filename.ext', '}}', '/w/extensions/MsWikiEditor/images/link.png' ];
$wgMSWE_add['template'] = [ 'Your template', '{{Your template|', 'Parameters', '}}', '/w/extensions/MsWikiEditor/images/template.png' ];
$wgMSWE_add['signature'] = [ 'Signature', '--~~~~', '', '', '/w/extensions/MsWikiEditor/images/signature.png' ];
$wgMSWE_add['attention'] = [ 'Attention', '{{Attention|', 'Text', '}}', '/w/extensions/MsWikiEditor/images/attention.png' ];

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

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

默认情况下,两个数组均为空。

参见