| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
ve.ui.FragmentWindowTool = function VeUiFragmentWindowTool() { |
| 18 |
|
| 19 |
ve.ui.FragmentWindowTool.super.apply( this, arguments ); |
| 20 |
}; |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
OO.inheritClass( ve.ui.FragmentWindowTool, ve.ui.WindowTool ); |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
ve.ui.FragmentWindowTool.static.modelClasses = []; |
| 38 |
|
| 39 |
ve.ui.FragmentWindowTool.static.deactivateOnSelect = false; |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
ve.ui.FragmentWindowTool.static.isCompatibleWith = function ( model ) { |
| 47 |
return ve.isInstanceOfAny( model, this.modelClasses ); |
| 48 |
}; |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
ve.ui.FragmentWindowTool.prototype.onUpdateState = function ( fragment ) { |
| 54 |
this.setActive( false ); |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
ve.ui.FragmentWindowTool.super.super.prototype.onUpdateState.apply( this, arguments ); |
| 60 |
|
| 61 |
const models = this.getSelectedModels( fragment ); |
| 62 |
|
| 63 |
for ( let i = 0, len = models.length; i < len; i++ ) { |
| 64 |
if ( this.constructor.static.isCompatibleWith( models[ i ] ) ) { |
| 65 |
this.setActive( true ); |
| 66 |
break; |
| 67 |
} |
| 68 |
} |
| 69 |
}; |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
ve.ui.FragmentWindowTool.prototype.getSelectedModels = function ( fragment ) { |
| 78 |
return fragment ? fragment.getSelectedModels() : []; |
| 79 |
}; |