mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-26 19:56:49 +00:00
Disable re-use citation tool if there are no references in the document
Bug: 70640 Change-Id: I727857281644dffd23605d7792a3f71ee7c5b751
This commit is contained in:
parent
4adc453870
commit
72a118fc82
|
@ -51,6 +51,27 @@ ve.ui.MWUseExistingReferenceDialogTool.static.commandName = 'reference/existing'
|
|||
ve.ui.MWUseExistingReferenceDialogTool.static.requiresRange = true;
|
||||
ve.ui.MWUseExistingReferenceDialogTool.static.autoAddToGroup = false;
|
||||
ve.ui.MWUseExistingReferenceDialogTool.static.autoAddToCatchall = false;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
ve.ui.MWUseExistingReferenceDialogTool.prototype.onUpdateState = function ( fragment ) {
|
||||
var groups = fragment.getDocument().getInternalList().getNodeGroups(), empty = true;
|
||||
|
||||
// Parent method
|
||||
ve.ui.Tool.prototype.onUpdateState.apply( this, arguments );
|
||||
|
||||
$.each( groups, function ( groupName, group ) {
|
||||
if ( groupName.lastIndexOf( 'mwReference/' ) !== 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( group.indexOrder.length ) {
|
||||
empty = false;
|
||||
return false;
|
||||
}
|
||||
} );
|
||||
this.setDisabled( empty );
|
||||
};
|
||||
ve.ui.toolFactory.register( ve.ui.MWUseExistingReferenceDialogTool );
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue