Hello, here is my problem :

- Install and configure wysiwyg api (with tinymce 3.2.3) and wysiwyg filter modules
- In wysiwyg api configuration, set the css to theme css
- Create a node with the input format which is set with tinymce
- Tinymce uses the theme css
- Write some content and preview the node
- The node is previewed BUT now tinymce doesn't use theme css anymore

CommentFileSizeAuthor
#2 wysiwyg-HEAD.preview.patch573 bytessun
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sinasquax’s picture

Ok, this problem appears with all editors because it's a problem of drupal :

- When we are in add / edit mode for a node, theme is initialized BEFORE wysiwyg_api module calls wysiwyg_get_css so drupal_add_css returns the correct array of css
- When we are in preview mode for a node, theme is initialized AFTER wysiwyg_api module calls wysiwyg_get_css so drupal_add_css returns an array of css without theme css

So here's a patch in wysiwyg.module to correct that (but i think this must be patched in drupal core) :

In wysiwyg_get_css of wysiwyg.module, replace :


  foreach (drupal_add_css() as $media => $css) {
    if ($media != 'print') {
      foreach ($css['theme'] as $filepath => $preprocess) {
        $files[] = base_path() . $filepath;
      }
    }
  }

by :


  for ($x = 0; $x < 2; ++$x) {
    foreach (drupal_add_css() as $media => $css) {
      if ($media != 'print') {
        foreach ($css['theme'] as $filepath => $preprocess) {
          $files[] = base_path() . $filepath;
        }
      }
    }
    
    // Verify if not empty
    if (!(empty($files))) {
      break;
    }
    
    // Initialize theme and restart process
    init_theme();
  }

sun’s picture

Version: 6.x-1.1 » 6.x-2.x-dev
Status: Active » Needs review
FileSize
573 bytes

Ugly bug.

Please test attached patch.

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.

Status: Fixed » Closed (fixed)

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