Hi, I'm replacing an editor instance with different configs using javascript in an onChange Event of a checkbox input field.
I get an error in the clipboard plugin most of the time, but not always. Looks to me as if clipboard is reacting to the onChange of the checkbox but the editor might already be destroy()ed. Since this only (as far as I was testing) happens if the divarea plugin is used this also hints in that direction.
Here is a distilled setup:
<input id="swapEditor" type="checkbox" onChange="
if (this.checked) {
if (CKEDITOR.instances.text)
CKEDITOR.instances.text.destroy();
CKEDITOR.replace('text', {
toolbar:'Full',
extraPlugins:'divarea,clipboard'
/*someconfig*/});
} else {
if (CKEDITOR.instances.text)
CKEDITOR.instances.text.destroy();
CKEDITOR.replace('text', {
removePlugins:'toolbar',
extraPlugins:'divarea,clipboard'
/*some_other_config*/
});
}"/>
<textarea id="text">Content</textarea>
This causes the error:
- Uncaught TypeError: Cannot call method 'getRanges' of null
- stateFromNamedCommand plugin.js:906
- setToolbarStates plugin.js:880
- type plugin.js:485
where plugin.js is .../ckeditor/plugins/clipboard/plugin.js
When I go into the console and directly call
CKEDITOR.instances.text.destroy(); CKEDITOR.replace('text', { /* ... */});
everything works fine.
Im using Chrome and Firefox for testing, both show this behavior.
Anyone sees the problem here and can hint me towards a fix?
Regards

Since I suspect a bug - where
Since I suspect a bug - where do I post a bugreport for a plugin? In this case the clipboard plugin, which I believe to be a bundled standard plugin.
Please report it on http:/
Please report it on http://dev.ckeditor.com/. This is an official plugin.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Already reported here: http:/
Already reported here: http://dev.ckeditor.com/ticket/10219
Uh... right :) I was even
Uh... right :) I was even reviewing patch for this ticket. It is already closed (yesterday) - can you check if your version of this issue is fixed on master?
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Sure.
Sure.
Checked it and it is fixed in master (Downloaded 8th Apr 2013 14h45).
Regards.