| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
ve.ui.MWSignatureTool = function VeUiMWSignatureTool() { |
| 18 |
|
| 19 |
ve.ui.MWSignatureTool.super.apply( this, arguments ); |
| 20 |
}; |
| 21 |
OO.inheritClass( ve.ui.MWSignatureTool, ve.ui.MWTransclusionDialogTool ); |
| 22 |
|
| 23 |
ve.ui.MWSignatureTool.static.name = 'mwSignature'; |
| 24 |
ve.ui.MWSignatureTool.static.group = 'object'; |
| 25 |
ve.ui.MWSignatureTool.static.icon = 'signature'; |
| 26 |
ve.ui.MWSignatureTool.static.title = |
| 27 |
OO.ui.deferMsg( 'visualeditor-mwsignature-tool' ); |
| 28 |
ve.ui.MWSignatureTool.static.modelClasses = [ ve.dm.MWSignatureNode ]; |
| 29 |
|
| 30 |
ve.ui.MWSignatureTool.static.commandName = 'mwSignature'; |
| 31 |
|
| 32 |
ve.ui.toolFactory.register( ve.ui.MWSignatureTool ); |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
if ( mw.Title.wantSignaturesNamespace( mw.config.get( 'wgNamespaceNumber' ) ) ) { |
| 37 |
|
| 38 |
ve.ui.commandRegistry.register( |
| 39 |
new ve.ui.Command( 'mwSignature', 'content', 'insert', { |
| 40 |
args: [ |
| 41 |
[ |
| 42 |
{ type: 'mwSignature' }, |
| 43 |
{ type: '/mwSignature' } |
| 44 |
], |
| 45 |
|
| 46 |
false, |
| 47 |
|
| 48 |
true |
| 49 |
], |
| 50 |
supportedSelections: [ 'linear' ] |
| 51 |
} ) |
| 52 |
); |
| 53 |
ve.ui.sequenceRegistry.register( |
| 54 |
new ve.ui.Sequence( 'wikitextSignature', 'mwSignature', '~~~~', 4 ) |
| 55 |
); |
| 56 |
ve.ui.commandHelpRegistry.register( 'insert', 'mwSignature', { |
| 57 |
sequences: [ 'wikitextSignature' ], |
| 58 |
label: OO.ui.deferMsg( 'visualeditor-mwsignature-tool' ) |
| 59 |
} ); |
| 60 |
if ( mw.libs.ve.isWikitextAvailable ) { |
| 61 |
|
| 62 |
mw.loader.using( 'ext.visualEditor.mwwikitext' ).then( () => { |
| 63 |
ve.ui.wikitextCommandRegistry.register( |
| 64 |
new ve.ui.Command( 'mwSignature', 'content', 'insert', { |
| 65 |
args: [ '~~~~', false, true ], |
| 66 |
supportedSelections: [ 'linear' ] |
| 67 |
} ) |
| 68 |
); |
| 69 |
} ); |
| 70 |
} |
| 71 |
} else { |
| 72 |
|
| 73 |
ve.ui.commandRegistry.register( |
| 74 |
new ve.ui.Command( 'mwSignature', 'content', 'insert', { |
| 75 |
args: [ [] ], |
| 76 |
supportedSelections: [] |
| 77 |
} ) |
| 78 |
); |
| 79 |
|
| 80 |
ve.ui.sequenceRegistry.register( |
| 81 |
new ve.ui.Sequence( 'wikitextSignature', 'mwWikitextWarning', '~~~' ) |
| 82 |
); |
| 83 |
} |