| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
ve.ui.MWLatexContextItem = function VeUiMWLatexContextItem() { |
| 20 |
|
| 21 |
ve.ui.MWLatexContextItem.super.apply( this, arguments ); |
| 22 |
|
| 23 |
this.quickEditButton = new OO.ui.ButtonWidget( { |
| 24 |
label: ve.msg( 'math-visualeditor-mwlatexcontextitem-quickedit' ), |
| 25 |
flags: [ 'progressive' ] |
| 26 |
} ); |
| 27 |
|
| 28 |
|
| 29 |
if ( !this.context.isMobile() && !this.isReadOnly() ) { |
| 30 |
this.actionButtons.addItems( [ this.quickEditButton ], 0 ); |
| 31 |
} |
| 32 |
|
| 33 |
this.quickEditButton.connect( this, { click: 'onInlineEditButtonClick' } ); |
| 34 |
|
| 35 |
|
| 36 |
this.$element.addClass( 've-ui-mwLatexContextItem' ); |
| 37 |
}; |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
OO.inheritClass( ve.ui.MWLatexContextItem, ve.ui.LinearContextItem ); |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
ve.ui.MWLatexContextItem.static.embeddable = false; |
| 46 |
|
| 47 |
ve.ui.MWLatexContextItem.static.inlineEditCommand = null; |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
ve.ui.MWLatexContextItem.prototype.onInlineEditButtonClick = function () { |
| 55 |
this.context.getSurface().executeCommand( this.constructor.static.inlineEditCommand ); |
| 56 |
}; |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
ve.ui.MWLatexContextItem.prototype.getCommand = function () { |
| 62 |
return this.context.getSurface().commandRegistry.lookup( |
| 63 |
this.context.isMobile() ? this.constructor.static.inlineEditCommand : this.constructor.static.commandName |
| 64 |
); |
| 65 |
}; |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
ve.ui.MWLatexContextItem.prototype.getDescription = function () { |
| 71 |
return ve.ce.nodeFactory.getDescription( this.model ); |
| 72 |
}; |