Diferencia entre revisiones de «MediaWiki:Gadget-Versalitas.js»
De EIFA - Estudios Interdisciplinares de las Fuentes Avilistas
Línea 19: | Línea 19: | ||
template: { | template: { | ||
target: { | target: { | ||
href: 'Template: | href: 'Template:Versal', | ||
wt: ' | wt: 'versal' | ||
}, | }, | ||
params: { | params: {} | ||
} | } | ||
}] | }] | ||
} | } | ||
} | } | ||
} , { | }, | ||
{ | |||
type: '/mwTransclusionInline' | type: '/mwTransclusionInline' | ||
} ] ); | }, | ||
} ); | // Aquí va el texto original sin modificar | ||
{ | |||
type: 'text', | |||
text: wikitext | |||
}, | |||
// Plantilla de cierre | |||
{ | |||
type: 'mwTransclusionInline', | |||
attributes: { | |||
mw: { | |||
parts: [{ | |||
template: { | |||
target: { | |||
href: 'Template:Fin', | |||
wt: 'fin' | |||
}, | |||
params: {} | |||
} | |||
}] | |||
} | |||
} | |||
}, | |||
{ | |||
type: '/mwTransclusionInline' | |||
} | |||
]); | |||
}); | |||
}; | }; | ||
Revisión del 19:20 29 jun 2025
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:Versal',
wt: 'versal'
},
params: {}
}
}]
}
}
},
{
type: '/mwTransclusionInline'
},
// Aquí va el texto original sin modificar
{
type: 'text',
text: wikitext
},
// Plantilla de cierre
{
type: 'mwTransclusionInline',
attributes: {
mw: {
parts: [{
template: {
target: {
href: 'Template:Fin',
wt: 'fin'
},
params: {}
}
}]
}
}
},
{
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 );