Revision: 47237
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 3, 2011 10:12 by jonathanpglick
Initial Code
/** * OVERWRITES Drupal.toggleFieldset in /misc/collapse.js * * Modified to trigger autoresize on tinyMCE textareas inside collapsed fieldsets */ Drupal.toggleFieldset = function(fieldset) { if ($(fieldset).is('.collapsed')) { // Action div containers are processed separately because of a IE bug // that alters the default submit button behavior. var content = $('> div:not(.action)', fieldset); $(fieldset).removeClass('collapsed'); content.hide(); content.slideDown( { duration: 'fast', easing: 'linear', complete: function() { Drupal.collapseScrollIntoView(this.parentNode); this.parentNode.animating = false; $('div.action', fieldset).show(); // >>>> var editors = $(fieldset).find('.mceEditor'); $.each(editors, function() { var instance = tinyMCE.get($(this).attr('id').replace('_parent', '')); // Add a min height it it doesn't have one yet if (instance.plugins.autoresize && instance.plugins.autoresize.autoresize_min_height < 50) { instance.plugins.autoresize.autoresize_min_height = 50; } // Trigger the resize instance.execCommand('mceAutoResize'); }); // >>> }, step: function() { // Scroll the fieldset into view Drupal.collapseScrollIntoView(this.parentNode); } }); } else { $('div.action', fieldset).hide(); var content = $('> div:not(.action)', fieldset).slideUp('fast', function() { $(this.parentNode).addClass('collapsed'); this.parentNode.animating = false; }); } };
Initial URL
Initial Description
This override function for the default Drupal.toggleFieldset function adds code that looks for instances of TinyMCE inside the fieldset and triggers the autoresize on them when the fieldset is opened. Otherwise TinyMCE renders with a weird height.
Initial Title
Drupal collapsible fieldset script with trigger to resize TinyMCE
Initial Tags
drupal
Initial Language
JavaScript