I am creating an application with the TinyMCE editor built into it. I want the controls for my application to be updated when the selection changes inside the tinyMCE editor, so the font, size and color menus display the font, size and color of the selection. Font and color work fine, but I can't figure out how to get the color. Here is the code I'm using:
myTinyMCESettings.handle_node_change_callback = function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){ var editor = tinyMCE.get(editor_id); selectionChanged(editor,!any_selection); }; tinyMCE.init(myTinyMCESettings); function selectionChanged(ed,selection){ var fontName = ed.queryCommandValue('FontName'); var size = parseInt(ed.queryCommandValue('FontSize')); var color = ed.queryCommandValue('ForeColor'); }
But color === false . How to get the foreground color of selected text or text at an insertion point within tinyMCE?
EDIT: Track this further, on line 12377 of tiny_mce_prototype_src.js I see:
When I view this in my debugger, t.editorCommands.queryCommandValue(c); returns false.
source share