Debian Codegraph @

extensions/DiscussionTools/modules/dt-ve/dt.ui.MWSignatureContextItem.js

raw symbols SCIP
1 function DtUiMWSignatureContextItem() {
2 // Parent constructor
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 // Get the formatted, localized, platform-specific shortcut key for the given command
16 DtUiMWSignatureContextItem.prototype.getShortcutKey = function ( commandName ) {
17 // Adapted from ve.ui.CommandHelpDialog.prototype.initialize
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 // Add a description saying that typing a signature is not needed here
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;