| 1 |
function DtUiMWSignatureContextItem() { |
| 2 |
|
| 3 |
DtUiMWSignatureContextItem.super.apply( this, arguments ); |
| 4 |
} |
| 5 |
|
| 6 |
OO.inheritClass( DtUiMWSignatureContextItem, ve.ui.MWSignatureContextItem ); |
| 7 |
|
| 8 |
DtUiMWSignatureContextItem.static.name = 'dtMwSignature'; |
| 9 |
|
| 10 |
DtUiMWSignatureContextItem.static.modelClasses = [ require( './dt.dm.MWSignatureNode.js' ) ]; |
| 11 |
|
| 12 |
DtUiMWSignatureContextItem.static.label = |
| 13 |
OO.ui.deferMsg( 'discussiontools-replywidget-signature-title' ); |
| 14 |
|
| 15 |
|
| 16 |
DtUiMWSignatureContextItem.prototype.getShortcutKey = function ( commandName ) { |
| 17 |
|
| 18 |
const commandInfo = ve.ui.commandHelpRegistry.lookup( commandName ); |
| 19 |
const triggerList = ve.ui.triggerRegistry.lookup( commandInfo.trigger ); |
| 20 |
const $shortcut = $( '<kbd>' ).addClass( 've-ui-commandHelpDialog-shortcut' ).append( |
| 21 |
triggerList[ 0 ].getMessage( true ).map( ve.ui.CommandHelpDialog.static.buildKeyNode ) |
| 22 |
).find( 'kbd + kbd' ).before( '+' ).end(); |
| 23 |
return $shortcut; |
| 24 |
}; |
| 25 |
|
| 26 |
|
| 27 |
DtUiMWSignatureContextItem.prototype.renderBody = function () { |
| 28 |
this.$body.empty().append( mw.message( |
| 29 |
'discussiontools-replywidget-signature-body', |
| 30 |
$( '<code>' ).text( '~~~~' ), |
| 31 |
this.getShortcutKey( 'undo' ) |
| 32 |
).parseDom() ); |
| 33 |
}; |
| 34 |
|
| 35 |
ve.ui.contextItemFactory.register( DtUiMWSignatureContextItem ); |
| 36 |
|
| 37 |
module.exports = DtUiMWSignatureContextItem; |