mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
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:
parent
65a2f41268
commit
9429f4c225
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue