I want to change the output of CKEditor whenever something calls getData() to return the contents of the editor frame.
In this case I have several 's with the "_cke_code" attribute set with some encoded data that I want to transform when exterior code calls getData(). The documentation for CKEditor is patchy at best so I'm kinda stabbing in the dark with how to accomplish this. Looking at the code from the CKEditor FakeObjects.js plugin it seems like I need to register a rule with the dataprocessor's HTMLFilter, which I've attempted with:
// Nommed essentially verbatim from the FakeObjects plugin
var dataProcessor = editor.dataProcessor,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
htmlFilter.addRules({
elements:
{
$: function (element) {
var attributes = element.attributes,
realHtml = attributes && attributes._cke_realelement,
realFragment = realHtml && new CKEDITOR.htmlParser.fragment.fromHtml(decodeURIComponent(realHtml)),
realElement = realFragment && realFragment.children[0];
if (realElement) {
return realElement;
}
return element;
}
}
});
But it doesn't appear to actually even get called. :o I'm at a loss really, any help would be very appreciated. :)