Diferencia entre revisiones de «MediaWiki:Gadget-Versalitas.js»

De EIFA - Estudios Interdisciplinares de las Fuentes Avilistas
Etiqueta: Revertido
 
(No se muestran 25 ediciones intermedias del mismo usuario)
Línea 1: Línea 1:
mw.loader.using( 'ext.visualEditor.targetLoader', function () {
ve.ui.VersalitasCommand = function VeUiVersalitasCommand() {
mw.libs.ve.targetLoader.addPlugin( function () {
ve.ui.VersalitasCommand.super.call( this, 'Versalitas' );
var nowikiLabel = 'Disable markup';
};
OO.inheritClass( ve.ui.VersalitasCommand, ve.ui.Command );


ve.ui.wikitextCommandRegistry.register(
ve.ui.VersalitasCommand.prototype.execute = function ( surface ) {
new ve.ui.Command(
var model = surface.getModel(),
'nowiki', 'mwWikitext', 'toggleWrapSelection',
doc = model.getDocument(),
{ args: [ '<nowiki>', '</nowiki>', nowikiLabel ], supportedSelections: [ 'linear' ] }
range = model.getSelection().getRange(),
)
docRange = doc.shallowCloneFromRange( range );
);


ve.ui.NowikiTool = function () {
ve.init.target.getWikitextFragment( docRange, false ).done( function ( wikitext ) {
ve.ui.NowikiTool.super.apply( this, arguments );
model.getFragment().insertContent([
};
{
OO.inheritClass( ve.ui.NowikiTool, ve.ui.Tool );
type: 'mwTransclusionInline',
ve.ui.NowikiTool.static.name = 'nowiki';
attributes: {
ve.ui.NowikiTool.static.group = 'textStyle';
mw: {
ve.ui.NowikiTool.static.icon = 'noWikiText';
parts: [{
ve.ui.NowikiTool.static.title = nowikiLabel;
template: {
ve.ui.NowikiTool.static.commandName = 'nowiki';
target: {
ve.ui.toolFactory.register( ve.ui.NowikiTool );
href: 'Template:Versales',
wt: 'Versales'
},
params: {
1: {
wt: wikitext
}
}
}
}]
}
}
} , {
type: '/mwTransclusionInline'
} ] );
} );
};


for (var i in ve.init.mw.targetFactory.registry ) {
ve.ui.commandRegistry.register( new ve.ui.VersalitasCommand() );
var targetClass = ve.init.mw.targetFactory.registry[ i ];
 
try {
ve.ui.VersalitasTool = function VeUiVersalitasTool() {
targetClass.static.toolbarGroups.find( function ( group ) { return group.name === 'style' } ).demote.push( 'nowiki' );
ve.ui.VersalitasTool.super.apply( this, arguments );
} catch ( err ) {}
};
}
OO.inheritClass( ve.ui.VersalitasTool, ve.ui.Tool );
} );
ve.ui.VersalitasTool.static.name = 'Versalitas';
} );
ve.ui.VersalitasTool.static.group = 'textStyle';
ve.ui.VersalitasTool.static.icon = 'largerText';
ve.ui.VersalitasTool.static.title = 'Versalitas';
ve.ui.VersalitasTool.static.commandName = 'Versalitas';
ve.ui.toolFactory.register( ve.ui.VersalitasTool );

Revisión actual - 17:48 22 ene 2022

ve.ui.VersalitasCommand = function VeUiVersalitasCommand() {
	ve.ui.VersalitasCommand.super.call(	this, 'Versalitas' );
};
OO.inheritClass( ve.ui.VersalitasCommand, ve.ui.Command );

ve.ui.VersalitasCommand.prototype.execute = function ( surface ) {
	var model = surface.getModel(),
		doc = model.getDocument(),
		range = model.getSelection().getRange(),
		docRange = doc.shallowCloneFromRange( range );

	ve.init.target.getWikitextFragment( docRange, false ).done( function ( wikitext ) {
		model.getFragment().insertContent([
			{
				type: 'mwTransclusionInline',
				attributes: {
					mw: {
						parts: [{
							template: {
								target: {
									href: 'Template:Versales',
									wt: 'Versales'
								},
								params: {
									1: {
										wt: wikitext
									}
								}
							}
						}]
					}
				}
			} , {
				type: '/mwTransclusionInline'
			} ] );
	} );
};

ve.ui.commandRegistry.register( new ve.ui.VersalitasCommand() );

ve.ui.VersalitasTool = function VeUiVersalitasTool() {
	ve.ui.VersalitasTool.super.apply( this, arguments );
};
OO.inheritClass( ve.ui.VersalitasTool, ve.ui.Tool );
ve.ui.VersalitasTool.static.name = 'Versalitas';
ve.ui.VersalitasTool.static.group = 'textStyle';
ve.ui.VersalitasTool.static.icon = 'largerText';
ve.ui.VersalitasTool.static.title = 'Versalitas';
ve.ui.VersalitasTool.static.commandName = 'Versalitas';
ve.ui.toolFactory.register( ve.ui.VersalitasTool );