mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 16:44:51 +00:00
dedc107507
By moving the registration to the code which introduce the commands, if any module such as 'media' is omitted from an integration, we don't register a command which is never used. MWCommandRegistry.js remains to be used for over-rides of core tools' exact commands, such as insertTable. Change-Id: I84b4351b980a764d3c72a564f605821ae1c761f9
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MediaWiki LinkInspectorTool classes.
|
|
*
|
|
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* UserInterface link tool. Overrides link tool from core.
|
|
*
|
|
* Works for both link annotations and link nodes, and fires the 'link' command
|
|
* which works for both as well.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.LinkInspectorTool
|
|
* @constructor
|
|
* @param {OO.ui.ToolGroup} toolGroup
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
ve.ui.MWLinkInspectorTool = function VeUiMWLinkInspectorTool( toolGroup, config ) {
|
|
ve.ui.LinkInspectorTool.call( this, toolGroup, config );
|
|
};
|
|
|
|
OO.inheritClass( ve.ui.MWLinkInspectorTool, ve.ui.LinkInspectorTool );
|
|
|
|
// FIXME should eventually vary title based on link type
|
|
// Use message visualeditor-annotationbutton-linknode-tooltip
|
|
|
|
ve.ui.MWLinkInspectorTool.static.modelClasses =
|
|
ve.ui.MWLinkInspectorTool.super.static.modelClasses.concat( [
|
|
ve.dm.MWNumberedExternalLinkNode
|
|
] );
|
|
|
|
ve.ui.MWLinkInspectorTool.static.associatedWindows = [ 'link', 'linkNode' ];
|
|
|
|
ve.ui.toolFactory.register( ve.ui.MWLinkInspectorTool );
|
|
|
|
ve.ui.commandRegistry.register(
|
|
new ve.ui.Command(
|
|
'link', 'mwlink', 'open', { supportedSelections: [ 'linear' ] }
|
|
)
|
|
);
|