Hello Everybody,
I've been strugling with this all day now, maybe somebody can help.
I'm writing a small plugin the adds html to the ckeditor. This is done with the editor.insertHtml('html'); found in the documentation.
This works when i've got one instance of ckeditor on the page. When i've got two instances (with different names, for example editor1 and editor2) the data is always inserted in the editor that was last initialized.
I'm using CKEditor 3.6.6.1 (revision 7696)
Please can someone help me with this problem. It's driving me crazy.
You can use the HTML Buttons
You can use the HTML Buttons plugin to easily create such a button changing just your configuration. Or if you still want to create your own code, then check how that plugin works.
I've looked at HTML Buttons
I've looked at HTML Buttons and i don't see anything different in the editor.insertHtml code then the code i wrote.
The command is actually working in my code. It just sends the data to the wrong editor. When i do something like alert(editor.name); i also get the wrong name.
when i try CKEDITOR.instances.editor1.insertHtml(html) it works ok (but only for the instance with that name).
The plugin i'm writing is a little more complex then just adding pre difined HTML code to the page. So i can't use HTML Buttons for this purpose (it's something to select an image from a database, that is inserted to the html with prettyPhoto code added to it for a blowup image).