Hi,
I have a problem with the latest night build of CkEditor, on the first creation of editor (from javascript), dropdown's work fine, after I destroy the editor from script and recreate it, dropdown's stop working.
You can reproduce the error by following this steps:
open http://nightly.ckeditor.com/4311/_samples/ajax.html , then press Create editor
button, after editor loads select one of the dropdown (styles, format, font, size). Then click on Remove editor, after that again press Create editor and try to open one of the dropdowns (styles, format...), now they are not working, error message is: m.document.getById("cke_" + m.id) is null
Thanks
Mon, 10/05/2009 - 16:07
#1
Re: Strange bug with dropdown list (styles, format, font, size)
I am having this exact same problem, hopefully someone will help us out. I found this out after using the editor in my CMS to edit posts. When the user clicks on a post to edit it, an overlay appears with a ckeditor instance inside. This instance has the same name every time the user edits a post because it replaces the same textarea (in this case with an id of "post_content"), only the content it is filled with is differnet. When the user closes the overlay, the editor is destroyed by calling this code:
After this, any new instances will load fine and will pass their content using the "getData()" function (so users can still technically edit and save their posts) but none of the drop down menus work. As stated by pentijum, any subsequent instances' drop down menus will not function.
Is this a case of the instance still not being destroyed correctly? Would using the default numbered instance names alleviate the problem since the instance name will be different every time?
Thanks in advance!
Re: Strange bug with dropdown list (styles, format, font, size)
Hi again,
I don't know if it will help but to try and provide more clarity on the issue, I ran the situation through firebug and the console spit out this error when clicking on a drop down menu in the editor in the situations described above. Hopefully this will make sense to a developer out there and they can tell us what's up.
Re: Strange bug with dropdown list (styles, format, font, size)
Anyways, I would like to know a more permanent solution to this but, hey, at least this is 'something'.
Hope this helps someone!
Re: Strange bug with dropdown list (styles, format, font, size)
Hi, thank you for the workaround, but it seams that is not working (just tried on the latest 3.0.1 version
and it behaves the same (drop downs now working, even if editor gets a new name each time it's created).
To be honest, this is the main reason why I use in production only versions that are at least 6month - 1year old,
it makes my live a lot easier...
Re: Strange bug with dropdown list (styles, format, font, size)
Soooo....
To further iterate on a problem that seems to affect no one but me and maybe pentijum, I believe I've narrowed down the cause of the bug. It's not the fact that each instance has the same name, it is the "destroy()" method that seems to be causing the problem. If you refer to my last post, I thought I fixed the problem by adding my own counter to instance names when they were created, this way no instance had the same name. I actually fixed the problem by unintentionally bypassing the "destroy()" method as I forgot to add the same counter to the instance names that the method was destroying, therefore "destroy()" was never being called on the instances. Well, yesterday I saw that I forgot to add the counter to the instance names for the destroy method, so I did, and now each instance is destroyed but the bug appears again. When I bypass "destroy()" everything is fine.
Anyway, this makes since considering that the demo for the nightly build is not replacing a textarea and therefore probably has the default instance names of "editor1, editor2, etc" anyway, so instance names shouldn't be the problem. It just seems weird that you CANNOT open a new instance of CKeditor which has the same instance name as an old one without calling "destroy()" on the old instance first, but doing so breaks the new one.
Guess we need to wait on a new version for this to be fixed
Hope this helps!