I've written a very basic plugin which populates a RichCombo with a bunch of variables. EG.
First Name {firstname}
Last Name {lastname}
When you select one of these, it simply inserts {lastname} into the editor (which is what our templating engine on the server uses for displaying data).
What I would like to do, is when you select a variable, it would actually display something a little nicer inside the editor such as a nicely css styled tag <span class="cute-tag">First Name</span> rather than the boring old plain {firstname} which doesn't mean a lot to the user.
However this would only be for display purposes in the editor, the real data that gets saved needs to end up as {firstname} - which I find realy hard!:)
I've tried looking at the fakeobjects plugin (which seems to only support having an img tag), but I'm not getting very far... any help or direction would be appreciated.
Edit - I should mention, I am working with CKEditor 4.1 - yes that would be good to mention
this can help to return the html tag selected
function getSelectionHtml(editor)
{
var sel = editor.getSelection();
var ranges = sel.getRanges();
var el = new CKEDITOR.dom.element("span");
for (var i = 0, len = ranges.length; i < len; ++i)
{
el.append(ranges[i].cloneContents());
}
return el.getHtml();
}