|
|
(No se muestran 36 ediciones intermedias del mismo usuario) |
Línea 1: |
Línea 1: |
| /* Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada carga de página */
| |
|
| |
| (function () { | | (function () { |
| /* TODO LO QUE META AQUI LO VA A EJECUTAR ANTES DE CARGAR LA PAGINA */ | | /* TODO LO QUE META AQUI LO VA A EJECUTAR ANTES DE CARGAR LA PAGINA */ |
|
| |
| // --------- (start of ve.ui.CenterAction definition) -----------------------------------------------
| |
| // This is based on [lib/ve/src/ui/actions/ve.ui.BlockquoteAction.js] from Extension:VisualEditor.
| |
|
| |
| mw.loader.using( [ 'ext.visualEditor.core', 'ext.visualEditor.mwtransclusion' ], function makeMyTool() {
| |
| // Get selection
| |
|
| |
| //Create and register command
| |
| var myTemplate = [ {
| |
| type: 'mwTransclusionBlock',
| |
| attributes: {
| |
| mw: {
| |
| parts: [ {
| |
| template: {
| |
| target: {
| |
| href: 'Template:Versal2',
| |
| wt: 'Versal2'
| |
| },
| |
| params: {
| |
| 1: {
| |
| wt: 'El texto fijo'
| |
| }
| |
| }
| |
| }
| |
| } ]
| |
| }
| |
| }
| |
| }, {
| |
| type: '/mwTransclusionBlock'
| |
| } ];
| |
|
| |
| ve.ui.commandRegistry.register(
| |
| new ve.ui.Command( 'mycommand', 'content', 'insert', {
| |
| args: [ myTemplate, false, true ],
| |
| supportedSelections: [ 'linear' ]
| |
| } )
| |
| );
| |
|
| |
| });
| |
|
| |
|
| |
| //Create and register wikitext command
| |
| if ( ve.ui.wikitextCommandRegistry ) {
| |
| ve.ui.wikitextCommandRegistry.register(
| |
| new ve.ui.Command( 'mycommand', 'mwWikitext', 'wrapSelection', {
| |
| args: [ '{{Versal2|', '}}', 'my parameter' ],
| |
| supportedSelections: [ 'linear' ]
| |
| } )
| |
| );
| |
| }
| |
|
| |
| //Create and register tool
| |
| function MyTool() {
| |
| MyTool.parent.apply( this, arguments );
| |
| }
| |
| OO.inheritClass( MyTool, ve.ui.MWTransclusionDialogTool );
| |
|
| |
| MyTool.static.name = 'mytool';
| |
| MyTool.static.group = 'textStyle';
| |
| MyTool.static.title = 'My tool';
| |
| MyTool.static.commandName = 'mycommand';
| |
| ve.ui.toolFactory.register( MyTool );
| |
|
| |
| // Initialize
| |
| mw.hook( 've.loadModules' ).add( function( addPlugin ) {
| |
| addPlugin( makeMyTool );
| |
| } );
| |
|
| |
|
|
| |
|