MediaWiki:Common.js: Unterschied zwischen den Versionen
Aus RI Wiki
Zur Navigation springenZur Suche springen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 35: | Zeile 35: | ||
HighlightTool.static.title = 'Highlight text'; | HighlightTool.static.title = 'Highlight text'; | ||
HighlightTool.static.commandName = commandName; | HighlightTool.static.commandName = commandName; | ||
console.log(HighlightTool) | |||
if (!ve.ui.toolFactory.lookup('highlight')) { | if (!ve.ui.toolFactory.lookup('highlight')) { | ||
ve.ui.toolFactory.register(HighlightTool); | ve.ui.toolFactory.register(HighlightTool); | ||
console.log('Highlight tool registered with | console.log('Highlight tool registered with style group'); | ||
} | |||
if (ve.ui.toolFactory.lookup('highlight')) { | |||
console.log('Highlight tool found!!!!'); | |||
} | } | ||
}); | }); | ||
}); | }); |
Version vom 3. September 2025, 21:33 Uhr
mw.loader.using('ext.visualEditor.desktopArticleTarget.init').then(function () {
mw.hook('ve.activationComplete').add(function () {
console.log('ve.activationComplete fired, registering tool...');
function doHighlight(surface) {
var fragment = surface.getModel().getFragment();
var selectedText = fragment.getText();
if (!selectedText) {
return;
}
fragment.insertContent('{{Highlight|' + selectedText + '|yellow}}');
}
var commandName = 'insertHighlight';
if (!ve.ui.commandRegistry.lookup(commandName)) {
ve.ui.commandRegistry.register(
new ve.ui.Command(
commandName,
'content',
'exec',
{ args: [doHighlight] }
)
);
}
function HighlightTool(toolGroup, config) {
ve.ui.Tool.call(this, toolGroup, config);
}
OO.inheritClass(HighlightTool, ve.ui.Tool);
HighlightTool.static.name = 'highlight';
HighlightTool.static.group = 'style'; // Changed from 'textStyle' to 'insert'
HighlightTool.static.icon = 'highlight';
HighlightTool.static.title = 'Highlight text';
HighlightTool.static.commandName = commandName;
console.log(HighlightTool)
if (!ve.ui.toolFactory.lookup('highlight')) {
ve.ui.toolFactory.register(HighlightTool);
console.log('Highlight tool registered with style group');
}
if (ve.ui.toolFactory.lookup('highlight')) {
console.log('Highlight tool found!!!!');
}
});
});