mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +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
83 lines
3.3 KiB
JavaScript
83 lines
3.3 KiB
JavaScript
/*!
|
|
* VisualEditor MediaWiki Reference dialog tool classes.
|
|
*
|
|
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* MediaWiki UserInterface reference tool.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.DialogTool
|
|
* @constructor
|
|
* @param {OO.ui.ToolGroup} toolGroup
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
ve.ui.MWReferenceDialogTool = function VeUiMWReferenceDialogTool( toolGroup, config ) {
|
|
ve.ui.DialogTool.call( this, toolGroup, config );
|
|
};
|
|
OO.inheritClass( ve.ui.MWReferenceDialogTool, ve.ui.DialogTool );
|
|
ve.ui.MWReferenceDialogTool.static.name = 'reference';
|
|
ve.ui.MWReferenceDialogTool.static.group = 'object';
|
|
ve.ui.MWReferenceDialogTool.static.icon = 'reference';
|
|
ve.ui.MWReferenceDialogTool.static.title =
|
|
OO.ui.deferMsg( 'visualeditor-dialogbutton-reference-tooltip' );
|
|
ve.ui.MWReferenceDialogTool.static.modelClasses = [ ve.dm.MWReferenceNode ];
|
|
ve.ui.MWReferenceDialogTool.static.commandName = 'reference';
|
|
ve.ui.MWReferenceDialogTool.static.autoAddToCatchall = false;
|
|
ve.ui.toolFactory.register( ve.ui.MWReferenceDialogTool );
|
|
|
|
/**
|
|
* MediaWiki UserInterface use existing reference tool.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.DialogTool
|
|
* @constructor
|
|
* @param {OO.ui.ToolGroup} toolGroup
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
ve.ui.MWUseExistingReferenceDialogTool = function VeUiMWUseExistingReferenceDialogTool( toolGroup, config ) {
|
|
ve.ui.DialogTool.call( this, toolGroup, config );
|
|
};
|
|
OO.inheritClass( ve.ui.MWUseExistingReferenceDialogTool, ve.ui.DialogTool );
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.name = 'reference/existing';
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.group = 'object';
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.icon = 'reference-existing';
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.title =
|
|
OO.ui.deferMsg( 'visualeditor-dialog-reference-useexisting-tool' );
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.modelClasses = [];
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.commandName = 'reference/existing';
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.autoAddToGroup = false;
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.autoAddToCatchall = false;
|
|
ve.ui.toolFactory.register( ve.ui.MWUseExistingReferenceDialogTool );
|
|
|
|
ve.ui.commandRegistry.register(
|
|
new ve.ui.Command(
|
|
'reference', 'window', 'open',
|
|
{ args: [ 'reference' ], supportedSelections: [ 'linear' ] }
|
|
)
|
|
);
|
|
|
|
/**
|
|
* MediaWiki UserInterface references list tool.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.DialogTool
|
|
* @constructor
|
|
* @param {OO.ui.ToolGroup} toolGroup
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
ve.ui.MWReferencesListDialogTool = function VeUiMWReferencesListDialogTool( toolGroup, config ) {
|
|
ve.ui.DialogTool.call( this, toolGroup, config );
|
|
};
|
|
OO.inheritClass( ve.ui.MWReferencesListDialogTool, ve.ui.DialogTool );
|
|
ve.ui.MWReferencesListDialogTool.static.name = 'referencesList';
|
|
ve.ui.MWReferencesListDialogTool.static.group = 'object';
|
|
ve.ui.MWReferencesListDialogTool.static.icon = 'references';
|
|
ve.ui.MWReferencesListDialogTool.static.title =
|
|
OO.ui.deferMsg( 'visualeditor-dialogbutton-referenceslist-tooltip' );
|
|
ve.ui.MWReferencesListDialogTool.static.modelClasses = [ ve.dm.MWReferencesListNode ];
|
|
ve.ui.MWReferencesListDialogTool.static.commandName = 'referencesList';
|
|
ve.ui.toolFactory.register( ve.ui.MWReferencesListDialogTool );
|