Make inspector tools active when content is inspectable

This was a regression that occurred when the toolbar was refactored
recently. The correct and previous behavior was if the cursor is in a
location where the context would show an inspector tool, that inspector
tool should be active in the toolbar.

Change-Id: I8ac2b1bd21b843db30e3e9f951702378007e139a
This commit is contained in:
Trevor Parscal 2013-11-12 11:57:07 -08:00 committed by Catrope
parent 65a2f41268
commit 9429f4c225

View file

@ -78,7 +78,7 @@ ve.ui.InspectorTool.prototype.onSelect = function () {
this.constructor.static.inspector,
this.constructor.static.config
);
this.setActive( false );
this.setActive( true );
};
/**
@ -90,8 +90,13 @@ ve.ui.InspectorTool.prototype.onSelect = function () {
* @param {ve.dm.AnnotationSet} partial Annotations that cover some or all of the current selection
*/
ve.ui.InspectorTool.prototype.onUpdateState = function ( nodes, full ) {
var toolFactory = this.toolbar.getToolFactory();
this.setActive( toolFactory.getToolsForAnnotations( full ).indexOf( this.constructor ) !== -1 );
var toolFactory = this.toolbar.getToolFactory(),
tools = toolFactory.getToolsForAnnotations( full );
this.setActive(
// This tool is compatible with one of the annotations
tools.indexOf( this.constructor.static.name ) !== -1
);
};
/**