The lack of a detach method on the WYSIWYG Drupal.behaviors object causes WYSIWYG in multi value fields to clear the value of the WYSIWYGs when "Add another item" is clicked.

I've attached a patch that detaches the WYSIWYG so that it's value can be passed to the AJAX callback and the form rebuilt with the value kept.

Comments

I applied this manually to version 7.x-2.1.

Seems to work perfectly.

Solved my issue discussed here: http://drupal.org/node/1238464

Would love it if this could be integrated into the main release.

StatusFileSize
new610 bytes

I also needed a detach function, and just came up with one that's working for me (I think the above looks better, but my version is attached).

My issue is that I'm using wysiwyg (ckeditor) within an ajax multistep form. When I hit the 'next' button to go to my next step in the form, the text in the wysiwyg would be lost as the containing form was not conventionally submitted to trigger Drupal.wysiwygDetach.

Adding a detach function fixed it.

Patch at #1 worked for me as well. Had the same issue described in the Issue Summary

subscribing

Patch #1 works great for me, had the same issue. Applied to 7.x-2.1.

Please clarify, #1 has no patch. Did you mean the patch in the original post, or the one in #2?

Apologies, I meant the original post.

Status:Needs review» Reviewed & tested by the community

Thank you!!
james.elliott's patch works for me as well with both CKeditor and TinyMCE (had to clear cache to take effect)

subscribe

OP's post is the only way I could get field collections to work with "WYSIWYG: CKEditor". Thanks a million!

0001-Fix-multi-value-fields-with-WYSIWYG.patch works like a charm and solves the problem of wysiwyg fault on multiple text area fields.
When does this get commited into wysiwyg api's code base??

0001-Fix-multi-value-fields-with-WYSIWYG.patch works fine here as well. Thanks a lot!

Version:7.x-2.0» 7.x-2.x-dev
Status:Reviewed & tested by the community» Fixed
StatusFileSize
new1.04 KB

+++ b/wysiwyg.js
@@ -80,6 +80,13 @@ Drupal.behaviors.attachWysiwyg = {
+    $('.wysiwyg-processed', context).each(function (index, element) {
+      $(element).removeClass('wysiwyg-processed');

We have .removeOnce() for that. :)

Thanks for reporting, reviewing, and testing! Committed attached patch to 7.x-2.x.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status:Closed (fixed)» Active

I have still getting this issue and i have latest version of wysiwyg 7.x-2.1.
I am using TinyMCE 3.5.6 version for wysiwyg.
I check the ajax request still editor value is going empty.

Status:Active» Closed (fixed)

There has not been an official release since this patch was committed. You need Wysiwyg 7.x-2.x-dev until we have another release (7.x-2.2).

Thanks for this! Patch at #13 worked a charm.

@MattBondi, you should no longer need the patch since it's now part of 7.x-2.2.

Can this patch be applied to the latest WYSIWYG 6.x tree as well?

The problem still persists in the 6.x version.

Actually can see now that they are quite different and I gather that no patch for 6.x is forthcoming. Ohwell.

Well I am just posting my code here that fixes the issue for me without messing in Wyswig.

Just put this in a separate JS file in your theme or whatever (Make sure to change to Jquery ID 's :-) )

/**
* Bug fix bug in Wysiwyg module that will not get backported to D6.
*/
jQuery(document).ajaxSend(function(event, jqxhr, settings) {
  if ( settings.url.indexOf('content_multigroup/js_add_more/article/group_article_paragraph') >= 0 ) {
    // Getting my values.
    var htmlOfTextAreas = new Array();
    for (var j = 0; j < 25; j++) {
      if (jQuery('#edit-group-article-paragraph-' + j + '-field-article-paragraph-text-value_ifr').length > 0) {
        htmlOfTextAreas.push(jQuery('#edit-group-article-paragraph-' + j + '-field-article-paragraph-text-value_ifr').contents().find("body").html());
      }
      else {
        // Skip the loop
        break;
      }
    }
    // group_article_paragraph[0][field_article_paragraph_text][value]
    var dataSettings = settings.data;
    // Splitting the string to an array.
    var htmlArray = dataSettings.split("&");
    var counterHtmlArray = 0;
    for (var i = 0; i < htmlArray.length; i++) {
      // Split the key value pair so I can check.
      var keyValue = htmlArray[i].split("=");
      if (keyValue[0].indexOf("field_article_paragraph_text") !== -1 && keyValue[0].indexOf("value") !== -1) {
        keyValue.splice(1, 1);
        keyValue.push(htmlOfTextAreas[counterHtmlArray]);
        var noSplittedArrayBackToString = keyValue.join("=");
        htmlArray[i] = noSplittedArrayBackToString;
        counterHtmlArray++;
      }
    }
    // Passing back to new settings array.
    var noSplittedHtmlArray = htmlArray.join("&");
    settings.data = noSplittedHtmlArray;
  }
});

hope this helps someone

@TwoD:I have 7.x 2.2 installed and I get the same error. With WYSIWYG and TinyMCE. I am creating my fields through the latest version of Field collections. Any ideas what the problem could be?

I have the same issue with Wysiwyg 7.x-2.2. Can we reopen this issue and look further?

@lakes and @artem.kolotilkin: Do you have the media module installed? If so, check #2107271: Method in media.filter.js receives different types of arguments as this was the problem on my side... But unfortunately my issue has been "ignored" by the media guys until now :(

Cheers

hctom

Issue summary:View changes

Also experiencing the same issue with latest dev and patches included. CKEditor will not render with Field Collections on same edit page.
Drupal core 7.26
wysiwyg 7.x-2.2+26-dev (2014-Feb-07)
field_collection 7.x-1.0-beta5+8-dev (2013-Oct-10)