I'm using TinyMCE to allow users to make comments on existing text, but we want the existing text to remain black, but have the comments typed in red. I'm able to limit the color options to only have red with the textcolor_map option, but, even with this, the first character I type is still in black. Is there a way to force any new text to appear in red?
TinyMCE is really just allowing you to edit an HTML document so the rules behind the colors you see rendered in the editor are tied to the CSS that you apply to the content.
The textcolor_map
option you refer to has to do with the colors someone is allowed to pick via the color picker. The color picker wraps the selected text in a <span>
and applies the color you pick - so that won't really fix your issue.
If you want comments to have a different color from the original text you could wrap the comment in a <span>
and apply inline styles or CSS to that element to change the color of the text to red.
You can either try to capture keystrokes and wrap them in tags (not easy to get right) or you could use a toolbar button to "Add Comment" and then use a dialog to accept the text for the comment. When you insert the comment you could then color it appropriately. You can also use contenteditable="false"
to stop people from modifying the original text.
(I see you work for PSC Group ... tell John Head I say hello!)