I have a page - editor.htm - which defines the editor rather like this (unimportant details snipped). I have a config.js in the same folder which defines my stuff; it's loading properly.My c# app loads a document on disk and sets its data into the editor using setData() after the EditorReady event fires. This is running inside a C# winforms app and loading files from C: to edit; but it's an IE instance window inside the app which hosts the editor.
<textarea cols="80" id="htmlEditor" name="htmlEditor" rows="10" ></textarea> <script type="text/javascript"> CKEDITOR.replace('htmlEditor', {}); CKEDITOR.on('instanceReady', function (ev) { var editor = ev.editor; editor.execCommand('maximize'); if (window.external.EditorReady) { // notify editor is ready in winForms application window.external.EditorReady(); } }); CKEDITOR.on('configLoaded', function (ev) { alert("configLoaded"); }); CKEDITOR.on('configLoaded', function (ev) { alert("configLoaded"); }); CKEDITOR.on('setData', function (ev) { alert("setData"); }); </script>
Neither configLoaded
or setData fire (show the alerts), even though data is actually being set in the editor. If I snoop ev.editor.getData() during instanceReady I get to see that the document is blank - e.g. setData hasn't happened yet. I want to look at any data handed in by the C# app's call to setData() BEFORE it gets put into the editor window. But the events that are supposed to be for snooping this data do not fire.
The documentation at http://docs.cksource.com/ckeditor_api/s ... nt:setData is next to useless because it doesn't show any examples, or describe any return values, or anything. E.g. the wording on "setData" is Event fired before the #setData call is executed allowing additional manipulation. - do I return a string? Do I return true or false to prevent the event? E.g. can capture the data being set, modify it using an expression, then hand the result to the editor?