WYSIWYG Custom JavaScript
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
This module allows custom JavaScript to be injected inside a WYSIWYG iframe and modify the content within it.
It is useful if you have JavaScript that runs on the front end of your site and you want to run the same JavaScript inside the WYSIWYG to make the appearance of the content in the WYSIWYG more closely match the final output.
It requires the Wysiwyg module in order to work, and currently only works if you are using CKEditor as your WYSIWYG editor.
Note that CKEditor itself allows custom CSS to be injected into the WYSIWYG (and the Wysiwyg module exposes an administrative interface for setting that) but does not allow custom JavaScript to be injected. This module fills that gap.
Currently this module does not provide an administrative interface for indicating which JavaScript should be injected into the WYSIWYG. Instead, you must write code which implements a hook (hook_wysiwyg_custom_js_alter()) to do that.
Once you implement that hook, this module takes care of the rest. For example, it ensures that Drupal behaviors defined inside your custom JavaScript files are automatically attached and detached at the correct times when the WYSIWYG is active.
