I am currently working on a gadget to apply custom text colors in VisualEditor, but it is not working as expected. Specifically, when I select a color, the text does not change color, and only a tag is generated.
MediaWiki 1.39.0 PHP 7.4.33 (fpm-fcgi) VisualEditor 0.1.2 Issues When a color is selected, the text does not change color, and only a tag is generated. Console logs indicate that the annotation is being applied, but it does not reflect in the editor. Questions Is there an issue with my code, or are there any improvements that can be made? What is the correct way to apply custom text colors in VisualEditor?
Here is a summary of my code:
mw.loader.using([
'ext.visualEditor.core',
'ext.visualEditor.desktopArticleTarget.init',
'ext.visualEditor.targetLoader',
'ext.visualEditor.data'
]).then(function() {
const toolGroup = document.querySelector(".oo-ui-toolbar-tools");
if (toolGroup) {
const newTool = document.createElement("span");
newTool.className = "oo-ui-widget oo-ui-tool oo-ui-popupToolGroup";
newTool.innerHTML = `