Disable re-use citation tool if there are no references in the document

Bug: 70640
Change-Id: I727857281644dffd23605d7792a3f71ee7c5b751
This commit is contained in:
Alex Monk 2014-09-11 00:05:32 +01:00
parent 4adc453870
commit 72a118fc82

View file

@ -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 );
/**