mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
03c5822b6b
Also update tools for changes in VE core. New changes: e4de14b Make tools use commands e029817 Make getToolsForNode place primary commands first Change-Id: I66575ee6d49e6b2f5a5f789978da98bb55e6dc5e
64 lines
1.6 KiB
JavaScript
64 lines
1.6 KiB
JavaScript
/*!
|
|
* VisualEditor MediaWiki UserInterface transclusion tool classes.
|
|
*
|
|
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* MediaWiki UserInterface transclusion tool.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.DialogTool
|
|
* @constructor
|
|
* @param {OO.ui.ToolGroup} toolGroup
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
ve.ui.MWTransclusionDialogTool = function VeUiMWTransclusionDialogTool( toolGroup, config ) {
|
|
ve.ui.DialogTool.call( this, toolGroup, config );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWTransclusionDialogTool, ve.ui.DialogTool );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.ui.MWTransclusionDialogTool.static.name = 'transclusion';
|
|
|
|
ve.ui.MWTransclusionDialogTool.static.group = 'object';
|
|
|
|
ve.ui.MWTransclusionDialogTool.static.icon = 'template';
|
|
|
|
ve.ui.MWTransclusionDialogTool.static.title =
|
|
OO.ui.deferMsg( 'visualeditor-dialogbutton-template-tooltip' );
|
|
|
|
ve.ui.MWTransclusionDialogTool.static.template = null;
|
|
|
|
ve.ui.MWTransclusionDialogTool.static.modelClasses = [ ve.dm.MWTransclusionNode ];
|
|
|
|
ve.ui.MWTransclusionDialogTool.static.commandName = 'transclusion';
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.ui.MWTransclusionDialogTool.static.isCompatibleWith = function ( model ) {
|
|
var partsList, compatible;
|
|
|
|
// Parent method
|
|
compatible = ve.ui.DialogTool.static.isCompatibleWith.call( this, model );
|
|
|
|
if ( compatible && this.template ) {
|
|
partsList = model.getPartsList();
|
|
return partsList.length === 1 && partsList[0].template === this.template;
|
|
}
|
|
|
|
return compatible;
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.ui.toolFactory.register( ve.ui.MWTransclusionDialogTool );
|