| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
ve.ui.ToolContextItem = function VeUiToolContextItem( context, model, tool, config ) { |
| 19 |
|
| 20 |
ve.ui.ToolContextItem.super.call( this, context, model, config ); |
| 21 |
|
| 22 |
|
| 23 |
this.tool = tool; |
| 24 |
|
| 25 |
|
| 26 |
this.setIcon( tool.static.icon ); |
| 27 |
this.setLabel( tool.static.title ); |
| 28 |
this.$element.addClass( 've-ui-toolContextItem' ); |
| 29 |
}; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
OO.inheritClass( ve.ui.ToolContextItem, ve.ui.LinearContextItem ); |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
ve.ui.ToolContextItem.prototype.getCommand = function () { |
| 41 |
return this.tool.static.getCommand( this.context.getSurface() ); |
| 42 |
}; |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
ve.ui.ToolContextItem.prototype.getDescription = function () { |
| 50 |
let description = ''; |
| 51 |
|
| 52 |
if ( this.model instanceof ve.dm.Annotation ) { |
| 53 |
description = ve.ce.annotationFactory.getDescription( this.model ); |
| 54 |
} else if ( this.model instanceof ve.dm.Node ) { |
| 55 |
description = ve.ce.nodeFactory.getDescription( this.model ); |
| 56 |
} |
| 57 |
|
| 58 |
return description; |
| 59 |
}; |