I'm trying to load our corporate palette into the text colour picker in TinyMCE on a Pone 5.1.6 site.
I've added the text colour pickers to the TinyMCE menu by ticking the "textcolor" and "colorpicker" checkboxes under Site Setup > TinyMCE > Plugins and Toolbar > Editor Plugins, and then adding "| forecolor backcolor" to Site Setup > TinyMCE > Plugins and Toolbar > Toolbar. This worked fine.
I altered the format slightly from what appears in the TinyMCE docs (basically just putting color-map in quotes) so that Plone would accept it as valid JSON.
In any case, that didn't produce any change in the colour picker at all.
I feel like this is a small formatting error, but I've fiddled with it a fair bit with no luck. Any idea what I'm doing wrong?
I've tried using Site Setup > Resource Registries > Overrides to customize that version of the colour map as a sort-of-hacky solution, but I can't figure out how to make it take effect.
After making my changes, I click "Save", but even though it now shows up in the list as "Customized", if I load another file and then go back to that file, my changes aren't there. Going to the "Registry" tab and setting the site to Development Mode, clicking Develop JavaScript on the Plone-Logged-In bundle (which appears to be the bundle which includes that resource) doesn't seem to help, nor does re-building that bundle. Going back to "Overrides" and selecting the resource in question always shows the original version without my customizations, and there are no changes in the site.
I agree that it seems weird with them not being an array of tuples or an array of two-element arrays or something, but if you look at the actual JavaScript for the plugin, it's arranged the same way there:
When it parses the colour map, it increments by 2 and processes two elements of the array at a time:
var mapColors = function (colorMap) {
var i;
var colors = [];
for (i = 0; i < colorMap.length; i += 2) {
colors.push({
text: colorMap[i + 1],
color: '#' + colorMap[i]
});
}
return colors;
};
If you add the # before the colours, Plone rejects it as invalid JSON. (I initially had it in there. Also, you can see the line in the JavaScript above where it prepends the # to the colour values in the array.)
What I've been trying to do in the meantime is go into the resource registry and modify the default colourmap declaration above. However, when I save it, it doesn't seem to "take". Oddly, if I go into the ZMI, my modifications show up under Plone > portal_resources > resource_overrides > static > components > tinymce-builded > js > tinymce > plugins > textcolor > plugin.js. So it's being "saved" in some sense. But if I go back to Site Setup > Resource Registries > Overrides and pick the javascript file, it shows the original code, and building the logged-in bundle results in the original variable declaration being in the compiled code, not my modified version.