Changeset 603


Ignore:
Timestamp:
04/21/09 22:21:44 (3 years ago)
Author:
jf.hovinne
Message:

Index is needed in the element replaced by WYMeditor, since it's not always the immediate previous element.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/apps/drupal/wysiwyg/editors/js/wymeditor.js

    r601 r603  
    1414  if (typeof params != 'undefined') { 
    1515    var $field = $('#' + params.field); 
    16     var instance = $field.next().data(WYMeditor.WYM_INDEX); 
    17     if (typeof instance != 'undefined') { 
    18       WYMeditor.INSTANCES[instance].update(); 
    19       $field.next().remove(); 
     16    var index = $field.data(WYMeditor.WYM_INDEX); 
     17    if (typeof index != 'undefined') { 
     18      var editor = WYMeditor.INSTANCES[index]; 
     19      editor.update(); 
     20      $(editor._box).remove(); 
     21      delete editor; 
    2022    } 
    2123    $field.show(); 
     
    2426    jQuery.each(WYMeditor.INSTANCES, function() { 
    2527      this.update(); 
    26       $(this._box).prev().show().end() 
    27         .remove(); 
     28      $(this._box).remove(); 
     29      $(this._element).show(); 
     30      delete this; 
    2831    }); 
    2932  } 
  • trunk/src/wymeditor/jquery.wymeditor.js

    r602 r603  
    741741      this._box = jQuery(this._element).hide().after(this._options.boxHtml).next().addClass('wym_box_' + this._index); 
    742742 
    743       //store the instance index in the wymbox element 
     743      //store the instance index in wymbox and element replaced by editor instance 
    744744      //but keep it compatible with jQuery < 1.2.3, see #122 
    745       if( jQuery.isFunction( jQuery.fn.data ) ) 
     745      if( jQuery.isFunction( jQuery.fn.data ) ) { 
    746746        jQuery.data(this._box.get(0), WYMeditor.WYM_INDEX, this._index); 
     747        jQuery.data(this._element.get(0), WYMeditor.WYM_INDEX, this._index); 
     748      } 
    747749       
    748750      var h = WYMeditor.Helper; 
Note: See TracChangeset for help on using the changeset viewer.