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
57 lines
1.4 KiB
JavaScript
57 lines
1.4 KiB
JavaScript
/*!
|
|
* VisualEditor MWAlienExtensionContextItem class.
|
|
*
|
|
* @copyright 2011-2015 VisualEditor Team and others; see http://ve.mit-license.org
|
|
*/
|
|
|
|
/**
|
|
* Context item for a MWAlienExtension.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.ContextItem
|
|
*
|
|
* @constructor
|
|
* @param {ve.ui.Context} context Context item is in
|
|
* @param {ve.dm.Model} model Model item is related to
|
|
* @param {Object} config Configuration options
|
|
*/
|
|
ve.ui.MWAlienExtensionContextItem = function VeMWAlienExtensionContextItem( context, model ) {
|
|
// Parent constructor
|
|
ve.ui.MWAlienExtensionContextItem.super.apply( this, arguments );
|
|
|
|
// Initialization
|
|
this.$element.addClass( 've-ui-mwAlienExtensionContextItem' );
|
|
|
|
this.setLabel( model.getExtensionName() );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWAlienExtensionContextItem, ve.ui.ContextItem );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.ui.MWAlienExtensionContextItem.static.name = 'alienExtension';
|
|
|
|
ve.ui.MWAlienExtensionContextItem.static.icon = 'alienextension';
|
|
|
|
ve.ui.MWAlienExtensionContextItem.static.modelClasses = [
|
|
ve.dm.MWAlienInlineExtensionNode,
|
|
ve.dm.MWAlienBlockExtensionNode
|
|
];
|
|
|
|
ve.ui.MWAlienExtensionContextItem.static.commandName = 'alienExtension';
|
|
|
|
/* Methods */
|
|
|
|
/* Registration */
|
|
|
|
ve.ui.contextItemFactory.register( ve.ui.MWAlienExtensionContextItem );
|
|
|
|
ve.ui.commandRegistry.register(
|
|
new ve.ui.Command(
|
|
'alienExtension', 'window', 'open',
|
|
{ args: [ 'alienExtension' ], supportedSelections: [ 'linear' ] }
|
|
)
|
|
);
|