hi there
I have a problem driving me crazy. CK3.6 with jQuery adapter.
I have a page divided into 3 panels. one panel containing various html-forms, loaded by ajax. The <script> tag to load the ckeditor is never reloaded, it is loaded once when the panel framework loads.
Then I have init functions which run upon loading complete of a html-form, in this example the user_edit_form. I use a jQuery selector to get all needed textareas of the form loaded to convert them to CKE.
this function shows my problem: when the page loads for the first time, there are no instances of CKE. Everything works. I can edit the text and it is propagated to the underlying <textarea>.
Then I save the form using ajax $.post(). I tehn load the form panel again with other / or even same data. the editor is showing the new content. OF course, I had to check whether the instance is already there. I tried several things but nothing worked. So I stick with the code as see above.
The CK appears and has the new data. HOWEVER, from now on, it does no longer update the underlying <textarea>!
The preview function DOES NOT show text changed, the source code button DOES SHOW the text changed, really ugly ... the only remedy is to reload the entire html page ... which is not the intention of ajax.
I therefore made an form exit funtction which I call before the $.post() like this to see if this helps:
The underlying <textarea> is not updated. What the heck then does updateElement()?
What is wrong with the code or how can I solve this problem?
It urges ... I am behind in my project because of this ..
Thank you for helping
Martin
I have a problem driving me crazy. CK3.6 with jQuery adapter.
I have a page divided into 3 panels. one panel containing various html-forms, loaded by ajax. The <script> tag to load the ckeditor is never reloaded, it is loaded once when the panel framework loads.
Then I have init functions which run upon loading complete of a html-form, in this example the user_edit_form. I use a jQuery selector to get all needed textareas of the form loaded to convert them to CKE.
user_form_init = function () { $('.ck3').each (function (index) { // we have to check whether the instance already exists var editor = CKEDITOR.instances[this.id]; // alert(typeof (editor)); if (typeof (editor) == 'object') { // this does not work because the instance is there but the control is gone // therefore instead of setting the data we kill the instance // editor.setData ($(this).val(), function() { editor.checkDirty(); } ); editor.destroy(); } $(this).ckeditor( { #session.ck3editor_options# } ); });
this function shows my problem: when the page loads for the first time, there are no instances of CKE. Everything works. I can edit the text and it is propagated to the underlying <textarea>.
Then I save the form using ajax $.post(). I tehn load the form panel again with other / or even same data. the editor is showing the new content. OF course, I had to check whether the instance is already there. I tried several things but nothing worked. So I stick with the code as see above.
The CK appears and has the new data. HOWEVER, from now on, it does no longer update the underlying <textarea>!
The preview function DOES NOT show text changed, the source code button DOES SHOW the text changed, really ugly ... the only remedy is to reload the entire html page ... which is not the intention of ajax.
I therefore made an form exit funtction which I call before the $.post() like this to see if this helps:
user_form_exit = function () { $('.ck3').each (function (index) { var editor = CKEDITOR.instances[this.id]; if (typeof (editor) == 'object') { editor.updateElement(); // alert ('Editor mode ' + editor.elementMode); alert (this.id + ' contains: ' + $(this).val ()); } } ); }
The underlying <textarea> is not updated. What the heck then does updateElement()?
What is wrong with the code or how can I solve this problem?
It urges ... I am behind in my project because of this ..
Thank you for helping
Martin
Re: 3.6 + jquery +update problem when instance already exist
Did you find a solution
I also try to destroy/recreate the editor using jquery or directly ckeditor javascript api, but the second time the element is never uploaded
Re: 3.6 + jquery +update problem when instance already exist
No. I've tried a lot of things, but to no avail.
It's extremely annoying, because my customer's backoffice where i wanted to use that with ajax still behaves ugly due to that ...
Re: 3.6 + jquery +update problem when instance already exist
Re: 3.6 + jquery +update problem when instance already exist
in the meantime I downloaded 3.6.1 which does not solve the problem.
Maybe there is another way how to kill an instance reliably and/or to make sure that CKeditor's internal structures are synched again with the textarea ... there is something strange going on ... as I said, the source code view always shows all changes (as expected) but the preview never shows text changes ... how the heck can this happen ... really ugly.
maybe i should switch to TinyMCE? Have you tried that already? I abandonned it long time ago ... never had any reason to return to it .... but i never know ... should i invest some time into it?
Martin