I created a custom plugin for WYSIWYG, and it works fine when js aggregation is turned off, but not when it is enabled. By default the built-in TinyMCE plugins' js files are not aggregated with the rest of the Drupal js because TinyMCE breaks otherwise, see http://drupal.org/node/493206. This patch makes sure that js added for Drupal WYSIWYG plugins is not aggregated in the same way that built-in plugin's js files are not aggregated.
Repeatable: Always
Steps to repeat:
1. Create a Drupal WYSIWYG plugin using hook_wysiwyg_include_directory() and hook_INCLUDE_plugin() that includes a js file that calls tinymce.create().
2. Turn on js aggregation (or make sure that it's turned on).
3. Enable your plugin at /admin/settings/wysiwyg in a profile
3. Visit a node edit page where WYSIWYG is enabled.
Expected Results:
The user sees and can interact with the plugin functionality.
Actual Results:
JS errors occur. The console shows "tinymce is not defined".
| Comment | File | Size | Author |
|---|---|---|---|
| WYSIWYG-fix-js-aggregation-for-plugins.patch | 956 bytes | blisteringherb |
Comments
Comment #1
twodI'm not sure #493206: Javascript aggregation is actually true for the later versions of TinyMCE anymore.
Aggregation breaking scripts usually mean said script file is relying on automatic semi-colon insertion done during interpretation, which actually means whitespace becomes part of the JS syntax, much like in Python, or some files are being skipped by the aggregation process for some reason.
Could you attach the script files for your plugin so I can try to reproduce this? Could you also please check if this is still an issue in 6.x-2.x-dev?
Comment #2
twodWithout having the plugin code I can not determine if there may be a problem with the script so it's what causing the problems when aggregation is enabled. Other plugin scripts do work fine when aggregated so I can only close this as "cannot reproduce" for now.