Remove old "bulletin board style toolbar" from core
With this change, MediaWiki will no longer have a 'JavaScript-powered' wikitext toolbar, and instead sysadmins will be required to choose one (or more) of the several extensions available for this purpose if they need the functionality. For over half a decade MediaWiki's tarball has included the 2010-era replacement for this feature, WikiEditor. We are now working on replacing even that, with the 2013-era visual editor, a mode of which is the forthcoming 2017-era wikitext editor, and several more specialised editors like CodeEditor. Beyond this, the core editor toolbar is ancient, un-loved, and is used only exceptionally rarely, mostly by accident. It is unhelpful to give implicitly this as the primary editor for MediaWiki just because we've not removed it from core when it is not a very good experience for any kind of user, and has not received the attention that users deserve to be worth retaining in core. The old core preference, which was intended to govern whether this old toolbar should be shown, has since mutated into whether the to run the EditPageBeforeEditToolbar hook. The hook is used by several extensions to provide toolbars in lieu of the core one. This preference has been, in practice, a very confusing preference for MediaWiki users, who have to interact with quite similar preferences to toggle their real editor which sit next to this one on the preferences page. Consequently, this preference is also removed. The code could be made into an extension for those (very few) users of MediaWiki who might want to keep on using it. However, the author will offer their services but not their encouragement in said undertaking. Bug: T30856 Bug: T32795 Change-Id: I2b05f0ca25873ad8e0b33a5e4938bef52c4e9347
|
|
@ -392,6 +392,26 @@ because of Phabricator reports.
|
|||
* ApiUsageException::getCodeString() (deprecated in 1.29)
|
||||
* ApiUsageException::getMessageArray() (deprecated in 1.29)
|
||||
* Class UsageException, deprecated in 1.29, has been removed.
|
||||
* MediaWiki no longer has a 'JavaScript-powered' wikitext toolbar built in. The
|
||||
old "bulletin board style toolbar", known as "the 2006 wikitext editor", has
|
||||
been removed, and instead sysadmins will be required to choose one (or more)
|
||||
of the several extensions available for this purpose if they need the
|
||||
functionality. The MediaWiki "tarball" releases have included the replacement
|
||||
extension for this, the WikiEditor extension aka "the 2010 wikitext editor",
|
||||
for many years now. As part of this, several parts of MediaWiki have been
|
||||
removed or simplified:
|
||||
* The user option 'showtoolbar' (shown as "Show edit toolbar") is no longer
|
||||
available; if an extension adds a toolbar via the EditPageBeforeEditToolbar
|
||||
hook, it will be shown; extensions should provide a specific user preference
|
||||
to disable themselves as needed.
|
||||
* The public methods Language::getImageFile() and ::getImageFiles(), and the
|
||||
related specification of $imageFiles within individual languages' code file,
|
||||
as well as the referenced static media assets, all of which were only used
|
||||
inside MediaWiki itself for providing the icons for the old toolbar, have
|
||||
been removed without explicit deprecation.
|
||||
* The internal ResourceLoader module "mediawiki.toolbar", which is unused
|
||||
except by MediaWiki itself and back-compatibility code, has been removed.
|
||||
* The internal ResourceLoaderEditToolbarModule class has been removed.
|
||||
|
||||
=== Deprecations in 1.32 ===
|
||||
* HTMLForm::setSubmitProgressive() is deprecated. No need to call it. Submit
|
||||
|
|
|
|||
|
|
@ -1211,7 +1211,6 @@ $wgAutoloadLocalClasses = [
|
|||
'ResourceLoader' => __DIR__ . '/includes/resourceloader/ResourceLoader.php',
|
||||
'ResourceLoaderClientHtml' => __DIR__ . '/includes/resourceloader/ResourceLoaderClientHtml.php',
|
||||
'ResourceLoaderContext' => __DIR__ . '/includes/resourceloader/ResourceLoaderContext.php',
|
||||
'ResourceLoaderEditToolbarModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderEditToolbarModule.php',
|
||||
'ResourceLoaderFileModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderFileModule.php',
|
||||
'ResourceLoaderFilePath' => __DIR__ . '/includes/resourceloader/ResourceLoaderFilePath.php',
|
||||
'ResourceLoaderForeignApiModule' => __DIR__ . '/includes/resourceloader/ResourceLoaderForeignApiModule.php',
|
||||
|
|
|
|||
|
|
@ -1471,11 +1471,10 @@ textarea in the edit form.
|
|||
&$buttons: Array of edit buttons "Save", "Preview", "Live", and "Diff"
|
||||
&$tabindex: HTML tabindex of the last edit check/button
|
||||
|
||||
'EditPageBeforeEditToolbar': Allows modifying the edit toolbar above the
|
||||
textarea in the edit form.
|
||||
Hook subscribers can return false to avoid the default toolbar code being
|
||||
loaded.
|
||||
&$toolbar: The toolbar HTML
|
||||
'EditPageBeforeEditToolbar': Allow adding an edit toolbar above the textarea in
|
||||
the edit form.
|
||||
&$toolbar: The toolbar HTML, initially an empty `<div id="toolbar"></div>`
|
||||
Hook subscribers can return false to have no toolbar HTML be loaded.
|
||||
|
||||
'EditPageCopyrightWarning': Allow for site and per-namespace customization of
|
||||
contribution/copyright notice.
|
||||
|
|
|
|||
|
|
@ -4887,7 +4887,6 @@ $wgDefaultUserOptions = [
|
|||
'rows' => 25, // @deprecated since 1.29 No longer used in core
|
||||
'showhiddencats' => 0,
|
||||
'shownumberswatching' => 1,
|
||||
'showtoolbar' => 1,
|
||||
'skin' => false,
|
||||
'stubthreshold' => 0,
|
||||
'thumbsize' => 5,
|
||||
|
|
|
|||
|
|
@ -2479,13 +2479,6 @@ ERROR;
|
|||
$out->addModuleStyles( 'mediawiki.editfont.styles' );
|
||||
|
||||
$user = $this->context->getUser();
|
||||
if ( $user->getOption( 'showtoolbar' ) ) {
|
||||
// The addition of default buttons is handled by getEditToolbar() which
|
||||
// has its own dependency on this module. The call here ensures the module
|
||||
// is loaded in time (it has position "top") for other modules to register
|
||||
// buttons (e.g. extensions, gadgets, user scripts).
|
||||
$out->addModules( 'mediawiki.toolbar' );
|
||||
}
|
||||
|
||||
if ( $user->getOption( 'uselivepreview' ) ) {
|
||||
$out->addModules( 'mediawiki.action.edit.preview' );
|
||||
|
|
@ -2788,13 +2781,8 @@ ERROR;
|
|||
|
||||
$out->addHTML( $this->editFormTextTop );
|
||||
|
||||
$showToolbar = true;
|
||||
if ( $this->wasDeletedSinceLastEdit() ) {
|
||||
if ( $this->formtype == 'save' ) {
|
||||
// Hide the toolbar and edit area, user can click preview to get it back
|
||||
// Add an confirmation checkbox and explanation.
|
||||
$showToolbar = false;
|
||||
} else {
|
||||
if ( $this->formtype !== 'save' ) {
|
||||
$out->wrapWikiMsg( "<div class='error mw-deleted-while-editing'>\n$1\n</div>",
|
||||
'deletedwhileediting' );
|
||||
}
|
||||
|
|
@ -2932,7 +2920,7 @@ ERROR;
|
|||
$out->addHTML( $editConflictHelper->getEditFormHtmlBeforeContent() );
|
||||
}
|
||||
|
||||
if ( !$this->mTitle->isUserConfigPage() && $showToolbar && $user->getOption( 'showtoolbar' ) ) {
|
||||
if ( !$this->mTitle->isUserConfigPage() ) {
|
||||
$out->addHTML( self::getEditToolbar( $this->mTitle ) );
|
||||
}
|
||||
|
||||
|
|
@ -4088,145 +4076,20 @@ ERROR;
|
|||
}
|
||||
|
||||
/**
|
||||
* Shows a bulletin board style toolbar for common editing functions.
|
||||
* It can be disabled in the user preferences.
|
||||
* Allow extensions to provide a toolbar.
|
||||
*
|
||||
* @param Title|null $title Title object for the page being edited (optional)
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public static function getEditToolbar( $title = null ) {
|
||||
global $wgOut, $wgEnableUploads, $wgForeignFileRepos;
|
||||
$startingToolbar = '<div id="toolbar"></div>';
|
||||
$toolbar = $startingToolbar;
|
||||
|
||||
$imagesAvailable = $wgEnableUploads || count( $wgForeignFileRepos );
|
||||
$showSignature = true;
|
||||
if ( $title ) {
|
||||
$showSignature = MWNamespace::wantSignatures( $title->getNamespace() );
|
||||
}
|
||||
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
|
||||
/**
|
||||
* $toolarray is an array of arrays each of which includes the
|
||||
* opening tag, the closing tag, optionally a sample text that is
|
||||
* inserted between the two when no selection is highlighted
|
||||
* and. The tip text is shown when the user moves the mouse
|
||||
* over the button.
|
||||
*
|
||||
* Images are defined in ResourceLoaderEditToolbarModule.
|
||||
*/
|
||||
$toolarray = [
|
||||
[
|
||||
'id' => 'mw-editbutton-bold',
|
||||
'open' => '\'\'\'',
|
||||
'close' => '\'\'\'',
|
||||
'sample' => wfMessage( 'bold_sample' )->text(),
|
||||
'tip' => wfMessage( 'bold_tip' )->text(),
|
||||
],
|
||||
[
|
||||
'id' => 'mw-editbutton-italic',
|
||||
'open' => '\'\'',
|
||||
'close' => '\'\'',
|
||||
'sample' => wfMessage( 'italic_sample' )->text(),
|
||||
'tip' => wfMessage( 'italic_tip' )->text(),
|
||||
],
|
||||
[
|
||||
'id' => 'mw-editbutton-link',
|
||||
'open' => '[[',
|
||||
'close' => ']]',
|
||||
'sample' => wfMessage( 'link_sample' )->text(),
|
||||
'tip' => wfMessage( 'link_tip' )->text(),
|
||||
],
|
||||
[
|
||||
'id' => 'mw-editbutton-extlink',
|
||||
'open' => '[',
|
||||
'close' => ']',
|
||||
'sample' => wfMessage( 'extlink_sample' )->text(),
|
||||
'tip' => wfMessage( 'extlink_tip' )->text(),
|
||||
],
|
||||
[
|
||||
'id' => 'mw-editbutton-headline',
|
||||
'open' => "\n== ",
|
||||
'close' => " ==\n",
|
||||
'sample' => wfMessage( 'headline_sample' )->text(),
|
||||
'tip' => wfMessage( 'headline_tip' )->text(),
|
||||
],
|
||||
$imagesAvailable ? [
|
||||
'id' => 'mw-editbutton-image',
|
||||
'open' => '[[' . $contLang->getNsText( NS_FILE ) . ':',
|
||||
'close' => ']]',
|
||||
'sample' => wfMessage( 'image_sample' )->text(),
|
||||
'tip' => wfMessage( 'image_tip' )->text(),
|
||||
] : false,
|
||||
$imagesAvailable ? [
|
||||
'id' => 'mw-editbutton-media',
|
||||
'open' => '[[' . $contLang->getNsText( NS_MEDIA ) . ':',
|
||||
'close' => ']]',
|
||||
'sample' => wfMessage( 'media_sample' )->text(),
|
||||
'tip' => wfMessage( 'media_tip' )->text(),
|
||||
] : false,
|
||||
[
|
||||
'id' => 'mw-editbutton-nowiki',
|
||||
'open' => "<nowiki>",
|
||||
'close' => "</nowiki>",
|
||||
'sample' => wfMessage( 'nowiki_sample' )->text(),
|
||||
'tip' => wfMessage( 'nowiki_tip' )->text(),
|
||||
],
|
||||
$showSignature ? [
|
||||
'id' => 'mw-editbutton-signature',
|
||||
'open' => wfMessage( 'sig-text', '~~~~' )->inContentLanguage()->text(),
|
||||
'close' => '',
|
||||
'sample' => '',
|
||||
'tip' => wfMessage( 'sig_tip' )->text(),
|
||||
] : false,
|
||||
[
|
||||
'id' => 'mw-editbutton-hr',
|
||||
'open' => "\n----\n",
|
||||
'close' => '',
|
||||
'sample' => '',
|
||||
'tip' => wfMessage( 'hr_tip' )->text(),
|
||||
]
|
||||
];
|
||||
|
||||
$script = '';
|
||||
foreach ( $toolarray as $tool ) {
|
||||
if ( !$tool ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$params = [
|
||||
// Images are defined in ResourceLoaderEditToolbarModule
|
||||
false,
|
||||
// Note that we use the tip both for the ALT tag and the TITLE tag of the image.
|
||||
// Older browsers show a "speedtip" type message only for ALT.
|
||||
// Ideally these should be different, realistically they
|
||||
// probably don't need to be.
|
||||
$tool['tip'],
|
||||
$tool['open'],
|
||||
$tool['close'],
|
||||
$tool['sample'],
|
||||
$tool['id'],
|
||||
];
|
||||
|
||||
$script .= Xml::encodeJsCall(
|
||||
'mw.toolbar.addButton',
|
||||
$params,
|
||||
ResourceLoader::inDebugMode()
|
||||
);
|
||||
}
|
||||
|
||||
$toolbar = '<div id="toolbar"></div>';
|
||||
|
||||
if ( Hooks::run( 'EditPageBeforeEditToolbar', [ &$toolbar ] ) ) {
|
||||
// Only add the old toolbar cruft to the page payload if the toolbar has not
|
||||
// been over-written by a hook caller
|
||||
$nonce = $wgOut->getCSPNonce();
|
||||
$wgOut->addScript( Html::inlineScript(
|
||||
ResourceLoader::makeInlineCodeWithModule( 'mediawiki.toolbar', $script ),
|
||||
$nonce
|
||||
) );
|
||||
if ( !Hooks::run( 'EditPageBeforeEditToolbar', [ &$toolbar ] ) ) {
|
||||
return null;
|
||||
};
|
||||
|
||||
return $toolbar;
|
||||
// Don't add a pointless `<div>` to the page unless a hook caller populated it
|
||||
return ( $toolbar === $startingToolbar ) ? null : $toolbar;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* ResourceLoader module for the edit toolbar.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* ResourceLoader module for the edit toolbar.
|
||||
*
|
||||
* @since 1.24
|
||||
*/
|
||||
class ResourceLoaderEditToolbarModule extends ResourceLoaderFileModule {
|
||||
/**
|
||||
* Get language-specific LESS variables for this module.
|
||||
*
|
||||
* @since 1.27
|
||||
* @param ResourceLoaderContext $context
|
||||
* @return array
|
||||
*/
|
||||
protected function getLessVars( ResourceLoaderContext $context ) {
|
||||
$vars = parent::getLessVars( $context );
|
||||
$language = Language::factory( $context->getLanguage() );
|
||||
foreach ( $language->getImageFiles() as $key => $value ) {
|
||||
$vars[$key] = CSSMin::serializeStringValue( $value );
|
||||
}
|
||||
return $vars;
|
||||
}
|
||||
}
|
||||
|
|
@ -814,22 +814,6 @@ class Language {
|
|||
return self::$dataCache->getItem( $this->mCode, 'datePreferenceMigrationMap' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $image
|
||||
* @return array|null
|
||||
*/
|
||||
function getImageFile( $image ) {
|
||||
return self::$dataCache->getSubitem( $this->mCode, 'imageFiles', $image );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @since 1.24
|
||||
*/
|
||||
public function getImageFiles() {
|
||||
return self::$dataCache->getItem( $this->mCode, 'imageFiles' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
"tog-extendwatchlist": "Expand watchlist to show all changes, not just the most recent",
|
||||
"tog-usenewrc": "Group changes by page in recent changes and watchlist",
|
||||
"tog-numberheadings": "Auto-number headings",
|
||||
"tog-showtoolbar": "Show edit toolbar",
|
||||
"tog-editondblclick": "Edit pages on double click",
|
||||
"tog-editsectiononrightclick": "Enable section editing by right clicking on section titles",
|
||||
"tog-watchcreations": "Add pages I create and files I upload to my watchlist",
|
||||
|
|
|
|||
|
|
@ -213,7 +213,6 @@
|
|||
"tog-extendwatchlist": "[[Special:Preferences]], tab 'Watchlist'. Offers user to show all applicable changes in watchlist (by default only the last change to a page on the watchlist is shown). {{Gender}}",
|
||||
"tog-usenewrc": "{{Gender}}\nUsed as label for the checkbox in [[Special:Preferences]], tab \"Recent changes\".\n\nOffers user to use alternative representation of [[Special:RecentChanges]] and watchlist.",
|
||||
"tog-numberheadings": "[[Special:Preferences]], tab 'Misc'. Offers numbered headings on content pages to user. {{Gender}}",
|
||||
"tog-showtoolbar": "{{Gender}}\n[[Special:Preferences]], tab 'Edit'. Offers user to show edit toolbar in page edit screen.\n\nThis is the toolbar: [[Image:Toolbar.png]]",
|
||||
"tog-editondblclick": "{{Gender}}\n[[Special:Preferences]], tab 'Edit'. Offers user to open edit page on double click.",
|
||||
"tog-editsectiononrightclick": "{{Gender}}\n[[Special:Preferences]], tab 'Edit'. Offers user to edit a section by clicking on a section title.",
|
||||
"tog-watchcreations": "[[Special:Preferences]], tab 'Watchlist'. Offers user to add created pages to watchlist. {{Gender}}",
|
||||
|
|
|
|||
|
|
@ -439,11 +439,3 @@ $specialPageAliases = [
|
|||
* Arabic trails too.
|
||||
*/
|
||||
$linkTrail = '/^([a-zء-ي]+)(.*)$/sDu';
|
||||
|
||||
$imageFiles = [
|
||||
'button-bold' => 'ar/button_bold.png',
|
||||
'button-italic' => 'ar/button_italic.png',
|
||||
'button-link' => 'ar/button_link.png',
|
||||
'button-headline' => 'ar/button_headline.png',
|
||||
'button-nowiki' => 'ar/button_nowiki.png',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -239,9 +239,3 @@ $separatorTransformTable = [
|
|||
$minimumGroupingDigits = 2;
|
||||
|
||||
$linkTrail = '/^([абвгґджзеёжзійклмнопрстуўфхцчшыьэюяćčłńśšŭźža-z]+)(.*)$/sDu';
|
||||
|
||||
$imageFiles = [
|
||||
'button-bold' => 'be-tarask/button_bold.png',
|
||||
'button-italic' => 'be-tarask/button_italic.png',
|
||||
'button-link' => 'be-tarask/button_link.png',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -352,8 +352,3 @@ $bookstoreList = [
|
|||
|
||||
$separatorTransformTable = [ ',' => '.', '.' => ',' ];
|
||||
$linkTrail = '/^([äöüßa-z]+)(.*)$/sDu';
|
||||
|
||||
$imageFiles = [
|
||||
'button-bold' => 'de/button_bold.png',
|
||||
'button-italic' => 'de/button_italic.png',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -531,23 +531,6 @@ $linkTrail = '/^([a-z]+)(.*)$/sD';
|
|||
*/
|
||||
$linkPrefixCharset = 'a-zA-Z\\x{80}-\\x{10ffff}';
|
||||
|
||||
/**
|
||||
* List of filenames for some ui images that can be overridden per language
|
||||
* basis if needed.
|
||||
*/
|
||||
$imageFiles = [
|
||||
'button-bold' => 'en/button_bold.png',
|
||||
'button-italic' => 'en/button_italic.png',
|
||||
'button-link' => 'en/button_link.png',
|
||||
'button-extlink' => 'en/button_extlink.png',
|
||||
'button-headline' => 'en/button_headline.png',
|
||||
'button-image' => 'en/button_image.png',
|
||||
'button-media' => 'en/button_media.png',
|
||||
'button-nowiki' => 'en/button_nowiki.png',
|
||||
'button-sig' => 'en/button_sig.png',
|
||||
'button-hr' => 'en/button_hr.png',
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of messages to preload for each request.
|
||||
* Here we add messages that are needed for a typical anonymous parser cache hit.
|
||||
|
|
|
|||
|
|
@ -412,11 +412,3 @@ $dateFormats = [
|
|||
# Harakat are intentionally not included in the linkTrail. Their addition should
|
||||
# take place after enough tests.
|
||||
$linkTrail = "/^([ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآأئؤة]+)(.*)$/sDu";
|
||||
|
||||
$imageFiles = [
|
||||
'button-bold' => 'fa/button_bold.png',
|
||||
'button-italic' => 'fa/button_italic.png',
|
||||
'button-link' => 'fa/button_link.png',
|
||||
'button-headline' => 'fa/button_headline.png',
|
||||
'button-nowiki' => 'fa/button_nowiki.png',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -201,7 +201,3 @@ $magicWords = [
|
|||
'language' => [ '0', '#SHPROOCH:', '#SPROCH:', '#SPRACHE:', '#LANGUAGE:' ],
|
||||
'hiddencat' => [ '1', '__VERSHTOCHE_SAACHJRUPP__', '__VERSTECKTE_KATEGORIE__', '__WARTUNGSKATEGORIE__', '__HIDDENCAT__' ],
|
||||
];
|
||||
|
||||
$imageFiles = [
|
||||
'button-italic' => 'ksh/button_italic.png',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -425,10 +425,4 @@ $minimumGroupingDigits = 2;
|
|||
$fallback8bitEncoding = 'windows-1251';
|
||||
$linkPrefixExtension = false;
|
||||
|
||||
$imageFiles = [
|
||||
'button-bold' => 'ru/button_bold.png',
|
||||
'button-italic' => 'ru/button_italic.png',
|
||||
'button-link' => 'ru/button_link.png',
|
||||
];
|
||||
|
||||
$linkTrail = '/^([a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя]+)(.*)$/sDu';
|
||||
|
|
|
|||
|
|
@ -3697,7 +3697,6 @@ showredirs
|
|||
showreviewed
|
||||
showsizediff
|
||||
showtoc
|
||||
showtoolbar
|
||||
showunreviewed
|
||||
shtml
|
||||
si
|
||||
|
|
|
|||
|
|
@ -38,10 +38,6 @@
|
|||
"mw.visibleTimeout"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Actions",
|
||||
"classes": ["mw.toolbar"]
|
||||
},
|
||||
{
|
||||
"name": "API",
|
||||
"classes": ["mw.Api*", "mw.ForeignApi*"]
|
||||
|
|
|
|||
|
|
@ -1394,12 +1394,6 @@ return [
|
|||
'dependencies' => 'jquery.cookie',
|
||||
'targets' => [ 'desktop', 'mobile' ],
|
||||
],
|
||||
'mediawiki.toolbar' => [
|
||||
'class' => ResourceLoaderEditToolbarModule::class,
|
||||
'scripts' => 'resources/src/mediawiki.toolbar/toolbar.js',
|
||||
'styles' => 'resources/src/mediawiki.toolbar/toolbar.less',
|
||||
'dependencies' => 'jquery.textSelection',
|
||||
],
|
||||
'mediawiki.experiments' => [
|
||||
'scripts' => 'resources/src/mediawiki.experiments.js',
|
||||
'targets' => [ 'desktop', 'mobile' ],
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 522 B |
|
Before Width: | Height: | Size: 424 B |
|
Before Width: | Height: | Size: 474 B |
|
Before Width: | Height: | Size: 523 B |
|
Before Width: | Height: | Size: 842 B |
|
Before Width: | Height: | Size: 499 B |
|
Before Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 396 B |
|
Before Width: | Height: | Size: 230 B |
|
Before Width: | Height: | Size: 257 B |
|
Before Width: | Height: | Size: 226 B |
|
Before Width: | Height: | Size: 435 B |
|
Before Width: | Height: | Size: 430 B |
|
Before Width: | Height: | Size: 200 B |
|
Before Width: | Height: | Size: 483 B |
|
Before Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 275 B |
|
Before Width: | Height: | Size: 707 B |
|
Before Width: | Height: | Size: 321 B |
|
Before Width: | Height: | Size: 904 B |
|
Before Width: | Height: | Size: 436 B |
|
Before Width: | Height: | Size: 374 B |
|
Before Width: | Height: | Size: 485 B |
|
Before Width: | Height: | Size: 444 B |
|
Before Width: | Height: | Size: 842 B |
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
button_italic.png
|
||||
-------------------
|
||||
Source : https://commons.wikimedia.org/wiki/Image:Button_S_italic.png
|
||||
License: Public domain
|
||||
Author : Purodha Blissenbach, https://ksh.wikipedia.org/wiki/User:Purodha
|
||||
|
||||
|
Before Width: | Height: | Size: 357 B |
|
|
@ -1,17 +0,0 @@
|
|||
button_bold.png
|
||||
---------------
|
||||
Source : https://commons.wikimedia.org/wiki/File:Button_bold_ukr.png
|
||||
License: Public domain
|
||||
Author : Alexey Belomoev
|
||||
|
||||
button_italic.png
|
||||
------------------------
|
||||
Source : https://commons.wikimedia.org/wiki/File:Button_italic_ukr.png
|
||||
License: Public domain
|
||||
Author : Alexey Belomoev
|
||||
|
||||
button_link.png
|
||||
-----------------
|
||||
Source : https://commons.wikimedia.org/wiki/File:Button_internal_link_ukr.png
|
||||
License: GPL
|
||||
Author : Saproj, Erik Möller
|
||||
|
Before Width: | Height: | Size: 242 B |
|
Before Width: | Height: | Size: 396 B |
|
Before Width: | Height: | Size: 270 B |
|
|
@ -1,208 +0,0 @@
|
|||
/**
|
||||
* Interface for the classic edit toolbar.
|
||||
*
|
||||
* @class mw.toolbar
|
||||
* @singleton
|
||||
*/
|
||||
( function () {
|
||||
var toolbar, isReady, $toolbar, queue, slice, $currentFocused;
|
||||
|
||||
/**
|
||||
* Internal helper that does the actual insertion of the button into the toolbar.
|
||||
*
|
||||
* For backwards-compatibility, passing `imageFile`, `speedTip`, `tagOpen`, `tagClose`,
|
||||
* `sampleText` and `imageId` as separate arguments (in this order) is also supported.
|
||||
*
|
||||
* @private
|
||||
*
|
||||
* @param {Object} button Object with the following properties.
|
||||
* You are required to provide *either* the `onClick` parameter, or the three parameters
|
||||
* `tagOpen`, `tagClose` and `sampleText`, but not both (they're mutually exclusive).
|
||||
* @param {string} [button.imageFile] Image to use for the button.
|
||||
* @param {string} button.speedTip Tooltip displayed when user mouses over the button.
|
||||
* @param {Function} [button.onClick] Function to be executed when the button is clicked.
|
||||
* @param {string} [button.tagOpen]
|
||||
* @param {string} [button.tagClose]
|
||||
* @param {string} [button.sampleText] Alternative to `onClick`. `tagOpen`, `tagClose` and
|
||||
* `sampleText` together provide the markup that should be inserted into page text at
|
||||
* current cursor position.
|
||||
* @param {string} [button.imageId] `id` attribute of the button HTML element. Can be
|
||||
* used to define the image with CSS if it's not provided as `imageFile`.
|
||||
* @param {string} [speedTip]
|
||||
* @param {string} [tagOpen]
|
||||
* @param {string} [tagClose]
|
||||
* @param {string} [sampleText]
|
||||
* @param {string} [imageId]
|
||||
*/
|
||||
function insertButton( button, speedTip, tagOpen, tagClose, sampleText, imageId ) {
|
||||
var $button;
|
||||
|
||||
// Backwards compatibility
|
||||
if ( typeof button !== 'object' ) {
|
||||
button = {
|
||||
imageFile: button,
|
||||
speedTip: speedTip,
|
||||
tagOpen: tagOpen,
|
||||
tagClose: tagClose,
|
||||
sampleText: sampleText,
|
||||
imageId: imageId
|
||||
};
|
||||
}
|
||||
|
||||
if ( button.imageFile ) {
|
||||
$button = $( '<img>' ).attr( {
|
||||
src: button.imageFile,
|
||||
alt: button.speedTip,
|
||||
title: button.speedTip,
|
||||
id: button.imageId || undefined,
|
||||
'class': 'mw-toolbar-editbutton'
|
||||
} );
|
||||
} else {
|
||||
$button = $( '<div>' ).attr( {
|
||||
title: button.speedTip,
|
||||
id: button.imageId || undefined,
|
||||
'class': 'mw-toolbar-editbutton'
|
||||
} );
|
||||
}
|
||||
|
||||
$button.click( function ( e ) {
|
||||
if ( button.onClick !== undefined ) {
|
||||
button.onClick( e );
|
||||
} else {
|
||||
toolbar.insertTags( button.tagOpen, button.tagClose, button.sampleText );
|
||||
}
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
$toolbar.append( $button );
|
||||
}
|
||||
|
||||
isReady = false;
|
||||
$toolbar = false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @property {Array}
|
||||
* Contains button objects (and for backwards compatibility, it can
|
||||
* also contains an arguments array for insertButton).
|
||||
*/
|
||||
queue = [];
|
||||
slice = queue.slice;
|
||||
|
||||
toolbar = {
|
||||
|
||||
/**
|
||||
* Add buttons to the toolbar.
|
||||
*
|
||||
* Takes care of race conditions and time-based dependencies by placing buttons in a queue if
|
||||
* this method is called before the toolbar is created.
|
||||
*
|
||||
* For backwards-compatibility, passing `imageFile`, `speedTip`, `tagOpen`, `tagClose`,
|
||||
* `sampleText` and `imageId` as separate arguments (in this order) is also supported.
|
||||
*
|
||||
* @inheritdoc #insertButton
|
||||
*/
|
||||
addButton: function () {
|
||||
if ( isReady ) {
|
||||
insertButton.apply( toolbar, arguments );
|
||||
} else {
|
||||
// Convert arguments list to array
|
||||
queue.push( slice.call( arguments ) );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Add multiple buttons to the toolbar (see also #addButton).
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* addButtons( [ { .. }, { .. }, { .. } ] );
|
||||
* addButtons( { .. }, { .. } );
|
||||
*
|
||||
* @param {...Object|Array} [buttons] An array of button objects or the first
|
||||
* button object in a list of variadic arguments.
|
||||
*/
|
||||
addButtons: function ( buttons ) {
|
||||
if ( !Array.isArray( buttons ) ) {
|
||||
buttons = slice.call( arguments );
|
||||
}
|
||||
if ( isReady ) {
|
||||
buttons.forEach( function ( button ) {
|
||||
insertButton( button );
|
||||
} );
|
||||
} else {
|
||||
// Push each button into the queue
|
||||
queue.push.apply( queue, buttons );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Apply tagOpen/tagClose to selection in currently focused textarea.
|
||||
*
|
||||
* Uses `sampleText` if selection is empty.
|
||||
*
|
||||
* @param {string} tagOpen
|
||||
* @param {string} tagClose
|
||||
* @param {string} sampleText
|
||||
*/
|
||||
insertTags: function ( tagOpen, tagClose, sampleText ) {
|
||||
if ( $currentFocused && $currentFocused.length ) {
|
||||
$currentFocused.textSelection(
|
||||
'encapsulateSelection', {
|
||||
pre: tagOpen,
|
||||
peri: sampleText,
|
||||
post: tagClose
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Legacy (for compatibility with the code previously in skins/common.edit.js)
|
||||
mw.log.deprecate( window, 'addButton', toolbar.addButton, 'Use mw.toolbar.addButton instead.' );
|
||||
mw.log.deprecate( window, 'insertTags', toolbar.insertTags, 'Use mw.toolbar.insertTags instead.' );
|
||||
|
||||
// For backwards compatibility. Used to be called from EditPage.php, maybe other places as well.
|
||||
toolbar.init = $.noop;
|
||||
|
||||
// Expose API publicly
|
||||
// @deprecated since MW 1.29
|
||||
mw.log.deprecate( mw, 'toolbar', toolbar, null, 'mw.toolbar' );
|
||||
|
||||
$( function () {
|
||||
var i, button;
|
||||
|
||||
// Used to determine where to insert tags
|
||||
$currentFocused = $( '#wpTextbox1' );
|
||||
|
||||
// Populate the selector cache for $toolbar
|
||||
$toolbar = $( '#toolbar' );
|
||||
|
||||
for ( i = 0; i < queue.length; i++ ) {
|
||||
button = queue[ i ];
|
||||
if ( Array.isArray( button ) ) {
|
||||
// Forwarded arguments array from mw.toolbar.addButton
|
||||
insertButton.apply( toolbar, button );
|
||||
} else {
|
||||
// Raw object from mw.toolbar.addButtons
|
||||
insertButton( button );
|
||||
}
|
||||
}
|
||||
|
||||
// Clear queue
|
||||
queue.length = 0;
|
||||
|
||||
// This causes further calls to addButton to go to insertion directly
|
||||
// instead of to the queue.
|
||||
// It is important that this is after the one and only loop through
|
||||
// the queue
|
||||
isReady = true;
|
||||
|
||||
// Apply to dynamically created textboxes as well as normal ones
|
||||
$( document ).on( 'focus', 'textarea, input:text', function () {
|
||||
$currentFocused = $( this );
|
||||
} );
|
||||
} );
|
||||
|
||||
}() );
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
@import 'mediawiki.mixins';
|
||||
|
||||
#mw-editbutton-bold {
|
||||
.background-image('images/@{button-bold}');
|
||||
}
|
||||
|
||||
#mw-editbutton-italic {
|
||||
.background-image('images/@{button-italic}');
|
||||
}
|
||||
|
||||
#mw-editbutton-link {
|
||||
.background-image('images/@{button-link}');
|
||||
}
|
||||
|
||||
#mw-editbutton-extlink {
|
||||
.background-image('images/@{button-extlink}');
|
||||
}
|
||||
|
||||
#mw-editbutton-headline {
|
||||
.background-image('images/@{button-headline}');
|
||||
}
|
||||
|
||||
#mw-editbutton-image {
|
||||
.background-image('images/@{button-image}');
|
||||
}
|
||||
|
||||
#mw-editbutton-media {
|
||||
.background-image('images/@{button-media}');
|
||||
}
|
||||
|
||||
#mw-editbutton-nowiki {
|
||||
.background-image('images/@{button-nowiki}');
|
||||
}
|
||||
|
||||
// Who decided to make only this single one different than the name of the data item?
|
||||
#mw-editbutton-signature {
|
||||
.background-image('images/@{button-sig}');
|
||||
}
|
||||
|
||||
#mw-editbutton-hr {
|
||||
.background-image('images/@{button-hr}');
|
||||
}
|
||||