Hi,

I've patched the draft.js file to add the ability to save node taxonomies. The problem relied on the fields' name containing square brackets "[]". I do not send the form to draft.module as "normal" php form, or I'll have PHP split it in arrays, and serializing them as such. Before sending the form, I simply convert "["s in "("s and "]"s in ")"s in the field name... before restoring I do the reverse convertion.

Patch attached (I'm also using "my" code for FCKEditor, that seems to work better than yours)

Thank you :)

CommentFileSizeAuthor
draft.js_.patch3.57 KBflexer

Comments

darren.ferguson’s picture

Status: Needs review » Closed (fixed)

Flexer
Patch has been applied and tested, the - and + seemed to be the wrong way around in the patch file, but it is all good.
It is now in the HEAD.

I am going to package up a new release so that people get the latest from this since it has a lot of fixes since the 6.1 release.

darren.ferguson’s picture

Flexer have added the information to the module, this is now closed it is in the latest stable release

vijaythummar’s picture

Status: Closed (fixed) » Active

when populating form

I am getting value "fckLaunchedTextareaId.length" is 0.

thats why i could not get populated body of content. rest of the things is working fine.

Please help me.

vijay

flexer’s picture

hello,

are you using FCK or not? Are you using Tinymce? Or nothing at all?

vijaythummar’s picture

yes I am using FCKEditor_2.6.3 and my code for populate form is


/**
 * Function re-populates the form with the information
 */
Drupal.draft.populateForm = function() {
  // This is so the select box data will be correctly displayed
 
for (key in Drupal.settings.draft.form_data) {
    saved = Drupal.settings.draft.form_data[key];
    delete Drupal.settings.draft.form_data[key];
    key = key.replace(/\(/g,'[').replace(/\)/g,']');
    Drupal.settings.draft.form_data[key] = saved;
  }

  $('#' + Drupal.settings.draft.form_id).formHash(Drupal.settings.draft.form_data);
  // for tinyMCE editor
  if (typeof tinyMCE == 'object') {
    for (var obj in tinyMCE.editors) {
      var editor = tinyMCE.editors[obj];
      var text = $('#' + Drupal.settings.draft.form_id + ' #' + obj).val();
      if (text) {
        editor.setContent(text);
      };
    };
  };

alert(fckLaunchedTextareaId.length);
alert(fckLaunchedJsId);
  // for FCKEditor
  if (typeof FCKeditor == 'function' && fckLaunchedTextareaId.length) {
    for ( var i = 0; i < fckLaunchedTextareaId.length; i++) {
      var text = document.getElementById(fckLaunchedTextareaId[i]).value;
      if (text) {
        FCKeditorAPI.GetInstance(fckLaunchedJsId[i]).InsertHtml(text);
      }
    };
  };
}


I have alter(fckLaunchedTextareaId.length) value but i am getting 0 and my content is not populating in fckeditor.

Please help me.

vijay

flexer’s picture

vijaythummar this is *not* the latest version of the MODULE. Please upgrade.

I was not talking about the version of the FCK, but about the version of the module.

As you may see in the new draft.js, the way to interact with FCK is:

  // adding FCKEditor support
  if (typeof FCKeditorAPI == 'object') {
    for( var i = 0 ; i < fckLaunchedJsId.length ; i++ ) { 
      var fck = FCKeditorAPI.GetInstance( fckLaunchedJsId[i] );
      fck.UpdateLinkedField();
    }
  }
darren.ferguson’s picture

Status: Active » Closed (fixed)