When used in combination with the WYSIWYG Module and the TinyMCE editor changes to the body field are not detected when the editor is enabled. I think this is because WYSIWYG editors create an iFrame in designMode, which means it's editable, but changes to this frame are only written to the corresponding textarea on certain events, in this case I think the submission of the form triggers the writing... so maybe there's a way to trigger this behavior before we check for changes to the form.

Comments

aren cambre’s picture

Title: WYSIWYG changes are not detected » Detect WYSIWYG/TinyMCE changes
Version: 6.x-1.1 » 7.x-1.x-dev
Category: bug » feature

Subscribe. Moving as 7.x feature request as per Drupal convention.

janchojnacki’s picture

StatusFileSize
new1.67 KB

I have managed to get it work for CKEditor coming from WYSIWYG module

Steps:
1. Download Onchange plugin for CKEditor - http://martinezdelizarrondo.com/fckplugins/onchange1.3.zip
2. Upload onchage folder to your custom module folder and insert a code there:

function MODULENAME_wysiwyg_plugin($editor, $version) {
  switch ($editor) {
    case 'ckeditor':
      return array(
        'onchange' => array(
          'path' => drupal_get_path('module', 'MODULENAME') . '/onchange',
          'filename' => 'plugin.js',
          // Keep 'internal' => FALSE below if the plugin is not bundled with the editor (instead stored in this module's folder, sites/libraries folder or similar).
          // No need for 'path' key for bundled plugins, just set 'internal' => TRUE.
          // A list of buttons provided by this native plugin. The key has to
          // match the corresponding JavaScript implementation. The value is
          // is displayed on the editor configuration form only.
          'buttons' => array(
            'onchange' => t('onchange'),
          ),
          // No need for 'extensions' key if the plugin has buttons.
          'load' => TRUE,
          'internal' => FALSE,
        ),
      );
     break;
  }
}

3. Enable 'onchange' plugin in WYSIWYG settings
4. Apply patch for Saveguard

Please note that I have added node edit form condition to the patch. So, if it's not needed for you - remove that part.

Hope it will be useful for module feature development

pwolanin’s picture

Issue summary: View changes
Status: Active » Needs work
geek-merlin’s picture

Status: Needs work » Closed (duplicate)

So i'd propose to work on the other issue from #3.