I'd like to enable autogrow plugin, and all I need to do is to write
FCKConfig.Plugins.Add( 'autogrow' ) ;
But using Drupal+Wysiwig adds some complexity to this task :)
I've tried to add such hook in my custom module:

function sitekit_wysiwyg_plugin($editor, $version=0) {
  $plugins = array();
  
  switch ($editor) {
    case 'fckeditor':
      if ($version > 2) {        
        $plugins['noneditable'] = array(
          'path' => drupal_get_path('module', 'wysiwyg') .'/fckeditor/editor/plugins/autogrow/fckplugin.js',
          'extensions' => array('autogrow' => t('Autogrow')),
          'load' => TRUE,
        );
      }
      break;
  }
  return $plugins;
}

I see the 'autogrow' checkbox on editor settings page, I enable it - and no success.
I've also tried to add FCKConfig.Plugins.Add( 'autogrow' ) to sites\all\modules\wysiwyg\editors\js\fckeditor.config.js which I believe must be loaded on every page where wysiwig is loaded - but this file is not loaded at all. (checked this by adding alert('test')
Can anyone give me an idea what's wrong with me and my code?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Title: How to enable 'autogrow' plugin for FCKeditor 2.6? » FCKeditor: Add internal, native plugins
Version: 6.x-1.2 » 6.x-2.x-dev
Category: support » feature

As of now, I don't think that we support native (internal) editor plugins for FCKeditor.

http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Customization/P... describes that the Add method searches in the internal plugins directory by default. So, to add support for native editor plugins, we probably only need to add them to the list of native plugins, but add some code to initialize/load them appropriately in JS.

TwoD’s picture

Issue tags: -wysiwyg: fckeditor
FileSize
2.44 KB

I don't see what we have to lose by always including the config file if it seems necessary.
I made a patch for this which includes the above patch.
I've only made a quick test to see there were no errors just to see the logic still works if we've not explicitly enabled any buttons.

EDIT: This patch was meant for http://drupal.org/node/445826. I wonder how it ended up here? Thanks Sun for finding it anyway. =)

sun’s picture

Issue tags: +wysiwyg: fckeditor

heheh... btw, I wonder whether we should tag all FCKeditor (related to Wysiwyg API) issues? :)

sun’s picture

Actually, I'm looking at http://drupal.org/project/user/sun?text=fckeditor&status[]=Open and wonder whether that would work out, too? :)

Sorry for derailing this issue.

TwoD’s picture

This patch should allow native plugins to be found by FCKeditor, as long as the proper hook_wysiwyg_plugin() function to define it is available.
I tested this using both the internal version of Autogrow present in FCKeditor default dir (set the 'internal' key to true), and a copy of the same plugin using the configuration below.

function mymodule_wysiwyg_plugin($editor, $version=0) {
  $plugins = array();
 
  switch ($editor) {
    case 'fckeditor':
      if ($version > 2) {       
        $plugins['autogrow'] = array(
          'path' => '/sites/all/libraries/fckplugins/', // Should not be hardcoded
          'extensions' => array('autogrow' => t('Autogrow')),
          'load' => TRUE,
          'options' => array(
            'AutoGrowMax' => 2000,
          ),
        );
      }
      break;
  }
  return $plugins;
}

It's not 100% done as I'm still a bit unsure about the logic involved in deciding when a plugin should be loaded or not.
I have not tested this using a plugin working as a button rather than just an extension yet, but I think it should work.

sun’s picture

Status: Active » Needs review

I see now that wysiwyg_add_plugin_settings() is completely broken. Patch on the way.

sun’s picture

So here we go.

Completely revamped wysiwyg_add_plugin_settings(). Also tweaked native plugin loading for FCKeditor a bit on your last patch and added the plugins, which are shipped with FCKeditor.

From those default plugins, all seem to work, except the autogrow plugin. Looking at FCKeditor's configuration in Firebug reveals that the plugin is indeed loaded and the configuration setting is also present. However, the editor isn't auto-growing for me - for any reason.

sun’s picture

Status: Needs review » Fixed

Thanks for reporting, reviewing, and testing! Committed to all branches.

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

Feel free to re-open this issue if you want to make the autogrow plugin work.

sun’s picture

For reference: Additionally committed attached patch for TinyMCE. The new processing didn't break TinyMCE's old logic, but this patch brings it more in-line with FCKeditor's plugin definition/processing.

So understanding the plugin properties should hopefully work faster in the future :)

Status: Fixed » Closed (fixed)

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

plebe’s picture

AutoGrow was not working for me for a long time, then I searched for an answer. I found a tiny bug in the plugin which keeps it from working. I believe it's the adding of "px" to the end of the height parameter.

On line 65:
window.frameElement.height = iMainFrameSize ;

Add this line
window.frameElement.style.height = (iMainFrameSize+25)+"px"; // fix for working autogrow

This seems to fix it.

How does one get custom plug-ins to work with WYSIWYG API and FCKEditor? I have some commercial plugins which work fine with the FCKEditor module, but not with WYSIWYG API module. Any ideas how to get these working?

J

TwoD’s picture

You need to write a small custom module which uses the plugin hook from Wysiwyg module to tell the editors there are one or more native editor plugins available. See comment #5, and some projects like Wysiwyg Spellcheck, IMCE Wysiwyg bridge and Wysiwyg Template and also the api documentation in wysiwyg/wysiwyg.api.php (latest dev snapshot should have updated docs).