I've been using CKEditor as my WYSIWYG through the CKEditor Drupal module.

This is the first time I've used CCK multifields (multiple textareas; click add for another textarea). So built the content-type with the multiple textarea field and tried to create a new instance of the content-type. The CKEditor showed up in the textarea and I filled it in, clicked "add another". The next textarea was added to the page but the content filled into the first one was erased, and the first textarea is no longer showing CKEditor, only the newly added textarea has CKEditor displayed. They both have the same url for including/excluding other then a difference in the index so CKEditor should be showing up. Adding a third removes the content from the first two, creates a third and only renders the third with CKEditor.

Anyone else having this issue?

Comments

icaro-muerto’s picture

I found that when using custom textareas, I had to select "Filtered text" instead of "plain text" in the text processing section. If you don't select that option, ckeditor won't show up (correct me if I'm wrong, I'm not very familiar with custom fields, but I'm getting the hang on it).

Now, I had the same problem for some instances of textareas, even with the filtered text option enabled. But those textareas had only one row. Putting three rows minimun on those textareas allowed me to use ckeditor.

You can try that. If that doesn't work, then you might want to check ckeditor permissions but I'm guessing that there's no problem there.

orjantorang’s picture

The CKEDITOR shows up on the first two fields. When adding text to the two first text areas and push "Add another item", your text disappear, if you haven't saved your node, and the two first text areas are now empty plain text areas.

I have both "Filtered text" on CCK settings for the field and adjusted the minimum rows value (minimum = 1 and field has 5 rows)
This happens even if I remove all exclusions in: admin/settings/ckeditor/editg

The field name differs from: project@node/add/project.edit-field-p-footers-0-value.
...to: content/js_add_more/project/field_p_footers.edit-field-p-footers-0-value.

But I don't think its the name on the field, because if I add one field, from two to three, the third field get CKEDITOR and has the name: content/js_add_more/project/field_p_footers.edit-field-p-footers-2-value

Some ideas?

axeff’s picture

I ran into the same problem and made a workaround that works for me, it's kind of dirty though.

The problem is the CKEditor. It works like a charm with NicEdit or the old FCKEditor. So if you don't have too much configuration pain, you should probably change the editor.

I first followed the steps to solve the first two points here: http://mostrey.be/wysiwyg-and-cck-multiple-value-fields (Wysiwyg API CCK Integration)

But it still would crack my existing editor-instances when adding another one, but I figured, that it worked when I manually disabled the existing editor-instances!

So first I managed to disable all instances before adding the new one using this js code:

function destroyWYSIWYG(){
    for(var instanceName in CKEDITOR.instances) {
        CKEDITOR.instances[instanceName].destroy();
    }
    return false;
}

That works exactly for adding ONE new Item, when I add the js-events (click, mousedown, keypress) to the "Add another" button:

function addEventToAddEntryButton(){
     $('#edit-field-content-field-content-add-more').click(function(){destroyWYSIWYG()})
                                                 .mousedown(function(){destroyWYSIWYG()})
                                                 .keypress(function(){destroyWYSIWYG()});
     }

The problem is that all existing multiple-fields will be rendered again after adding a new one (see firebug console - there is a POST with JSON response).

So you need to make sure to bind the above mentioned js-functions again after receiving post-data, because it's a new button.

This is where it becomes really dirty, because (to stay in project-time) I added the same call of addEventToAddEntryButton() to the object that I receive from the POST in cck/includes/content.node_form.inc

Within the
function content_add_more_js($type_name_url, $field_name) { ... }
function at the almost bottom, I added
$output_js .= "<script type='text/javascript'>setTimeout('addEventToAddEntryButton()',1000);</script>";

Now it works!

e10i’s picture

thx for the Fix,

i could get this a little cleaner by using a Drupal.behaviors snipppet,

Drupal.behaviors.destroyWYSIWYG_FIX = function(context) {
	$('#edit-field-content-field-content-add-more').click(function(){destroyWYSIWYG()})
                                                 .mousedown(function(){destroyWYSIWYG()})
                                                 .keypress(function(){destroyWYSIWYG()});
};

u can throw it anywhere in a custom module.

i hope this help.