ckEditor has example: ckeditor/_samples/api_dialog/my_dialog.js - ckeditor/_samples/api_dialog.html
Key to code for you:
-
http://docs.cksource.com/ckeditor_api/index.html
- html element: type = html; html = source (use when define: contents - elements)
- onOk: function () {return false;} // don't close dialog after click OK button
- CKEDITOR.dialog.getCurrent().destroy(); // close current dialog by your code
- CKEDITOR.instances['editor1'] or CKEDITOR.instances.editor1: get ckeditor for #editor1. Now you can insert code in any js function -> append your data to #editor1.
Example: